diff --git a/rest/accounts/v1/README.md b/rest/accounts/v1/README.md index f2fbc6e16..bc3ada3d7 100644 --- a/rest/accounts/v1/README.md +++ b/rest/accounts/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -44,9 +44,6 @@ Class | Method | HTTP request | Description *CredentialsPublicKeysApi* | [**FetchCredentialPublicKey**](docs/CredentialsPublicKeysApi.md#fetchcredentialpublickey) | **Get** /v1/Credentials/PublicKeys/{Sid} | *CredentialsPublicKeysApi* | [**ListCredentialPublicKey**](docs/CredentialsPublicKeysApi.md#listcredentialpublickey) | **Get** /v1/Credentials/PublicKeys | *CredentialsPublicKeysApi* | [**UpdateCredentialPublicKey**](docs/CredentialsPublicKeysApi.md#updatecredentialpublickey) | **Post** /v1/Credentials/PublicKeys/{Sid} | -*SafeListNumbersApi* | [**CreateSafelist**](docs/SafeListNumbersApi.md#createsafelist) | **Post** /v1/SafeList/Numbers | -*SafeListNumbersApi* | [**DeleteSafelist**](docs/SafeListNumbersApi.md#deletesafelist) | **Delete** /v1/SafeList/Numbers | -*SafeListNumbersApi* | [**FetchSafelist**](docs/SafeListNumbersApi.md#fetchsafelist) | **Get** /v1/SafeList/Numbers | ## Documentation For Models @@ -57,7 +54,6 @@ Class | Method | HTTP request | Description - [AccountsV1AuthTokenPromotion](docs/AccountsV1AuthTokenPromotion.md) - [AccountsV1CredentialAws](docs/AccountsV1CredentialAws.md) - [AccountsV1CredentialPublicKey](docs/AccountsV1CredentialPublicKey.md) - - [AccountsV1Safelist](docs/AccountsV1Safelist.md) - [ListCredentialAwsResponseMeta](docs/ListCredentialAwsResponseMeta.md) diff --git a/rest/accounts/v1/api_service.go b/rest/accounts/v1/api_service.go index 4ed284a19..eeee74d0f 100644 --- a/rest/accounts/v1/api_service.go +++ b/rest/accounts/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://accounts.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/accounts/v1/auth_tokens_promote.go b/rest/accounts/v1/auth_tokens_promote.go index 1f1f50146..81d3ff32f 100644 --- a/rest/accounts/v1/auth_tokens_promote.go +++ b/rest/accounts/v1/auth_tokens_promote.go @@ -16,27 +16,33 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Promote the secondary Auth Token to primary. After promoting the new token, all requests to Twilio using your old primary Auth Token will result in an error. func (c *ApiService) UpdateAuthTokenPromotion() (*AccountsV1AuthTokenPromotion, error) { - path := "/v1/AuthTokens/Promote" + path := "/v1/AuthTokens/Promote" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AccountsV1AuthTokenPromotion{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AccountsV1AuthTokenPromotion{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/accounts/v1/auth_tokens_secondary.go b/rest/accounts/v1/auth_tokens_secondary.go index a187a99d1..7137354d9 100644 --- a/rest/accounts/v1/auth_tokens_secondary.go +++ b/rest/accounts/v1/auth_tokens_secondary.go @@ -16,44 +16,52 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Create a new secondary Auth Token func (c *ApiService) CreateSecondaryAuthToken() (*AccountsV1SecondaryAuthToken, error) { - path := "/v1/AuthTokens/Secondary" + path := "/v1/AuthTokens/Secondary" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AccountsV1SecondaryAuthToken{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AccountsV1SecondaryAuthToken{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete the secondary Auth Token from your account -func (c *ApiService) DeleteSecondaryAuthToken() error { - path := "/v1/AuthTokens/Secondary" +func (c *ApiService) DeleteSecondaryAuthToken() (error) { + path := "/v1/AuthTokens/Secondary" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } diff --git a/rest/accounts/v1/credentials_aws.go b/rest/accounts/v1/credentials_aws.go index 3ec1b2945..eee3084fc 100644 --- a/rest/accounts/v1/credentials_aws.go +++ b/rest/accounts/v1/credentials_aws.go @@ -18,155 +18,161 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredentialAws' type CreateCredentialAwsParams struct { - // A string that contains the AWS access credentials in the format `:`. For example, `AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` - Credentials *string `json:"Credentials,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request. - AccountSid *string `json:"AccountSid,omitempty"` + // A string that contains the AWS access credentials in the format `:`. For example, `AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` + Credentials *string `json:"Credentials,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request. + AccountSid *string `json:"AccountSid,omitempty"` } -func (params *CreateCredentialAwsParams) SetCredentials(Credentials string) *CreateCredentialAwsParams { - params.Credentials = &Credentials - return params +func (params *CreateCredentialAwsParams) SetCredentials(Credentials string) (*CreateCredentialAwsParams){ + params.Credentials = &Credentials + return params } -func (params *CreateCredentialAwsParams) SetFriendlyName(FriendlyName string) *CreateCredentialAwsParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialAwsParams) SetFriendlyName(FriendlyName string) (*CreateCredentialAwsParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialAwsParams) SetAccountSid(AccountSid string) *CreateCredentialAwsParams { - params.AccountSid = &AccountSid - return params +func (params *CreateCredentialAwsParams) SetAccountSid(AccountSid string) (*CreateCredentialAwsParams){ + params.AccountSid = &AccountSid + return params } // Create a new AWS Credential func (c *ApiService) CreateCredentialAws(params *CreateCredentialAwsParams) (*AccountsV1CredentialAws, error) { - path := "/v1/Credentials/AWS" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Credentials != nil { - data.Set("Credentials", *params.Credentials) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AccountSid != nil { - data.Set("AccountSid", *params.AccountSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &AccountsV1CredentialAws{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials/AWS" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Credentials != nil { + data.Set("Credentials", *params.Credentials) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AccountSid != nil { + data.Set("AccountSid", *params.AccountSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AccountsV1CredentialAws{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a Credential from your account -func (c *ApiService) DeleteCredentialAws(Sid string) error { - path := "/v1/Credentials/AWS/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCredentialAws(Sid string, ) (error) { + path := "/v1/Credentials/AWS/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch the AWS credentials specified by the provided Credential Sid -func (c *ApiService) FetchCredentialAws(Sid string) (*AccountsV1CredentialAws, error) { - path := "/v1/Credentials/AWS/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCredentialAws(Sid string, ) (*AccountsV1CredentialAws, error) { + path := "/v1/Credentials/AWS/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AccountsV1CredentialAws{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AccountsV1CredentialAws{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCredentialAws' type ListCredentialAwsParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialAwsParams) SetPageSize(PageSize int) *ListCredentialAwsParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialAwsParams) SetPageSize(PageSize int) (*ListCredentialAwsParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialAwsParams) SetLimit(Limit int) *ListCredentialAwsParams { - params.Limit = &Limit - return params +func (params *ListCredentialAwsParams) SetLimit(Limit int) (*ListCredentialAwsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CredentialAws records from the API. Request is executed immediately. func (c *ApiService) PageCredentialAws(params *ListCredentialAwsParams, pageToken, pageNumber string) (*ListCredentialAwsResponse, error) { - path := "/v1/Credentials/AWS" + path := "/v1/Credentials/AWS" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialAwsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialAwsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CredentialAws records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +213,7 @@ func (c *ApiService) StreamCredentialAws(params *ListCredentialAwsParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamCredentialAws(response *ListCredentialAwsResponse, params *ListCredentialAwsParams, recordChannel chan AccountsV1CredentialAws, errorChannel chan error) { curRecord := 1 @@ -238,57 +245,59 @@ func (c *ApiService) streamCredentialAws(response *ListCredentialAwsResponse, pa } func (c *ApiService) getNextListCredentialAwsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialAwsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialAwsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredentialAws' type UpdateCredentialAwsParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateCredentialAwsParams) SetFriendlyName(FriendlyName string) *UpdateCredentialAwsParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialAwsParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialAwsParams){ + params.FriendlyName = &FriendlyName + return params } // Modify the properties of a given Account func (c *ApiService) UpdateCredentialAws(Sid string, params *UpdateCredentialAwsParams) (*AccountsV1CredentialAws, error) { - path := "/v1/Credentials/AWS/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Credentials/AWS/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AccountsV1CredentialAws{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AccountsV1CredentialAws{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/accounts/v1/credentials_public_keys.go b/rest/accounts/v1/credentials_public_keys.go index 8e78888e7..88e6da580 100644 --- a/rest/accounts/v1/credentials_public_keys.go +++ b/rest/accounts/v1/credentials_public_keys.go @@ -18,155 +18,161 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredentialPublicKey' type CreateCredentialPublicKeyParams struct { - // A URL encoded representation of the public key. For example, `-----BEGIN PUBLIC KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----` - PublicKey *string `json:"PublicKey,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request - AccountSid *string `json:"AccountSid,omitempty"` + // A URL encoded representation of the public key. For example, `-----BEGIN PUBLIC KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----` + PublicKey *string `json:"PublicKey,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request + AccountSid *string `json:"AccountSid,omitempty"` } -func (params *CreateCredentialPublicKeyParams) SetPublicKey(PublicKey string) *CreateCredentialPublicKeyParams { - params.PublicKey = &PublicKey - return params +func (params *CreateCredentialPublicKeyParams) SetPublicKey(PublicKey string) (*CreateCredentialPublicKeyParams){ + params.PublicKey = &PublicKey + return params } -func (params *CreateCredentialPublicKeyParams) SetFriendlyName(FriendlyName string) *CreateCredentialPublicKeyParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialPublicKeyParams) SetFriendlyName(FriendlyName string) (*CreateCredentialPublicKeyParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialPublicKeyParams) SetAccountSid(AccountSid string) *CreateCredentialPublicKeyParams { - params.AccountSid = &AccountSid - return params +func (params *CreateCredentialPublicKeyParams) SetAccountSid(AccountSid string) (*CreateCredentialPublicKeyParams){ + params.AccountSid = &AccountSid + return params } // Create a new Public Key Credential func (c *ApiService) CreateCredentialPublicKey(params *CreateCredentialPublicKeyParams) (*AccountsV1CredentialPublicKey, error) { - path := "/v1/Credentials/PublicKeys" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PublicKey != nil { - data.Set("PublicKey", *params.PublicKey) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AccountSid != nil { - data.Set("AccountSid", *params.AccountSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &AccountsV1CredentialPublicKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials/PublicKeys" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PublicKey != nil { + data.Set("PublicKey", *params.PublicKey) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AccountSid != nil { + data.Set("AccountSid", *params.AccountSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AccountsV1CredentialPublicKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a Credential from your account -func (c *ApiService) DeleteCredentialPublicKey(Sid string) error { - path := "/v1/Credentials/PublicKeys/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCredentialPublicKey(Sid string, ) (error) { + path := "/v1/Credentials/PublicKeys/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch the public key specified by the provided Credential Sid -func (c *ApiService) FetchCredentialPublicKey(Sid string) (*AccountsV1CredentialPublicKey, error) { - path := "/v1/Credentials/PublicKeys/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCredentialPublicKey(Sid string, ) (*AccountsV1CredentialPublicKey, error) { + path := "/v1/Credentials/PublicKeys/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AccountsV1CredentialPublicKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AccountsV1CredentialPublicKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCredentialPublicKey' type ListCredentialPublicKeyParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialPublicKeyParams) SetPageSize(PageSize int) *ListCredentialPublicKeyParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialPublicKeyParams) SetPageSize(PageSize int) (*ListCredentialPublicKeyParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialPublicKeyParams) SetLimit(Limit int) *ListCredentialPublicKeyParams { - params.Limit = &Limit - return params +func (params *ListCredentialPublicKeyParams) SetLimit(Limit int) (*ListCredentialPublicKeyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CredentialPublicKey records from the API. Request is executed immediately. func (c *ApiService) PageCredentialPublicKey(params *ListCredentialPublicKeyParams, pageToken, pageNumber string) (*ListCredentialPublicKeyResponse, error) { - path := "/v1/Credentials/PublicKeys" + path := "/v1/Credentials/PublicKeys" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialPublicKeyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialPublicKeyResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CredentialPublicKey records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +213,7 @@ func (c *ApiService) StreamCredentialPublicKey(params *ListCredentialPublicKeyPa return recordChannel, errorChannel } + func (c *ApiService) streamCredentialPublicKey(response *ListCredentialPublicKeyResponse, params *ListCredentialPublicKeyParams, recordChannel chan AccountsV1CredentialPublicKey, errorChannel chan error) { curRecord := 1 @@ -238,57 +245,59 @@ func (c *ApiService) streamCredentialPublicKey(response *ListCredentialPublicKey } func (c *ApiService) getNextListCredentialPublicKeyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialPublicKeyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialPublicKeyResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredentialPublicKey' type UpdateCredentialPublicKeyParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateCredentialPublicKeyParams) SetFriendlyName(FriendlyName string) *UpdateCredentialPublicKeyParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialPublicKeyParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialPublicKeyParams){ + params.FriendlyName = &FriendlyName + return params } // Modify the properties of a given Account func (c *ApiService) UpdateCredentialPublicKey(Sid string, params *UpdateCredentialPublicKeyParams) (*AccountsV1CredentialPublicKey, error) { - path := "/v1/Credentials/PublicKeys/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Credentials/PublicKeys/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AccountsV1CredentialPublicKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AccountsV1CredentialPublicKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/accounts/v1/docs/ListCredentialAwsResponseMeta.md b/rest/accounts/v1/docs/ListCredentialAwsResponseMeta.md index 83b55f0c5..a0725e089 100644 --- a/rest/accounts/v1/docs/ListCredentialAwsResponseMeta.md +++ b/rest/accounts/v1/docs/ListCredentialAwsResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/accounts/v1/model_accounts_v1_auth_token_promotion.go b/rest/accounts/v1/model_accounts_v1_auth_token_promotion.go index c16c53ae6..26d774a59 100644 --- a/rest/accounts/v1/model_accounts_v1_auth_token_promotion.go +++ b/rest/accounts/v1/model_accounts_v1_auth_token_promotion.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AccountsV1AuthTokenPromotion struct for AccountsV1AuthTokenPromotion type AccountsV1AuthTokenPromotion struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. AccountSid *string `json:"account_sid,omitempty"` - // The promoted Auth Token that must be used to authenticate future API requests. + // The promoted Auth Token that must be used to authenticate future API requests. AuthToken *string `json:"auth_token,omitempty"` - // The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URI for this resource, relative to `https://accounts.twilio.com` + // The URI for this resource, relative to `https://accounts.twilio.com` Url *string `json:"url,omitempty"` } + + diff --git a/rest/accounts/v1/model_accounts_v1_credential_aws.go b/rest/accounts/v1/model_accounts_v1_credential_aws.go index 259679489..03b4286e3 100644 --- a/rest/accounts/v1/model_accounts_v1_credential_aws.go +++ b/rest/accounts/v1/model_accounts_v1_credential_aws.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AccountsV1CredentialAws struct for AccountsV1CredentialAws type AccountsV1CredentialAws struct { - // The unique string that we created to identify the AWS resource. + // The unique string that we created to identify the AWS resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AWS resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AWS resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URI for this resource, relative to `https://accounts.twilio.com` + // The URI for this resource, relative to `https://accounts.twilio.com` Url *string `json:"url,omitempty"` } + + diff --git a/rest/accounts/v1/model_accounts_v1_credential_public_key.go b/rest/accounts/v1/model_accounts_v1_credential_public_key.go index 557134730..c07ac7a93 100644 --- a/rest/accounts/v1/model_accounts_v1_credential_public_key.go +++ b/rest/accounts/v1/model_accounts_v1_credential_public_key.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AccountsV1CredentialPublicKey struct for AccountsV1CredentialPublicKey type AccountsV1CredentialPublicKey struct { - // The unique string that that we created to identify the PublicKey resource. + // The unique string that that we created to identify the PublicKey resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URI for this resource, relative to `https://accounts.twilio.com` + // The URI for this resource, relative to `https://accounts.twilio.com` Url *string `json:"url,omitempty"` } + + diff --git a/rest/accounts/v1/model_accounts_v1_secondary_auth_token.go b/rest/accounts/v1/model_accounts_v1_secondary_auth_token.go index b6353b77f..a4b06bbbb 100644 --- a/rest/accounts/v1/model_accounts_v1_secondary_auth_token.go +++ b/rest/accounts/v1/model_accounts_v1_secondary_auth_token.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AccountsV1SecondaryAuthToken struct for AccountsV1SecondaryAuthToken type AccountsV1SecondaryAuthToken struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in UTC when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in UTC when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The generated secondary Auth Token that can be used to authenticate future API requests. + // The generated secondary Auth Token that can be used to authenticate future API requests. SecondaryAuthToken *string `json:"secondary_auth_token,omitempty"` - // The URI for this resource, relative to `https://accounts.twilio.com` + // The URI for this resource, relative to `https://accounts.twilio.com` Url *string `json:"url,omitempty"` } + + diff --git a/rest/accounts/v1/model_list_credential_aws_response.go b/rest/accounts/v1/model_list_credential_aws_response.go index 760481a86..b4e6a91e7 100644 --- a/rest/accounts/v1/model_list_credential_aws_response.go +++ b/rest/accounts/v1/model_list_credential_aws_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialAwsResponse struct for ListCredentialAwsResponse type ListCredentialAwsResponse struct { - Credentials []AccountsV1CredentialAws `json:"credentials,omitempty"` - Meta ListCredentialAwsResponseMeta `json:"meta,omitempty"` + Credentials []AccountsV1CredentialAws `json:"credentials,omitempty"` + Meta ListCredentialAwsResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/accounts/v1/model_list_credential_aws_response_meta.go b/rest/accounts/v1/model_list_credential_aws_response_meta.go index 89b23913b..a38830504 100644 --- a/rest/accounts/v1/model_list_credential_aws_response_meta.go +++ b/rest/accounts/v1/model_list_credential_aws_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialAwsResponseMeta struct for ListCredentialAwsResponseMeta type ListCredentialAwsResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/accounts/v1/model_list_credential_public_key_response.go b/rest/accounts/v1/model_list_credential_public_key_response.go index d1c1f75fa..36aeb73bb 100644 --- a/rest/accounts/v1/model_list_credential_public_key_response.go +++ b/rest/accounts/v1/model_list_credential_public_key_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialPublicKeyResponse struct for ListCredentialPublicKeyResponse type ListCredentialPublicKeyResponse struct { Credentials []AccountsV1CredentialPublicKey `json:"credentials,omitempty"` - Meta ListCredentialAwsResponseMeta `json:"meta,omitempty"` + Meta ListCredentialAwsResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/api/v2010/README.md b/rest/api/v2010/README.md index 01219c503..466e62a60 100644 --- a/rest/api/v2010/README.md +++ b/rest/api/v2010/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -230,133 +230,106 @@ Class | Method | HTTP request | Description *AccountsUsageTriggersApi* | [**FetchUsageTrigger**](docs/AccountsUsageTriggersApi.md#fetchusagetrigger) | **Get** /2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json | *AccountsUsageTriggersApi* | [**ListUsageTrigger**](docs/AccountsUsageTriggersApi.md#listusagetrigger) | **Get** /2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json | *AccountsUsageTriggersApi* | [**UpdateUsageTrigger**](docs/AccountsUsageTriggersApi.md#updateusagetrigger) | **Post** /2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json | +*SafeListNumbersApi* | [**CreateSafelist**](docs/SafeListNumbersApi.md#createsafelist) | **Post** /2010-04-01/SafeList/Numbers.json | +*SafeListNumbersApi* | [**DeleteSafelist**](docs/SafeListNumbersApi.md#deletesafelist) | **Delete** /2010-04-01/SafeList/Numbers.json | +*SafeListNumbersApi* | [**FetchSafelist**](docs/SafeListNumbersApi.md#fetchsafelist) | **Get** /2010-04-01/SafeList/Numbers.json | ## Documentation For Models - - [ListQueueResponse](docs/ListQueueResponse.md) - - [ApiV2010AccountIncomingPhoneNumberCapabilities](docs/ApiV2010AccountIncomingPhoneNumberCapabilities.md) + - [ListAvailablePhoneNumberCountry200Response](docs/ListAvailablePhoneNumberCountry200Response.md) - [ApiV2010UsageRecordAllTime](docs/ApiV2010UsageRecordAllTime.md) - - [ApiV2010CallRecording](docs/ApiV2010CallRecording.md) + - [ListAvailablePhoneNumberVoip200Response](docs/ListAvailablePhoneNumberVoip200Response.md) - [ListConferenceRecordingResponse](docs/ListConferenceRecordingResponse.md) - - [ApiV2010AvailablePhoneNumberSharedCost](docs/ApiV2010AvailablePhoneNumberSharedCost.md) - [ListApplicationResponse](docs/ListApplicationResponse.md) + - [ListUsageRecordDaily200Response](docs/ListUsageRecordDaily200Response.md) - [ApiV2010UsageRecord](docs/ApiV2010UsageRecord.md) + - [ListAvailablePhoneNumberTollFree200Response](docs/ListAvailablePhoneNumberTollFree200Response.md) - [ListIncomingPhoneNumberLocalResponse](docs/ListIncomingPhoneNumberLocalResponse.md) - [ApiV2010UserDefinedMessage](docs/ApiV2010UserDefinedMessage.md) - [ApiV2010RecordingAddOnResultPayload](docs/ApiV2010RecordingAddOnResultPayload.md) - [ListMessageResponse](docs/ListMessageResponse.md) - - [ApiV2010Transcription](docs/ApiV2010Transcription.md) - - [ApiV2010OutgoingCallerId](docs/ApiV2010OutgoingCallerId.md) - - [ListParticipantResponse](docs/ListParticipantResponse.md) + - [ListSipDomain200Response](docs/ListSipDomain200Response.md) + - [ListSipAuthCallsIpAccessControlListMapping200Response](docs/ListSipAuthCallsIpAccessControlListMapping200Response.md) - [ListRecordingAddOnResultPayloadResponse](docs/ListRecordingAddOnResultPayloadResponse.md) - - [ApiV2010Siprec](docs/ApiV2010Siprec.md) - [ListConnectAppResponse](docs/ListConnectAppResponse.md) - - [ListUsageRecordYearlyResponse](docs/ListUsageRecordYearlyResponse.md) - - [ListUsageRecordThisMonthResponse](docs/ListUsageRecordThisMonthResponse.md) - [ApiV2010UsageRecordMonthly](docs/ApiV2010UsageRecordMonthly.md) - - [ApiV2010Conference](docs/ApiV2010Conference.md) - - [ListAvailablePhoneNumberMobileResponse](docs/ListAvailablePhoneNumberMobileResponse.md) - - [ListAvailablePhoneNumberTollFreeResponse](docs/ListAvailablePhoneNumberTollFreeResponse.md) - - [ListSipCredentialListMappingResponse](docs/ListSipCredentialListMappingResponse.md) + - [ListAccount200Response](docs/ListAccount200Response.md) - [ApiV2010CallNotificationInstance](docs/ApiV2010CallNotificationInstance.md) - [ListUsageRecordMonthlyResponse](docs/ListUsageRecordMonthlyResponse.md) + - [ListSigningKey200Response](docs/ListSigningKey200Response.md) - [ApiV2010CallFeedback](docs/ApiV2010CallFeedback.md) - [ListUsageRecordLastMonthResponse](docs/ListUsageRecordLastMonthResponse.md) - [ApiV2010RecordingTranscription](docs/ApiV2010RecordingTranscription.md) + - [ListRecordingTranscription200Response](docs/ListRecordingTranscription200Response.md) - [ListSigningKeyResponse](docs/ListSigningKeyResponse.md) - - [ApiV2010Queue](docs/ApiV2010Queue.md) + - [ListUsageTrigger200Response](docs/ListUsageTrigger200Response.md) - [ApiV2010Token](docs/ApiV2010Token.md) - - [ListDependentPhoneNumberResponse](docs/ListDependentPhoneNumberResponse.md) - - [ListAvailablePhoneNumberNationalResponse](docs/ListAvailablePhoneNumberNationalResponse.md) - [ApiV2010UsageRecordYesterday](docs/ApiV2010UsageRecordYesterday.md) - - [ListAvailablePhoneNumberSharedCostResponse](docs/ListAvailablePhoneNumberSharedCostResponse.md) - - [ApiV2010AvailablePhoneNumberVoip](docs/ApiV2010AvailablePhoneNumberVoip.md) - [ApiV2010IncomingPhoneNumberMobile](docs/ApiV2010IncomingPhoneNumberMobile.md) - [ApiV2010SipIpAccessControlList](docs/ApiV2010SipIpAccessControlList.md) - - [ListCallNotificationResponse](docs/ListCallNotificationResponse.md) - - [ApiV2010AccountTokenIceServers](docs/ApiV2010AccountTokenIceServers.md) - [ApiV2010AvailablePhoneNumberCountry](docs/ApiV2010AvailablePhoneNumberCountry.md) - [ApiV2010UsageRecordThisMonth](docs/ApiV2010UsageRecordThisMonth.md) - [ListAvailablePhoneNumberVoipResponse](docs/ListAvailablePhoneNumberVoipResponse.md) - [ListShortCodeResponse](docs/ListShortCodeResponse.md) - [ApiV2010Call](docs/ApiV2010Call.md) - - [ListCallResponse](docs/ListCallResponse.md) - [ApiV2010ShortCode](docs/ApiV2010ShortCode.md) - [ApiV2010Member](docs/ApiV2010Member.md) - [ApiV2010SipAuthRegistrationsCredentialListMapping](docs/ApiV2010SipAuthRegistrationsCredentialListMapping.md) - [ListAddressResponse](docs/ListAddressResponse.md) + - [ListMessage200Response](docs/ListMessage200Response.md) + - [ListMedia200Response](docs/ListMedia200Response.md) + - [ListApplication200Response](docs/ListApplication200Response.md) - [ApiV2010SipCredential](docs/ApiV2010SipCredential.md) - - [ListOutgoingCallerIdResponse](docs/ListOutgoingCallerIdResponse.md) - - [ListSipIpAccessControlListResponse](docs/ListSipIpAccessControlListResponse.md) - - [ListAccountResponse](docs/ListAccountResponse.md) - - [ListIncomingPhoneNumberResponse](docs/ListIncomingPhoneNumberResponse.md) + - [ListUsageRecordThisMonth200Response](docs/ListUsageRecordThisMonth200Response.md) - [ListUsageRecordTodayResponse](docs/ListUsageRecordTodayResponse.md) + - [ListUsageRecordYesterday200Response](docs/ListUsageRecordYesterday200Response.md) - [ApiV2010Key](docs/ApiV2010Key.md) - - [ApiV2010CallNotification](docs/ApiV2010CallNotification.md) - [ListAvailablePhoneNumberMachineToMachineResponse](docs/ListAvailablePhoneNumberMachineToMachineResponse.md) - - [ApiV2010IncomingPhoneNumberLocal](docs/ApiV2010IncomingPhoneNumberLocal.md) + - [ListIncomingPhoneNumber200Response](docs/ListIncomingPhoneNumber200Response.md) + - [ListUsageRecordYearly200Response](docs/ListUsageRecordYearly200Response.md) - [ApiV2010Media](docs/ApiV2010Media.md) - [ApiV2010UsageRecordYearly](docs/ApiV2010UsageRecordYearly.md) - [ApiV2010CallFeedbackSummary](docs/ApiV2010CallFeedbackSummary.md) - - [ApiV2010SipIpAccessControlListMapping](docs/ApiV2010SipIpAccessControlListMapping.md) + - [ListAuthorizedConnectApp200Response](docs/ListAuthorizedConnectApp200Response.md) - [ListKeyResponse](docs/ListKeyResponse.md) - - [ApiV2010AvailablePhoneNumberMachineToMachine](docs/ApiV2010AvailablePhoneNumberMachineToMachine.md) - - [ApiV2010Notification](docs/ApiV2010Notification.md) - - [ApiV2010Recording](docs/ApiV2010Recording.md) - - [ListRecordingTranscriptionResponse](docs/ListRecordingTranscriptionResponse.md) - - [ApiV2010IncomingPhoneNumberTollFree](docs/ApiV2010IncomingPhoneNumberTollFree.md) - - [ApiV2010ValidationRequest](docs/ApiV2010ValidationRequest.md) - [ApiV2010NotificationInstance](docs/ApiV2010NotificationInstance.md) - [ApiV2010MessageFeedback](docs/ApiV2010MessageFeedback.md) - [ApiV2010DependentPhoneNumber](docs/ApiV2010DependentPhoneNumber.md) - [ApiV2010IncomingPhoneNumberAssignedAddOn](docs/ApiV2010IncomingPhoneNumberAssignedAddOn.md) - [ApiV2010UsageRecordDaily](docs/ApiV2010UsageRecordDaily.md) - - [ApiV2010Application](docs/ApiV2010Application.md) - - [ListIncomingPhoneNumberTollFreeResponse](docs/ListIncomingPhoneNumberTollFreeResponse.md) - [ListSipAuthCallsCredentialListMappingResponse](docs/ListSipAuthCallsCredentialListMappingResponse.md) - - [ApiV2010Payments](docs/ApiV2010Payments.md) + - [ListSipAuthCallsCredentialListMapping200Response](docs/ListSipAuthCallsCredentialListMapping200Response.md) + - [ListIncomingPhoneNumberMobile200Response](docs/ListIncomingPhoneNumberMobile200Response.md) - [ApiV2010Account](docs/ApiV2010Account.md) - - [ListSipIpAccessControlListMappingResponse](docs/ListSipIpAccessControlListMappingResponse.md) - - [ApiV2010Participant](docs/ApiV2010Participant.md) + - [ListUsageRecordMonthly200Response](docs/ListUsageRecordMonthly200Response.md) - [ApiV2010CallEvent](docs/ApiV2010CallEvent.md) - - [ApiV2010SipAuthCallsCredentialListMapping](docs/ApiV2010SipAuthCallsCredentialListMapping.md) - - [ListSipIpAddressResponse](docs/ListSipIpAddressResponse.md) + - [ListSipCredentialList200Response](docs/ListSipCredentialList200Response.md) - [ApiV2010NewKey](docs/ApiV2010NewKey.md) - [ApiV2010UserDefinedMessageSubscription](docs/ApiV2010UserDefinedMessageSubscription.md) - [ApiV2010NewSigningKey](docs/ApiV2010NewSigningKey.md) - - [ListAvailablePhoneNumberLocalResponse](docs/ListAvailablePhoneNumberLocalResponse.md) - - [ListUsageRecordYesterdayResponse](docs/ListUsageRecordYesterdayResponse.md) + - [ListSipIpAccessControlListMapping200Response](docs/ListSipIpAccessControlListMapping200Response.md) + - [ListShortCode200Response](docs/ListShortCode200Response.md) - [ListConferenceResponse](docs/ListConferenceResponse.md) - [ApiV2010AvailablePhoneNumberLocal](docs/ApiV2010AvailablePhoneNumberLocal.md) - - [ApiV2010SipCredentialList](docs/ApiV2010SipCredentialList.md) - - [ApiV2010Message](docs/ApiV2010Message.md) + - [ListTranscription200Response](docs/ListTranscription200Response.md) - [ListRecordingResponse](docs/ListRecordingResponse.md) - - [ApiV2010UsageRecordLastMonth](docs/ApiV2010UsageRecordLastMonth.md) - [ListUsageTriggerResponse](docs/ListUsageTriggerResponse.md) - [ApiV2010RecordingAddOnResult](docs/ApiV2010RecordingAddOnResult.md) - - [ListAvailablePhoneNumberCountryResponse](docs/ListAvailablePhoneNumberCountryResponse.md) - - [ListCallRecordingResponse](docs/ListCallRecordingResponse.md) - [ListSipCredentialListResponse](docs/ListSipCredentialListResponse.md) - [ListIncomingPhoneNumberMobileResponse](docs/ListIncomingPhoneNumberMobileResponse.md) - [ApiV2010AvailablePhoneNumberMobile](docs/ApiV2010AvailablePhoneNumberMobile.md) - - [ApiV2010SipCredentialListMapping](docs/ApiV2010SipCredentialListMapping.md) - [ApiV2010Stream](docs/ApiV2010Stream.md) - - [ApiV2010AvailablePhoneNumberTollFree](docs/ApiV2010AvailablePhoneNumberTollFree.md) - - [ApiV2010SipDomain](docs/ApiV2010SipDomain.md) - [ListUsageRecordDailyResponse](docs/ListUsageRecordDailyResponse.md) - [ListIncomingPhoneNumberAssignedAddOnResponse](docs/ListIncomingPhoneNumberAssignedAddOnResponse.md) - [ListSipCredentialResponse](docs/ListSipCredentialResponse.md) - [ListCallEventResponse](docs/ListCallEventResponse.md) + - [ListIncomingPhoneNumberTollFree200Response](docs/ListIncomingPhoneNumberTollFree200Response.md) - [ApiV2010SipIpAddress](docs/ApiV2010SipIpAddress.md) - - [ListAuthorizedConnectAppResponse](docs/ListAuthorizedConnectAppResponse.md) + - [ListUsageRecordToday200Response](docs/ListUsageRecordToday200Response.md) - [ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities](docs/ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities.md) - [ListMemberResponse](docs/ListMemberResponse.md) - - [ApiV2010IncomingPhoneNumber](docs/ApiV2010IncomingPhoneNumber.md) - - [ApiV2010ConnectApp](docs/ApiV2010ConnectApp.md) - - [ApiV2010SipAuthCallsIpAccessControlListMapping](docs/ApiV2010SipAuthCallsIpAccessControlListMapping.md) - [ApiV2010UsageRecordToday](docs/ApiV2010UsageRecordToday.md) - - [ApiV2010ConferenceRecording](docs/ApiV2010ConferenceRecording.md) - [ApiV2010AvailablePhoneNumberNational](docs/ApiV2010AvailablePhoneNumberNational.md) - [ApiV2010SigningKey](docs/ApiV2010SigningKey.md) - [ApiV2010Address](docs/ApiV2010Address.md) @@ -364,16 +337,109 @@ Class | Method | HTTP request | Description - [ListNotificationResponse](docs/ListNotificationResponse.md) - [ListMediaResponse](docs/ListMediaResponse.md) - [ListUsageRecordResponse](docs/ListUsageRecordResponse.md) - - [ApiV2010IncomingPhoneNumberAssignedAddOnExtension](docs/ApiV2010IncomingPhoneNumberAssignedAddOnExtension.md) - - [ListRecordingAddOnResultResponse](docs/ListRecordingAddOnResultResponse.md) + - [ListMember200Response](docs/ListMember200Response.md) - [ListIncomingPhoneNumberAssignedAddOnExtensionResponse](docs/ListIncomingPhoneNumberAssignedAddOnExtensionResponse.md) - [ListSipAuthCallsIpAccessControlListMappingResponse](docs/ListSipAuthCallsIpAccessControlListMappingResponse.md) + - [ListAccount200ResponseAllOf](docs/ListAccount200ResponseAllOf.md) + - [ListSipAuthRegistrationsCredentialListMappingResponse](docs/ListSipAuthRegistrationsCredentialListMappingResponse.md) + - [ListUsageRecord200Response](docs/ListUsageRecord200Response.md) + - [ListUsageRecordLastMonth200Response](docs/ListUsageRecordLastMonth200Response.md) + - [ListRecording200Response](docs/ListRecording200Response.md) + - [ListTranscriptionResponse](docs/ListTranscriptionResponse.md) + - [ListSipAuthRegistrationsCredentialListMapping200Response](docs/ListSipAuthRegistrationsCredentialListMapping200Response.md) + - [ListQueueResponse](docs/ListQueueResponse.md) + - [ApiV2010AccountIncomingPhoneNumberCapabilities](docs/ApiV2010AccountIncomingPhoneNumberCapabilities.md) + - [ApiV2010CallRecording](docs/ApiV2010CallRecording.md) + - [ApiV2010AvailablePhoneNumberSharedCost](docs/ApiV2010AvailablePhoneNumberSharedCost.md) + - [ListSipCredential200Response](docs/ListSipCredential200Response.md) + - [ApiV2010Transcription](docs/ApiV2010Transcription.md) + - [ListCallNotification200Response](docs/ListCallNotification200Response.md) + - [ApiV2010OutgoingCallerId](docs/ApiV2010OutgoingCallerId.md) + - [ListCall200Response](docs/ListCall200Response.md) + - [ListParticipantResponse](docs/ListParticipantResponse.md) + - [ApiV2010Siprec](docs/ApiV2010Siprec.md) + - [ListUsageRecordAllTime200Response](docs/ListUsageRecordAllTime200Response.md) + - [ListUsageRecordYearlyResponse](docs/ListUsageRecordYearlyResponse.md) + - [ListParticipant200Response](docs/ListParticipant200Response.md) + - [ListUsageRecordThisMonthResponse](docs/ListUsageRecordThisMonthResponse.md) + - [ApiV2010Conference](docs/ApiV2010Conference.md) + - [ListAvailablePhoneNumberMobileResponse](docs/ListAvailablePhoneNumberMobileResponse.md) + - [ListOutgoingCallerId200Response](docs/ListOutgoingCallerId200Response.md) + - [ListAvailablePhoneNumberTollFreeResponse](docs/ListAvailablePhoneNumberTollFreeResponse.md) + - [ListSipCredentialListMappingResponse](docs/ListSipCredentialListMappingResponse.md) + - [ListConferenceRecording200Response](docs/ListConferenceRecording200Response.md) + - [ApiV2010Queue](docs/ApiV2010Queue.md) + - [ListDependentPhoneNumberResponse](docs/ListDependentPhoneNumberResponse.md) + - [ListAvailablePhoneNumberNationalResponse](docs/ListAvailablePhoneNumberNationalResponse.md) + - [ListAvailablePhoneNumberSharedCostResponse](docs/ListAvailablePhoneNumberSharedCostResponse.md) + - [ApiV2010AvailablePhoneNumberVoip](docs/ApiV2010AvailablePhoneNumberVoip.md) + - [ListNotification200Response](docs/ListNotification200Response.md) + - [ListCallNotificationResponse](docs/ListCallNotificationResponse.md) + - [ApiV2010AccountTokenIceServers](docs/ApiV2010AccountTokenIceServers.md) + - [ListAddress200Response](docs/ListAddress200Response.md) + - [ApiV2010Safelist](docs/ApiV2010Safelist.md) + - [ListCallResponse](docs/ListCallResponse.md) + - [ListRecordingAddOnResultPayload200Response](docs/ListRecordingAddOnResultPayload200Response.md) + - [ListKey200Response](docs/ListKey200Response.md) + - [ListAvailablePhoneNumberMachineToMachine200Response](docs/ListAvailablePhoneNumberMachineToMachine200Response.md) + - [ListOutgoingCallerIdResponse](docs/ListOutgoingCallerIdResponse.md) + - [ListSipIpAccessControlListResponse](docs/ListSipIpAccessControlListResponse.md) + - [ListAvailablePhoneNumberSharedCost200Response](docs/ListAvailablePhoneNumberSharedCost200Response.md) + - [ListRecordingAddOnResult200Response](docs/ListRecordingAddOnResult200Response.md) + - [ListAccountResponse](docs/ListAccountResponse.md) + - [ListIncomingPhoneNumberResponse](docs/ListIncomingPhoneNumberResponse.md) + - [ApiV2010CallNotification](docs/ApiV2010CallNotification.md) + - [ApiV2010IncomingPhoneNumberLocal](docs/ApiV2010IncomingPhoneNumberLocal.md) + - [ListConnectApp200Response](docs/ListConnectApp200Response.md) + - [ListQueue200Response](docs/ListQueue200Response.md) + - [ApiV2010SipIpAccessControlListMapping](docs/ApiV2010SipIpAccessControlListMapping.md) + - [ApiV2010AvailablePhoneNumberMachineToMachine](docs/ApiV2010AvailablePhoneNumberMachineToMachine.md) + - [ApiV2010Notification](docs/ApiV2010Notification.md) + - [ApiV2010Recording](docs/ApiV2010Recording.md) + - [ListRecordingTranscriptionResponse](docs/ListRecordingTranscriptionResponse.md) + - [ListDependentPhoneNumber200Response](docs/ListDependentPhoneNumber200Response.md) + - [ApiV2010IncomingPhoneNumberTollFree](docs/ApiV2010IncomingPhoneNumberTollFree.md) + - [ApiV2010ValidationRequest](docs/ApiV2010ValidationRequest.md) + - [ListAvailablePhoneNumberMobile200Response](docs/ListAvailablePhoneNumberMobile200Response.md) + - [ApiV2010Application](docs/ApiV2010Application.md) + - [ListIncomingPhoneNumberTollFreeResponse](docs/ListIncomingPhoneNumberTollFreeResponse.md) + - [ApiV2010Payments](docs/ApiV2010Payments.md) + - [ListSipIpAccessControlListMappingResponse](docs/ListSipIpAccessControlListMappingResponse.md) + - [ApiV2010Participant](docs/ApiV2010Participant.md) + - [ApiV2010SipAuthCallsCredentialListMapping](docs/ApiV2010SipAuthCallsCredentialListMapping.md) + - [ListSipIpAddressResponse](docs/ListSipIpAddressResponse.md) + - [ListIncomingPhoneNumberAssignedAddOn200Response](docs/ListIncomingPhoneNumberAssignedAddOn200Response.md) + - [ListAvailablePhoneNumberLocalResponse](docs/ListAvailablePhoneNumberLocalResponse.md) + - [ListUsageRecordYesterdayResponse](docs/ListUsageRecordYesterdayResponse.md) + - [ApiV2010SipCredentialList](docs/ApiV2010SipCredentialList.md) + - [ListCallEvent200Response](docs/ListCallEvent200Response.md) + - [ApiV2010Message](docs/ApiV2010Message.md) + - [ApiV2010UsageRecordLastMonth](docs/ApiV2010UsageRecordLastMonth.md) + - [ListAvailablePhoneNumberCountryResponse](docs/ListAvailablePhoneNumberCountryResponse.md) + - [ListCallRecordingResponse](docs/ListCallRecordingResponse.md) + - [ApiV2010SipCredentialListMapping](docs/ApiV2010SipCredentialListMapping.md) + - [ApiV2010AvailablePhoneNumberTollFree](docs/ApiV2010AvailablePhoneNumberTollFree.md) + - [ApiV2010SipDomain](docs/ApiV2010SipDomain.md) + - [ListSipIpAddress200Response](docs/ListSipIpAddress200Response.md) + - [ListConference200Response](docs/ListConference200Response.md) + - [ListSipCredentialListMapping200Response](docs/ListSipCredentialListMapping200Response.md) + - [ListSipIpAccessControlList200Response](docs/ListSipIpAccessControlList200Response.md) + - [ListAuthorizedConnectAppResponse](docs/ListAuthorizedConnectAppResponse.md) + - [ApiV2010IncomingPhoneNumber](docs/ApiV2010IncomingPhoneNumber.md) + - [ApiV2010ConnectApp](docs/ApiV2010ConnectApp.md) + - [ListAvailablePhoneNumberNational200Response](docs/ListAvailablePhoneNumberNational200Response.md) + - [ApiV2010SipAuthCallsIpAccessControlListMapping](docs/ApiV2010SipAuthCallsIpAccessControlListMapping.md) + - [ListCallRecording200Response](docs/ListCallRecording200Response.md) + - [ApiV2010ConferenceRecording](docs/ApiV2010ConferenceRecording.md) + - [ListIncomingPhoneNumberLocal200Response](docs/ListIncomingPhoneNumberLocal200Response.md) + - [ApiV2010IncomingPhoneNumberAssignedAddOnExtension](docs/ApiV2010IncomingPhoneNumberAssignedAddOnExtension.md) + - [ListIncomingPhoneNumberAssignedAddOnExtension200Response](docs/ListIncomingPhoneNumberAssignedAddOnExtension200Response.md) + - [ListRecordingAddOnResultResponse](docs/ListRecordingAddOnResultResponse.md) - [ApiV2010AuthorizedConnectApp](docs/ApiV2010AuthorizedConnectApp.md) - [ListUsageRecordAllTimeResponse](docs/ListUsageRecordAllTimeResponse.md) + - [ListAvailablePhoneNumberLocal200Response](docs/ListAvailablePhoneNumberLocal200Response.md) - [ListSipDomainResponse](docs/ListSipDomainResponse.md) - - [ListSipAuthRegistrationsCredentialListMappingResponse](docs/ListSipAuthRegistrationsCredentialListMappingResponse.md) - [ApiV2010Balance](docs/ApiV2010Balance.md) - - [ListTranscriptionResponse](docs/ListTranscriptionResponse.md) ## Documentation For Authorization diff --git a/rest/api/v2010/accounts.go b/rest/api/v2010/accounts.go index 9d72732d9..f0f946b04 100644 --- a/rest/api/v2010/accounts.go +++ b/rest/api/v2010/accounts.go @@ -18,144 +18,148 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAccount' type CreateAccountParams struct { - // A human readable description of the account to create, defaults to `SubAccount Created at {YYYY-MM-DD HH:MM meridian}` - FriendlyName *string `json:"FriendlyName,omitempty"` + // A human readable description of the account to create, defaults to `SubAccount Created at {YYYY-MM-DD HH:MM meridian}` + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateAccountParams) SetFriendlyName(FriendlyName string) *CreateAccountParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateAccountParams) SetFriendlyName(FriendlyName string) (*CreateAccountParams){ + params.FriendlyName = &FriendlyName + return params } // Create a new Twilio Subaccount from the account making the request func (c *ApiService) CreateAccount(params *CreateAccountParams) (*ApiV2010Account, error) { - path := "/2010-04-01/Accounts.json" + path := "/2010-04-01/Accounts.json" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010Account{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010Account{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Fetch the account specified by the provided Account Sid -func (c *ApiService) FetchAccount(Sid string) (*ApiV2010Account, error) { - path := "/2010-04-01/Accounts/{Sid}.json" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchAccount(Sid string, ) (*ApiV2010Account, error) { + path := "/2010-04-01/Accounts/{Sid}.json" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Account{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Account{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAccount' type ListAccountParams struct { - // Only return the Account resources with friendly names that exactly match this name. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Only return Account resources with the given status. Can be `closed`, `suspended` or `active`. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only return the Account resources with friendly names that exactly match this name. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Only return Account resources with the given status. Can be `closed`, `suspended` or `active`. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAccountParams) SetFriendlyName(FriendlyName string) *ListAccountParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListAccountParams) SetFriendlyName(FriendlyName string) (*ListAccountParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListAccountParams) SetStatus(Status string) *ListAccountParams { - params.Status = &Status - return params +func (params *ListAccountParams) SetStatus(Status string) (*ListAccountParams){ + params.Status = &Status + return params } -func (params *ListAccountParams) SetPageSize(PageSize int) *ListAccountParams { - params.PageSize = &PageSize - return params +func (params *ListAccountParams) SetPageSize(PageSize int) (*ListAccountParams){ + params.PageSize = &PageSize + return params } -func (params *ListAccountParams) SetLimit(Limit int) *ListAccountParams { - params.Limit = &Limit - return params +func (params *ListAccountParams) SetLimit(Limit int) (*ListAccountParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Account records from the API. Request is executed immediately. -func (c *ApiService) PageAccount(params *ListAccountParams, pageToken, pageNumber string) (*ListAccountResponse, error) { - path := "/2010-04-01/Accounts.json" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAccountResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageAccount(params *ListAccountParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts.json" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Account records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAccount(params *ListAccountParams) ([]ApiV2010Account, error) { +func (c *ApiService) ListAccount(params *ListAccountParams) (ListAccount200Response, error) { response, errors := c.StreamAccount(params) - records := make([]ApiV2010Account, 0) + records := make(ListAccount200Response, 0) for record := range response { records = append(records, record) } @@ -168,13 +172,13 @@ func (c *ApiService) ListAccount(params *ListAccountParams) ([]ApiV2010Account, } // Streams Account records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAccount(params *ListAccountParams) (chan ApiV2010Account, chan error) { +func (c *ApiService) StreamAccount(params *ListAccountParams) (chan ListAccount200Response, chan error) { if params == nil { params = &ListAccountParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Account, 1) + recordChannel := make(chan ListAccount200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAccount(params, "", "") @@ -189,11 +193,12 @@ func (c *ApiService) StreamAccount(params *ListAccountParams) (chan ApiV2010Acco return recordChannel, errorChannel } -func (c *ApiService) streamAccount(response *ListAccountResponse, params *ListAccountParams, recordChannel chan ApiV2010Account, errorChannel chan error) { + +func (c *ApiService) streamAccount(response *, params *ListAccountParams, recordChannel chan ListAccount200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Accounts + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -204,7 +209,7 @@ func (c *ApiService) streamAccount(response *ListAccountResponse, params *ListAc } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAccountResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -212,74 +217,76 @@ func (c *ApiService) streamAccount(response *ListAccountResponse, params *ListAc break } - response = record.(*ListAccountResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAccountResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAccountResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateAccount' type UpdateAccountParams struct { - // Update the human-readable description of this Account - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Status *string `json:"Status,omitempty"` + // Update the human-readable description of this Account + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateAccountParams) SetFriendlyName(FriendlyName string) *UpdateAccountParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateAccountParams) SetFriendlyName(FriendlyName string) (*UpdateAccountParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateAccountParams) SetStatus(Status string) *UpdateAccountParams { - params.Status = &Status - return params +func (params *UpdateAccountParams) SetStatus(Status string) (*UpdateAccountParams){ + params.Status = &Status + return params } // Modify the properties of a given Account func (c *ApiService) UpdateAccount(Sid string, params *UpdateAccountParams) (*ApiV2010Account, error) { - path := "/2010-04-01/Accounts/{Sid}.json" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{Sid}.json" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Account{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Account{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_addresses.go b/rest/api/v2010/accounts_addresses.go index 053910881..3c3b8a157 100644 --- a/rest/api/v2010/accounts_addresses.go +++ b/rest/api/v2010/accounts_addresses.go @@ -18,307 +18,312 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAddress' type CreateAddressParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will be responsible for the new Address resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The name to associate with the new address. - CustomerName *string `json:"CustomerName,omitempty"` - // The number and street address of the new address. - Street *string `json:"Street,omitempty"` - // The city of the new address. - City *string `json:"City,omitempty"` - // The state or region of the new address. - Region *string `json:"Region,omitempty"` - // The postal code of the new address. - PostalCode *string `json:"PostalCode,omitempty"` - // The ISO country code of the new address. - IsoCountry *string `json:"IsoCountry,omitempty"` - // A descriptive string that you create to describe the new address. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether to enable emergency calling on the new address. Can be: `true` or `false`. - EmergencyEnabled *bool `json:"EmergencyEnabled,omitempty"` - // Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide. - AutoCorrectAddress *bool `json:"AutoCorrectAddress,omitempty"` - // The additional number and street address of the address. - StreetSecondary *string `json:"StreetSecondary,omitempty"` -} - -func (params *CreateAddressParams) SetPathAccountSid(PathAccountSid string) *CreateAddressParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateAddressParams) SetCustomerName(CustomerName string) *CreateAddressParams { - params.CustomerName = &CustomerName - return params -} -func (params *CreateAddressParams) SetStreet(Street string) *CreateAddressParams { - params.Street = &Street - return params -} -func (params *CreateAddressParams) SetCity(City string) *CreateAddressParams { - params.City = &City - return params -} -func (params *CreateAddressParams) SetRegion(Region string) *CreateAddressParams { - params.Region = &Region - return params -} -func (params *CreateAddressParams) SetPostalCode(PostalCode string) *CreateAddressParams { - params.PostalCode = &PostalCode - return params -} -func (params *CreateAddressParams) SetIsoCountry(IsoCountry string) *CreateAddressParams { - params.IsoCountry = &IsoCountry - return params -} -func (params *CreateAddressParams) SetFriendlyName(FriendlyName string) *CreateAddressParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateAddressParams) SetEmergencyEnabled(EmergencyEnabled bool) *CreateAddressParams { - params.EmergencyEnabled = &EmergencyEnabled - return params -} -func (params *CreateAddressParams) SetAutoCorrectAddress(AutoCorrectAddress bool) *CreateAddressParams { - params.AutoCorrectAddress = &AutoCorrectAddress - return params -} -func (params *CreateAddressParams) SetStreetSecondary(StreetSecondary string) *CreateAddressParams { - params.StreetSecondary = &StreetSecondary - return params -} - -// + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will be responsible for the new Address resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The name to associate with the new address. + CustomerName *string `json:"CustomerName,omitempty"` + // The number and street address of the new address. + Street *string `json:"Street,omitempty"` + // The city of the new address. + City *string `json:"City,omitempty"` + // The state or region of the new address. + Region *string `json:"Region,omitempty"` + // The postal code of the new address. + PostalCode *string `json:"PostalCode,omitempty"` + // The ISO country code of the new address. + IsoCountry *string `json:"IsoCountry,omitempty"` + // A descriptive string that you create to describe the new address. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether to enable emergency calling on the new address. Can be: `true` or `false`. + EmergencyEnabled *bool `json:"EmergencyEnabled,omitempty"` + // Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide. + AutoCorrectAddress *bool `json:"AutoCorrectAddress,omitempty"` + // The additional number and street address of the address. + StreetSecondary *string `json:"StreetSecondary,omitempty"` +} + +func (params *CreateAddressParams) SetPathAccountSid(PathAccountSid string) (*CreateAddressParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateAddressParams) SetCustomerName(CustomerName string) (*CreateAddressParams){ + params.CustomerName = &CustomerName + return params +} +func (params *CreateAddressParams) SetStreet(Street string) (*CreateAddressParams){ + params.Street = &Street + return params +} +func (params *CreateAddressParams) SetCity(City string) (*CreateAddressParams){ + params.City = &City + return params +} +func (params *CreateAddressParams) SetRegion(Region string) (*CreateAddressParams){ + params.Region = &Region + return params +} +func (params *CreateAddressParams) SetPostalCode(PostalCode string) (*CreateAddressParams){ + params.PostalCode = &PostalCode + return params +} +func (params *CreateAddressParams) SetIsoCountry(IsoCountry string) (*CreateAddressParams){ + params.IsoCountry = &IsoCountry + return params +} +func (params *CreateAddressParams) SetFriendlyName(FriendlyName string) (*CreateAddressParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateAddressParams) SetEmergencyEnabled(EmergencyEnabled bool) (*CreateAddressParams){ + params.EmergencyEnabled = &EmergencyEnabled + return params +} +func (params *CreateAddressParams) SetAutoCorrectAddress(AutoCorrectAddress bool) (*CreateAddressParams){ + params.AutoCorrectAddress = &AutoCorrectAddress + return params +} +func (params *CreateAddressParams) SetStreetSecondary(StreetSecondary string) (*CreateAddressParams){ + params.StreetSecondary = &StreetSecondary + return params +} + +// func (c *ApiService) CreateAddress(params *CreateAddressParams) (*ApiV2010Address, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Addresses.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CustomerName != nil { - data.Set("CustomerName", *params.CustomerName) - } - if params != nil && params.Street != nil { - data.Set("Street", *params.Street) - } - if params != nil && params.City != nil { - data.Set("City", *params.City) - } - if params != nil && params.Region != nil { - data.Set("Region", *params.Region) - } - if params != nil && params.PostalCode != nil { - data.Set("PostalCode", *params.PostalCode) - } - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.EmergencyEnabled != nil { - data.Set("EmergencyEnabled", fmt.Sprint(*params.EmergencyEnabled)) - } - if params != nil && params.AutoCorrectAddress != nil { - data.Set("AutoCorrectAddress", fmt.Sprint(*params.AutoCorrectAddress)) - } - if params != nil && params.StreetSecondary != nil { - data.Set("StreetSecondary", *params.StreetSecondary) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Address{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Addresses.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CustomerName != nil { + data.Set("CustomerName", *params.CustomerName) + } + if params != nil && params.Street != nil { + data.Set("Street", *params.Street) + } + if params != nil && params.City != nil { + data.Set("City", *params.City) + } + if params != nil && params.Region != nil { + data.Set("Region", *params.Region) + } + if params != nil && params.PostalCode != nil { + data.Set("PostalCode", *params.PostalCode) + } + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.EmergencyEnabled != nil { + data.Set("EmergencyEnabled", fmt.Sprint(*params.EmergencyEnabled)) + } + if params != nil && params.AutoCorrectAddress != nil { + data.Set("AutoCorrectAddress", fmt.Sprint(*params.AutoCorrectAddress)) + } + if params != nil && params.StreetSecondary != nil { + data.Set("StreetSecondary", *params.StreetSecondary) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Address{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteAddress' type DeleteAddressParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteAddressParams) SetPathAccountSid(PathAccountSid string) *DeleteAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteAddressParams) SetPathAccountSid(PathAccountSid string) (*DeleteAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } -// -func (c *ApiService) DeleteAddress(Sid string, params *DeleteAddressParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteAddress(Sid string, params *DeleteAddressParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchAddress' type FetchAddressParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchAddressParams) SetPathAccountSid(PathAccountSid string) *FetchAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchAddressParams) SetPathAccountSid(PathAccountSid string) (*FetchAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } -// +// func (c *ApiService) FetchAddress(Sid string, params *FetchAddressParams) (*ApiV2010Address, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Address{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Address{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListAddress' type ListAddressParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The `customer_name` of the Address resources to read. - CustomerName *string `json:"CustomerName,omitempty"` - // The string that identifies the Address resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The ISO country code of the Address resources to read. - IsoCountry *string `json:"IsoCountry,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The `customer_name` of the Address resources to read. + CustomerName *string `json:"CustomerName,omitempty"` + // The string that identifies the Address resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The ISO country code of the Address resources to read. + IsoCountry *string `json:"IsoCountry,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAddressParams) SetPathAccountSid(PathAccountSid string) *ListAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAddressParams) SetPathAccountSid(PathAccountSid string) (*ListAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAddressParams) SetCustomerName(CustomerName string) *ListAddressParams { - params.CustomerName = &CustomerName - return params +func (params *ListAddressParams) SetCustomerName(CustomerName string) (*ListAddressParams){ + params.CustomerName = &CustomerName + return params } -func (params *ListAddressParams) SetFriendlyName(FriendlyName string) *ListAddressParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListAddressParams) SetFriendlyName(FriendlyName string) (*ListAddressParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListAddressParams) SetIsoCountry(IsoCountry string) *ListAddressParams { - params.IsoCountry = &IsoCountry - return params +func (params *ListAddressParams) SetIsoCountry(IsoCountry string) (*ListAddressParams){ + params.IsoCountry = &IsoCountry + return params } -func (params *ListAddressParams) SetPageSize(PageSize int) *ListAddressParams { - params.PageSize = &PageSize - return params +func (params *ListAddressParams) SetPageSize(PageSize int) (*ListAddressParams){ + params.PageSize = &PageSize + return params } -func (params *ListAddressParams) SetLimit(Limit int) *ListAddressParams { - params.Limit = &Limit - return params +func (params *ListAddressParams) SetLimit(Limit int) (*ListAddressParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Address records from the API. Request is executed immediately. -func (c *ApiService) PageAddress(params *ListAddressParams, pageToken, pageNumber string) (*ListAddressResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Addresses.json" +func (c *ApiService) PageAddress(params *ListAddressParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Addresses.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.CustomerName != nil { - data.Set("CustomerName", *params.CustomerName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.CustomerName != nil { + data.Set("CustomerName", *params.CustomerName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Address records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAddress(params *ListAddressParams) ([]ApiV2010Address, error) { +func (c *ApiService) ListAddress(params *ListAddressParams) (ListAddress200Response, error) { response, errors := c.StreamAddress(params) - records := make([]ApiV2010Address, 0) + records := make(ListAddress200Response, 0) for record := range response { records = append(records, record) } @@ -331,13 +336,13 @@ func (c *ApiService) ListAddress(params *ListAddressParams) ([]ApiV2010Address, } // Streams Address records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAddress(params *ListAddressParams) (chan ApiV2010Address, chan error) { +func (c *ApiService) StreamAddress(params *ListAddressParams) (chan ListAddress200Response, chan error) { if params == nil { params = &ListAddressParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Address, 1) + recordChannel := make(chan ListAddress200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAddress(params, "", "") @@ -352,11 +357,12 @@ func (c *ApiService) StreamAddress(params *ListAddressParams) (chan ApiV2010Addr return recordChannel, errorChannel } -func (c *ApiService) streamAddress(response *ListAddressResponse, params *ListAddressParams, recordChannel chan ApiV2010Address, errorChannel chan error) { + +func (c *ApiService) streamAddress(response *, params *ListAddressParams, recordChannel chan ListAddress200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Addresses + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -367,7 +373,7 @@ func (c *ApiService) streamAddress(response *ListAddressResponse, params *ListAd } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAddressResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -375,148 +381,150 @@ func (c *ApiService) streamAddress(response *ListAddressResponse, params *ListAd break } - response = record.(*ListAddressResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAddressResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateAddress' type UpdateAddressParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you create to describe the address. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The name to associate with the address. - CustomerName *string `json:"CustomerName,omitempty"` - // The number and street address of the address. - Street *string `json:"Street,omitempty"` - // The city of the address. - City *string `json:"City,omitempty"` - // The state or region of the address. - Region *string `json:"Region,omitempty"` - // The postal code of the address. - PostalCode *string `json:"PostalCode,omitempty"` - // Whether to enable emergency calling on the address. Can be: `true` or `false`. - EmergencyEnabled *bool `json:"EmergencyEnabled,omitempty"` - // Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide. - AutoCorrectAddress *bool `json:"AutoCorrectAddress,omitempty"` - // The additional number and street address of the address. - StreetSecondary *string `json:"StreetSecondary,omitempty"` -} - -func (params *UpdateAddressParams) SetPathAccountSid(PathAccountSid string) *UpdateAddressParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *UpdateAddressParams) SetFriendlyName(FriendlyName string) *UpdateAddressParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateAddressParams) SetCustomerName(CustomerName string) *UpdateAddressParams { - params.CustomerName = &CustomerName - return params -} -func (params *UpdateAddressParams) SetStreet(Street string) *UpdateAddressParams { - params.Street = &Street - return params -} -func (params *UpdateAddressParams) SetCity(City string) *UpdateAddressParams { - params.City = &City - return params -} -func (params *UpdateAddressParams) SetRegion(Region string) *UpdateAddressParams { - params.Region = &Region - return params -} -func (params *UpdateAddressParams) SetPostalCode(PostalCode string) *UpdateAddressParams { - params.PostalCode = &PostalCode - return params -} -func (params *UpdateAddressParams) SetEmergencyEnabled(EmergencyEnabled bool) *UpdateAddressParams { - params.EmergencyEnabled = &EmergencyEnabled - return params -} -func (params *UpdateAddressParams) SetAutoCorrectAddress(AutoCorrectAddress bool) *UpdateAddressParams { - params.AutoCorrectAddress = &AutoCorrectAddress - return params -} -func (params *UpdateAddressParams) SetStreetSecondary(StreetSecondary string) *UpdateAddressParams { - params.StreetSecondary = &StreetSecondary - return params -} - -// + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you create to describe the address. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The name to associate with the address. + CustomerName *string `json:"CustomerName,omitempty"` + // The number and street address of the address. + Street *string `json:"Street,omitempty"` + // The city of the address. + City *string `json:"City,omitempty"` + // The state or region of the address. + Region *string `json:"Region,omitempty"` + // The postal code of the address. + PostalCode *string `json:"PostalCode,omitempty"` + // Whether to enable emergency calling on the address. Can be: `true` or `false`. + EmergencyEnabled *bool `json:"EmergencyEnabled,omitempty"` + // Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide. + AutoCorrectAddress *bool `json:"AutoCorrectAddress,omitempty"` + // The additional number and street address of the address. + StreetSecondary *string `json:"StreetSecondary,omitempty"` +} + +func (params *UpdateAddressParams) SetPathAccountSid(PathAccountSid string) (*UpdateAddressParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *UpdateAddressParams) SetFriendlyName(FriendlyName string) (*UpdateAddressParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateAddressParams) SetCustomerName(CustomerName string) (*UpdateAddressParams){ + params.CustomerName = &CustomerName + return params +} +func (params *UpdateAddressParams) SetStreet(Street string) (*UpdateAddressParams){ + params.Street = &Street + return params +} +func (params *UpdateAddressParams) SetCity(City string) (*UpdateAddressParams){ + params.City = &City + return params +} +func (params *UpdateAddressParams) SetRegion(Region string) (*UpdateAddressParams){ + params.Region = &Region + return params +} +func (params *UpdateAddressParams) SetPostalCode(PostalCode string) (*UpdateAddressParams){ + params.PostalCode = &PostalCode + return params +} +func (params *UpdateAddressParams) SetEmergencyEnabled(EmergencyEnabled bool) (*UpdateAddressParams){ + params.EmergencyEnabled = &EmergencyEnabled + return params +} +func (params *UpdateAddressParams) SetAutoCorrectAddress(AutoCorrectAddress bool) (*UpdateAddressParams){ + params.AutoCorrectAddress = &AutoCorrectAddress + return params +} +func (params *UpdateAddressParams) SetStreetSecondary(StreetSecondary string) (*UpdateAddressParams){ + params.StreetSecondary = &StreetSecondary + return params +} + +// func (c *ApiService) UpdateAddress(Sid string, params *UpdateAddressParams) (*ApiV2010Address, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CustomerName != nil { - data.Set("CustomerName", *params.CustomerName) - } - if params != nil && params.Street != nil { - data.Set("Street", *params.Street) - } - if params != nil && params.City != nil { - data.Set("City", *params.City) - } - if params != nil && params.Region != nil { - data.Set("Region", *params.Region) - } - if params != nil && params.PostalCode != nil { - data.Set("PostalCode", *params.PostalCode) - } - if params != nil && params.EmergencyEnabled != nil { - data.Set("EmergencyEnabled", fmt.Sprint(*params.EmergencyEnabled)) - } - if params != nil && params.AutoCorrectAddress != nil { - data.Set("AutoCorrectAddress", fmt.Sprint(*params.AutoCorrectAddress)) - } - if params != nil && params.StreetSecondary != nil { - data.Set("StreetSecondary", *params.StreetSecondary) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Address{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CustomerName != nil { + data.Set("CustomerName", *params.CustomerName) + } + if params != nil && params.Street != nil { + data.Set("Street", *params.Street) + } + if params != nil && params.City != nil { + data.Set("City", *params.City) + } + if params != nil && params.Region != nil { + data.Set("Region", *params.Region) + } + if params != nil && params.PostalCode != nil { + data.Set("PostalCode", *params.PostalCode) + } + if params != nil && params.EmergencyEnabled != nil { + data.Set("EmergencyEnabled", fmt.Sprint(*params.EmergencyEnabled)) + } + if params != nil && params.AutoCorrectAddress != nil { + data.Set("AutoCorrectAddress", fmt.Sprint(*params.AutoCorrectAddress)) + } + if params != nil && params.StreetSecondary != nil { + data.Set("StreetSecondary", *params.StreetSecondary) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Address{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_addresses_dependent_phone_numbers.go b/rest/api/v2010/accounts_addresses_dependent_phone_numbers.go index f1cf03f13..8af75bbd6 100644 --- a/rest/api/v2010/accounts_addresses_dependent_phone_numbers.go +++ b/rest/api/v2010/accounts_addresses_dependent_phone_numbers.go @@ -18,79 +18,79 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListDependentPhoneNumber' type ListDependentPhoneNumberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDependentPhoneNumberParams) SetPathAccountSid(PathAccountSid string) *ListDependentPhoneNumberParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListDependentPhoneNumberParams) SetPathAccountSid(PathAccountSid string) (*ListDependentPhoneNumberParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListDependentPhoneNumberParams) SetPageSize(PageSize int) *ListDependentPhoneNumberParams { - params.PageSize = &PageSize - return params +func (params *ListDependentPhoneNumberParams) SetPageSize(PageSize int) (*ListDependentPhoneNumberParams){ + params.PageSize = &PageSize + return params } -func (params *ListDependentPhoneNumberParams) SetLimit(Limit int) *ListDependentPhoneNumberParams { - params.Limit = &Limit - return params +func (params *ListDependentPhoneNumberParams) SetLimit(Limit int) (*ListDependentPhoneNumberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DependentPhoneNumber records from the API. Request is executed immediately. -func (c *ApiService) PageDependentPhoneNumber(AddressSid string, params *ListDependentPhoneNumberParams, pageToken, pageNumber string) (*ListDependentPhoneNumberResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{AddressSid}/DependentPhoneNumbers.json" +func (c *ApiService) PageDependentPhoneNumber(AddressSid string, params *ListDependentPhoneNumberParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Addresses/{AddressSid}/DependentPhoneNumbers.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"AddressSid"+"}", AddressSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"AddressSid"+"}", AddressSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDependentPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists DependentPhoneNumber records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListDependentPhoneNumber(AddressSid string, params *ListDependentPhoneNumberParams) ([]ApiV2010DependentPhoneNumber, error) { +func (c *ApiService) ListDependentPhoneNumber(AddressSid string, params *ListDependentPhoneNumberParams) (ListDependentPhoneNumber200Response, error) { response, errors := c.StreamDependentPhoneNumber(AddressSid, params) - records := make([]ApiV2010DependentPhoneNumber, 0) + records := make(ListDependentPhoneNumber200Response, 0) for record := range response { records = append(records, record) } @@ -103,13 +103,13 @@ func (c *ApiService) ListDependentPhoneNumber(AddressSid string, params *ListDep } // Streams DependentPhoneNumber records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamDependentPhoneNumber(AddressSid string, params *ListDependentPhoneNumberParams) (chan ApiV2010DependentPhoneNumber, chan error) { +func (c *ApiService) StreamDependentPhoneNumber(AddressSid string, params *ListDependentPhoneNumberParams) (chan ListDependentPhoneNumber200Response, chan error) { if params == nil { params = &ListDependentPhoneNumberParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010DependentPhoneNumber, 1) + recordChannel := make(chan ListDependentPhoneNumber200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageDependentPhoneNumber(AddressSid, params, "", "") @@ -124,11 +124,12 @@ func (c *ApiService) StreamDependentPhoneNumber(AddressSid string, params *ListD return recordChannel, errorChannel } -func (c *ApiService) streamDependentPhoneNumber(response *ListDependentPhoneNumberResponse, params *ListDependentPhoneNumberParams, recordChannel chan ApiV2010DependentPhoneNumber, errorChannel chan error) { + +func (c *ApiService) streamDependentPhoneNumber(response *, params *ListDependentPhoneNumberParams, recordChannel chan ListDependentPhoneNumber200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.DependentPhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -139,7 +140,7 @@ func (c *ApiService) streamDependentPhoneNumber(response *ListDependentPhoneNumb } } - record, err := client.GetNext(c.baseURL, response, c.getNextListDependentPhoneNumberResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -147,27 +148,28 @@ func (c *ApiService) streamDependentPhoneNumber(response *ListDependentPhoneNumb break } - response = record.(*ListDependentPhoneNumberResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListDependentPhoneNumberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDependentPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_applications.go b/rest/api/v2010/accounts_applications.go index 1a2d7f678..a9d564443 100644 --- a/rest/api/v2010/accounts_applications.go +++ b/rest/api/v2010/accounts_applications.go @@ -18,343 +18,348 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateApplication' type CreateApplicationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is the account's default API version. - ApiVersion *string `json:"ApiVersion,omitempty"` - // The URL we should call when the phone number assigned to this application receives a call. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Whether we should look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The URL we should call when the phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL we should call using a POST method to send status information about SMS messages sent by the application. - SmsStatusCallback *string `json:"SmsStatusCallback,omitempty"` - // The URL we should call using a POST method to send message status information to your application. - MessageStatusCallback *string `json:"MessageStatusCallback,omitempty"` - // A descriptive string that you create to describe the new application. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. - PublicApplicationConnectEnabled *bool `json:"PublicApplicationConnectEnabled,omitempty"` -} - -func (params *CreateApplicationParams) SetPathAccountSid(PathAccountSid string) *CreateApplicationParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateApplicationParams) SetApiVersion(ApiVersion string) *CreateApplicationParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *CreateApplicationParams) SetVoiceUrl(VoiceUrl string) *CreateApplicationParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateApplicationParams) SetVoiceMethod(VoiceMethod string) *CreateApplicationParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateApplicationParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateApplicationParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateApplicationParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateApplicationParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateApplicationParams) SetStatusCallback(StatusCallback string) *CreateApplicationParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateApplicationParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateApplicationParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateApplicationParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *CreateApplicationParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *CreateApplicationParams) SetSmsUrl(SmsUrl string) *CreateApplicationParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *CreateApplicationParams) SetSmsMethod(SmsMethod string) *CreateApplicationParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *CreateApplicationParams) SetSmsFallbackUrl(SmsFallbackUrl string) *CreateApplicationParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *CreateApplicationParams) SetSmsFallbackMethod(SmsFallbackMethod string) *CreateApplicationParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *CreateApplicationParams) SetSmsStatusCallback(SmsStatusCallback string) *CreateApplicationParams { - params.SmsStatusCallback = &SmsStatusCallback - return params -} -func (params *CreateApplicationParams) SetMessageStatusCallback(MessageStatusCallback string) *CreateApplicationParams { - params.MessageStatusCallback = &MessageStatusCallback - return params -} -func (params *CreateApplicationParams) SetFriendlyName(FriendlyName string) *CreateApplicationParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateApplicationParams) SetPublicApplicationConnectEnabled(PublicApplicationConnectEnabled bool) *CreateApplicationParams { - params.PublicApplicationConnectEnabled = &PublicApplicationConnectEnabled - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is the account's default API version. + ApiVersion *string `json:"ApiVersion,omitempty"` + // The URL we should call when the phone number assigned to this application receives a call. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Whether we should look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The URL we should call when the phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL we should call using a POST method to send status information about SMS messages sent by the application. + SmsStatusCallback *string `json:"SmsStatusCallback,omitempty"` + // The URL we should call using a POST method to send message status information to your application. + MessageStatusCallback *string `json:"MessageStatusCallback,omitempty"` + // A descriptive string that you create to describe the new application. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. + PublicApplicationConnectEnabled *bool `json:"PublicApplicationConnectEnabled,omitempty"` +} + +func (params *CreateApplicationParams) SetPathAccountSid(PathAccountSid string) (*CreateApplicationParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateApplicationParams) SetApiVersion(ApiVersion string) (*CreateApplicationParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *CreateApplicationParams) SetVoiceUrl(VoiceUrl string) (*CreateApplicationParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateApplicationParams) SetVoiceMethod(VoiceMethod string) (*CreateApplicationParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateApplicationParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateApplicationParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateApplicationParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateApplicationParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateApplicationParams) SetStatusCallback(StatusCallback string) (*CreateApplicationParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateApplicationParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateApplicationParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateApplicationParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*CreateApplicationParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *CreateApplicationParams) SetSmsUrl(SmsUrl string) (*CreateApplicationParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *CreateApplicationParams) SetSmsMethod(SmsMethod string) (*CreateApplicationParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *CreateApplicationParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*CreateApplicationParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *CreateApplicationParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*CreateApplicationParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *CreateApplicationParams) SetSmsStatusCallback(SmsStatusCallback string) (*CreateApplicationParams){ + params.SmsStatusCallback = &SmsStatusCallback + return params +} +func (params *CreateApplicationParams) SetMessageStatusCallback(MessageStatusCallback string) (*CreateApplicationParams){ + params.MessageStatusCallback = &MessageStatusCallback + return params +} +func (params *CreateApplicationParams) SetFriendlyName(FriendlyName string) (*CreateApplicationParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateApplicationParams) SetPublicApplicationConnectEnabled(PublicApplicationConnectEnabled bool) (*CreateApplicationParams){ + params.PublicApplicationConnectEnabled = &PublicApplicationConnectEnabled + return params } // Create a new application within your account func (c *ApiService) CreateApplication(params *CreateApplicationParams) (*ApiV2010Application, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Applications.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsStatusCallback != nil { - data.Set("SmsStatusCallback", *params.SmsStatusCallback) - } - if params != nil && params.MessageStatusCallback != nil { - data.Set("MessageStatusCallback", *params.MessageStatusCallback) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PublicApplicationConnectEnabled != nil { - data.Set("PublicApplicationConnectEnabled", fmt.Sprint(*params.PublicApplicationConnectEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Application{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Applications.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsStatusCallback != nil { + data.Set("SmsStatusCallback", *params.SmsStatusCallback) + } + if params != nil && params.MessageStatusCallback != nil { + data.Set("MessageStatusCallback", *params.MessageStatusCallback) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PublicApplicationConnectEnabled != nil { + data.Set("PublicApplicationConnectEnabled", fmt.Sprint(*params.PublicApplicationConnectEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Application{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteApplication' type DeleteApplicationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteApplicationParams) SetPathAccountSid(PathAccountSid string) *DeleteApplicationParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteApplicationParams) SetPathAccountSid(PathAccountSid string) (*DeleteApplicationParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete the application by the specified application sid -func (c *ApiService) DeleteApplication(Sid string, params *DeleteApplicationParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteApplication(Sid string, params *DeleteApplicationParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchApplication' type FetchApplicationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchApplicationParams) SetPathAccountSid(PathAccountSid string) *FetchApplicationParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchApplicationParams) SetPathAccountSid(PathAccountSid string) (*FetchApplicationParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch the application specified by the provided sid func (c *ApiService) FetchApplication(Sid string, params *FetchApplicationParams) (*ApiV2010Application, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Application{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ApiV2010Application{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListApplication' type ListApplicationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The string that identifies the Application resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The string that identifies the Application resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListApplicationParams) SetPathAccountSid(PathAccountSid string) *ListApplicationParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListApplicationParams) SetPathAccountSid(PathAccountSid string) (*ListApplicationParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListApplicationParams) SetFriendlyName(FriendlyName string) *ListApplicationParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListApplicationParams) SetFriendlyName(FriendlyName string) (*ListApplicationParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListApplicationParams) SetPageSize(PageSize int) *ListApplicationParams { - params.PageSize = &PageSize - return params +func (params *ListApplicationParams) SetPageSize(PageSize int) (*ListApplicationParams){ + params.PageSize = &PageSize + return params } -func (params *ListApplicationParams) SetLimit(Limit int) *ListApplicationParams { - params.Limit = &Limit - return params +func (params *ListApplicationParams) SetLimit(Limit int) (*ListApplicationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Application records from the API. Request is executed immediately. -func (c *ApiService) PageApplication(params *ListApplicationParams, pageToken, pageNumber string) (*ListApplicationResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Applications.json" +func (c *ApiService) PageApplication(params *ListApplicationParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Applications.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListApplicationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Application records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListApplication(params *ListApplicationParams) ([]ApiV2010Application, error) { +func (c *ApiService) ListApplication(params *ListApplicationParams) (ListApplication200Response, error) { response, errors := c.StreamApplication(params) - records := make([]ApiV2010Application, 0) + records := make(ListApplication200Response, 0) for record := range response { records = append(records, record) } @@ -367,13 +372,13 @@ func (c *ApiService) ListApplication(params *ListApplicationParams) ([]ApiV2010A } // Streams Application records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamApplication(params *ListApplicationParams) (chan ApiV2010Application, chan error) { +func (c *ApiService) StreamApplication(params *ListApplicationParams) (chan ListApplication200Response, chan error) { if params == nil { params = &ListApplicationParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Application, 1) + recordChannel := make(chan ListApplication200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageApplication(params, "", "") @@ -388,11 +393,12 @@ func (c *ApiService) StreamApplication(params *ListApplicationParams) (chan ApiV return recordChannel, errorChannel } -func (c *ApiService) streamApplication(response *ListApplicationResponse, params *ListApplicationParams, recordChannel chan ApiV2010Application, errorChannel chan error) { + +func (c *ApiService) streamApplication(response *, params *ListApplicationParams, recordChannel chan ListApplication200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Applications + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -403,7 +409,7 @@ func (c *ApiService) streamApplication(response *ListApplicationResponse, params } } - record, err := client.GetNext(c.baseURL, response, c.getNextListApplicationResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -411,211 +417,213 @@ func (c *ApiService) streamApplication(response *ListApplicationResponse, params break } - response = record.(*ListApplicationResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListApplicationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListApplicationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateApplication' type UpdateApplicationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is your account's default API version. - ApiVersion *string `json:"ApiVersion,omitempty"` - // The URL we should call when the phone number assigned to this application receives a call. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Whether we should look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The URL we should call when the phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // Same as message_status_callback: The URL we should call using a POST method to send status information about SMS messages sent by the application. Deprecated, included for backwards compatibility. - SmsStatusCallback *string `json:"SmsStatusCallback,omitempty"` - // The URL we should call using a POST method to send message status information to your application. - MessageStatusCallback *string `json:"MessageStatusCallback,omitempty"` - // Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. - PublicApplicationConnectEnabled *bool `json:"PublicApplicationConnectEnabled,omitempty"` -} - -func (params *UpdateApplicationParams) SetPathAccountSid(PathAccountSid string) *UpdateApplicationParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *UpdateApplicationParams) SetFriendlyName(FriendlyName string) *UpdateApplicationParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateApplicationParams) SetApiVersion(ApiVersion string) *UpdateApplicationParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *UpdateApplicationParams) SetVoiceUrl(VoiceUrl string) *UpdateApplicationParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *UpdateApplicationParams) SetVoiceMethod(VoiceMethod string) *UpdateApplicationParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *UpdateApplicationParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *UpdateApplicationParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *UpdateApplicationParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *UpdateApplicationParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *UpdateApplicationParams) SetStatusCallback(StatusCallback string) *UpdateApplicationParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *UpdateApplicationParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateApplicationParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *UpdateApplicationParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *UpdateApplicationParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *UpdateApplicationParams) SetSmsUrl(SmsUrl string) *UpdateApplicationParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *UpdateApplicationParams) SetSmsMethod(SmsMethod string) *UpdateApplicationParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *UpdateApplicationParams) SetSmsFallbackUrl(SmsFallbackUrl string) *UpdateApplicationParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *UpdateApplicationParams) SetSmsFallbackMethod(SmsFallbackMethod string) *UpdateApplicationParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *UpdateApplicationParams) SetSmsStatusCallback(SmsStatusCallback string) *UpdateApplicationParams { - params.SmsStatusCallback = &SmsStatusCallback - return params -} -func (params *UpdateApplicationParams) SetMessageStatusCallback(MessageStatusCallback string) *UpdateApplicationParams { - params.MessageStatusCallback = &MessageStatusCallback - return params -} -func (params *UpdateApplicationParams) SetPublicApplicationConnectEnabled(PublicApplicationConnectEnabled bool) *UpdateApplicationParams { - params.PublicApplicationConnectEnabled = &PublicApplicationConnectEnabled - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is your account's default API version. + ApiVersion *string `json:"ApiVersion,omitempty"` + // The URL we should call when the phone number assigned to this application receives a call. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Whether we should look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The URL we should call when the phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // Same as message_status_callback: The URL we should call using a POST method to send status information about SMS messages sent by the application. Deprecated, included for backwards compatibility. + SmsStatusCallback *string `json:"SmsStatusCallback,omitempty"` + // The URL we should call using a POST method to send message status information to your application. + MessageStatusCallback *string `json:"MessageStatusCallback,omitempty"` + // Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. + PublicApplicationConnectEnabled *bool `json:"PublicApplicationConnectEnabled,omitempty"` +} + +func (params *UpdateApplicationParams) SetPathAccountSid(PathAccountSid string) (*UpdateApplicationParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *UpdateApplicationParams) SetFriendlyName(FriendlyName string) (*UpdateApplicationParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateApplicationParams) SetApiVersion(ApiVersion string) (*UpdateApplicationParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *UpdateApplicationParams) SetVoiceUrl(VoiceUrl string) (*UpdateApplicationParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *UpdateApplicationParams) SetVoiceMethod(VoiceMethod string) (*UpdateApplicationParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *UpdateApplicationParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*UpdateApplicationParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *UpdateApplicationParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*UpdateApplicationParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *UpdateApplicationParams) SetStatusCallback(StatusCallback string) (*UpdateApplicationParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *UpdateApplicationParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateApplicationParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *UpdateApplicationParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*UpdateApplicationParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *UpdateApplicationParams) SetSmsUrl(SmsUrl string) (*UpdateApplicationParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *UpdateApplicationParams) SetSmsMethod(SmsMethod string) (*UpdateApplicationParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *UpdateApplicationParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*UpdateApplicationParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *UpdateApplicationParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*UpdateApplicationParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *UpdateApplicationParams) SetSmsStatusCallback(SmsStatusCallback string) (*UpdateApplicationParams){ + params.SmsStatusCallback = &SmsStatusCallback + return params +} +func (params *UpdateApplicationParams) SetMessageStatusCallback(MessageStatusCallback string) (*UpdateApplicationParams){ + params.MessageStatusCallback = &MessageStatusCallback + return params +} +func (params *UpdateApplicationParams) SetPublicApplicationConnectEnabled(PublicApplicationConnectEnabled bool) (*UpdateApplicationParams){ + params.PublicApplicationConnectEnabled = &PublicApplicationConnectEnabled + return params } // Updates the application's properties func (c *ApiService) UpdateApplication(Sid string, params *UpdateApplicationParams) (*ApiV2010Application, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsStatusCallback != nil { - data.Set("SmsStatusCallback", *params.SmsStatusCallback) - } - if params != nil && params.MessageStatusCallback != nil { - data.Set("MessageStatusCallback", *params.MessageStatusCallback) - } - if params != nil && params.PublicApplicationConnectEnabled != nil { - data.Set("PublicApplicationConnectEnabled", fmt.Sprint(*params.PublicApplicationConnectEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Application{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Applications/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsStatusCallback != nil { + data.Set("SmsStatusCallback", *params.SmsStatusCallback) + } + if params != nil && params.MessageStatusCallback != nil { + data.Set("MessageStatusCallback", *params.MessageStatusCallback) + } + if params != nil && params.PublicApplicationConnectEnabled != nil { + data.Set("PublicApplicationConnectEnabled", fmt.Sprint(*params.PublicApplicationConnectEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Application{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_authorized_connect_apps.go b/rest/api/v2010/accounts_authorized_connect_apps.go index c6c0b4e0b..8f79675b9 100644 --- a/rest/api/v2010/accounts_authorized_connect_apps.go +++ b/rest/api/v2010/accounts_authorized_connect_apps.go @@ -18,117 +18,119 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchAuthorizedConnectApp' type FetchAuthorizedConnectAppParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchAuthorizedConnectAppParams) SetPathAccountSid(PathAccountSid string) *FetchAuthorizedConnectAppParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchAuthorizedConnectAppParams) SetPathAccountSid(PathAccountSid string) (*FetchAuthorizedConnectAppParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of an authorized-connect-app func (c *ApiService) FetchAuthorizedConnectApp(ConnectAppSid string, params *FetchAuthorizedConnectAppParams) (*ApiV2010AuthorizedConnectApp, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AuthorizedConnectApps/{ConnectAppSid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConnectAppSid"+"}", ConnectAppSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/AuthorizedConnectApps/{ConnectAppSid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConnectAppSid"+"}", ConnectAppSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010AuthorizedConnectApp{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010AuthorizedConnectApp{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAuthorizedConnectApp' type ListAuthorizedConnectAppParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAuthorizedConnectAppParams) SetPathAccountSid(PathAccountSid string) *ListAuthorizedConnectAppParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAuthorizedConnectAppParams) SetPathAccountSid(PathAccountSid string) (*ListAuthorizedConnectAppParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAuthorizedConnectAppParams) SetPageSize(PageSize int) *ListAuthorizedConnectAppParams { - params.PageSize = &PageSize - return params +func (params *ListAuthorizedConnectAppParams) SetPageSize(PageSize int) (*ListAuthorizedConnectAppParams){ + params.PageSize = &PageSize + return params } -func (params *ListAuthorizedConnectAppParams) SetLimit(Limit int) *ListAuthorizedConnectAppParams { - params.Limit = &Limit - return params +func (params *ListAuthorizedConnectAppParams) SetLimit(Limit int) (*ListAuthorizedConnectAppParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AuthorizedConnectApp records from the API. Request is executed immediately. -func (c *ApiService) PageAuthorizedConnectApp(params *ListAuthorizedConnectAppParams, pageToken, pageNumber string) (*ListAuthorizedConnectAppResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AuthorizedConnectApps.json" +func (c *ApiService) PageAuthorizedConnectApp(params *ListAuthorizedConnectAppParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AuthorizedConnectApps.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAuthorizedConnectAppResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AuthorizedConnectApp records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAuthorizedConnectApp(params *ListAuthorizedConnectAppParams) ([]ApiV2010AuthorizedConnectApp, error) { +func (c *ApiService) ListAuthorizedConnectApp(params *ListAuthorizedConnectAppParams) (ListAuthorizedConnectApp200Response, error) { response, errors := c.StreamAuthorizedConnectApp(params) - records := make([]ApiV2010AuthorizedConnectApp, 0) + records := make(ListAuthorizedConnectApp200Response, 0) for record := range response { records = append(records, record) } @@ -141,13 +143,13 @@ func (c *ApiService) ListAuthorizedConnectApp(params *ListAuthorizedConnectAppPa } // Streams AuthorizedConnectApp records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAuthorizedConnectApp(params *ListAuthorizedConnectAppParams) (chan ApiV2010AuthorizedConnectApp, chan error) { +func (c *ApiService) StreamAuthorizedConnectApp(params *ListAuthorizedConnectAppParams) (chan ListAuthorizedConnectApp200Response, chan error) { if params == nil { params = &ListAuthorizedConnectAppParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AuthorizedConnectApp, 1) + recordChannel := make(chan ListAuthorizedConnectApp200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAuthorizedConnectApp(params, "", "") @@ -162,11 +164,12 @@ func (c *ApiService) StreamAuthorizedConnectApp(params *ListAuthorizedConnectApp return recordChannel, errorChannel } -func (c *ApiService) streamAuthorizedConnectApp(response *ListAuthorizedConnectAppResponse, params *ListAuthorizedConnectAppParams, recordChannel chan ApiV2010AuthorizedConnectApp, errorChannel chan error) { + +func (c *ApiService) streamAuthorizedConnectApp(response *, params *ListAuthorizedConnectAppParams, recordChannel chan ListAuthorizedConnectApp200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AuthorizedConnectApps + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -177,7 +180,7 @@ func (c *ApiService) streamAuthorizedConnectApp(response *ListAuthorizedConnectA } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAuthorizedConnectAppResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -185,27 +188,28 @@ func (c *ApiService) streamAuthorizedConnectApp(response *ListAuthorizedConnectA break } - response = record.(*ListAuthorizedConnectAppResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAuthorizedConnectAppResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAuthorizedConnectAppResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers.go b/rest/api/v2010/accounts_available_phone_numbers.go index 5cc813f87..77bad97c9 100644 --- a/rest/api/v2010/accounts_available_phone_numbers.go +++ b/rest/api/v2010/accounts_available_phone_numbers.go @@ -18,117 +18,119 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchAvailablePhoneNumberCountry' type FetchAvailablePhoneNumberCountryParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the available phone number Country resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the available phone number Country resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchAvailablePhoneNumberCountryParams) SetPathAccountSid(PathAccountSid string) *FetchAvailablePhoneNumberCountryParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchAvailablePhoneNumberCountryParams) SetPathAccountSid(PathAccountSid string) (*FetchAvailablePhoneNumberCountryParams){ + params.PathAccountSid = &PathAccountSid + return params } -// +// func (c *ApiService) FetchAvailablePhoneNumberCountry(CountryCode string, params *FetchAvailablePhoneNumberCountryParams) (*ApiV2010AvailablePhoneNumberCountry, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010AvailablePhoneNumberCountry{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010AvailablePhoneNumberCountry{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAvailablePhoneNumberCountry' type ListAvailablePhoneNumberCountryParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the available phone number Country resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the available phone number Country resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberCountryParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberCountryParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberCountryParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberCountryParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberCountryParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberCountryParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberCountryParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberCountryParams) SetLimit(Limit int) *ListAvailablePhoneNumberCountryParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberCountryParams) SetLimit(Limit int) (*ListAvailablePhoneNumberCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberCountry records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberCountry(params *ListAvailablePhoneNumberCountryParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberCountryResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers.json" +func (c *ApiService) PageAvailablePhoneNumberCountry(params *ListAvailablePhoneNumberCountryParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberCountry(params *ListAvailablePhoneNumberCountryParams) ([]ApiV2010AvailablePhoneNumberCountry, error) { +func (c *ApiService) ListAvailablePhoneNumberCountry(params *ListAvailablePhoneNumberCountryParams) (ListAvailablePhoneNumberCountry200Response, error) { response, errors := c.StreamAvailablePhoneNumberCountry(params) - records := make([]ApiV2010AvailablePhoneNumberCountry, 0) + records := make(ListAvailablePhoneNumberCountry200Response, 0) for record := range response { records = append(records, record) } @@ -141,13 +143,13 @@ func (c *ApiService) ListAvailablePhoneNumberCountry(params *ListAvailablePhoneN } // Streams AvailablePhoneNumberCountry records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberCountry(params *ListAvailablePhoneNumberCountryParams) (chan ApiV2010AvailablePhoneNumberCountry, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberCountry(params *ListAvailablePhoneNumberCountryParams) (chan ListAvailablePhoneNumberCountry200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberCountryParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberCountry, 1) + recordChannel := make(chan ListAvailablePhoneNumberCountry200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberCountry(params, "", "") @@ -162,11 +164,12 @@ func (c *ApiService) StreamAvailablePhoneNumberCountry(params *ListAvailablePhon return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberCountry(response *ListAvailablePhoneNumberCountryResponse, params *ListAvailablePhoneNumberCountryParams, recordChannel chan ApiV2010AvailablePhoneNumberCountry, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberCountry(response *, params *ListAvailablePhoneNumberCountryParams, recordChannel chan ListAvailablePhoneNumberCountry200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Countries + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -177,7 +180,7 @@ func (c *ApiService) streamAvailablePhoneNumberCountry(response *ListAvailablePh } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberCountryResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -185,27 +188,28 @@ func (c *ApiService) streamAvailablePhoneNumberCountry(response *ListAvailablePh break } - response = record.(*ListAvailablePhoneNumberCountryResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAvailablePhoneNumberCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_local.go b/rest/api/v2010/accounts_available_phone_numbers_local.go index 9d7ffaecf..861dbfdde 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_local.go +++ b/rest/api/v2010/accounts_available_phone_numbers_local.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberLocal' type ListAvailablePhoneNumberLocalParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberLocalParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberLocalParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberLocalParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberLocalParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberLocalParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberLocalParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberLocalParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetContains(Contains string) *ListAvailablePhoneNumberLocalParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberLocalParams) SetContains(Contains string) (*ListAvailablePhoneNumberLocalParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberLocalParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberLocalParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberLocalParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberLocalParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberLocalParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberLocalParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberLocalParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberLocalParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberLocalParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberLocalParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberLocalParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberLocalParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberLocalParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberLocalParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberLocalParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberLocalParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberLocalParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberLocalParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetBeta(Beta bool) *ListAvailablePhoneNumberLocalParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberLocalParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberLocalParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberLocalParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberLocalParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberLocalParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberLocalParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberLocalParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberLocalParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetDistance(Distance int) *ListAvailablePhoneNumberLocalParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberLocalParams) SetDistance(Distance int) (*ListAvailablePhoneNumberLocalParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberLocalParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberLocalParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberLocalParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberLocalParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberLocalParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberLocalParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberLocalParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberLocalParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberLocalParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetInLata(InLata string) *ListAvailablePhoneNumberLocalParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberLocalParams) SetInLata(InLata string) (*ListAvailablePhoneNumberLocalParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberLocalParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberLocalParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberLocalParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberLocalParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberLocalParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberLocalParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberLocalParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberLocalParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberLocalParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberLocalParams) SetLimit(Limit int) *ListAvailablePhoneNumberLocalParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberLocalParams) SetLimit(Limit int) (*ListAvailablePhoneNumberLocalParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberLocal records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberLocal(CountryCode string, params *ListAvailablePhoneNumberLocalParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberLocalResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Local.json" +func (c *ApiService) PageAvailablePhoneNumberLocal(CountryCode string, params *ListAvailablePhoneNumberLocalParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Local.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberLocalResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberLocal records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberLocal(CountryCode string, params *ListAvailablePhoneNumberLocalParams) ([]ApiV2010AvailablePhoneNumberLocal, error) { +func (c *ApiService) ListAvailablePhoneNumberLocal(CountryCode string, params *ListAvailablePhoneNumberLocalParams) (ListAvailablePhoneNumberLocal200Response, error) { response, errors := c.StreamAvailablePhoneNumberLocal(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberLocal, 0) + records := make(ListAvailablePhoneNumberLocal200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberLocal(CountryCode string, params *L } // Streams AvailablePhoneNumberLocal records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberLocal(CountryCode string, params *ListAvailablePhoneNumberLocalParams) (chan ApiV2010AvailablePhoneNumberLocal, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberLocal(CountryCode string, params *ListAvailablePhoneNumberLocalParams) (chan ListAvailablePhoneNumberLocal200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberLocalParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberLocal, 1) + recordChannel := make(chan ListAvailablePhoneNumberLocal200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberLocal(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberLocal(CountryCode string, params return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberLocal(response *ListAvailablePhoneNumberLocalResponse, params *ListAvailablePhoneNumberLocalParams, recordChannel chan ApiV2010AvailablePhoneNumberLocal, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberLocal(response *, params *ListAvailablePhoneNumberLocalParams, recordChannel chan ListAvailablePhoneNumberLocal200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberLocal(response *ListAvailablePhon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberLocalResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberLocal(response *ListAvailablePhon break } - response = record.(*ListAvailablePhoneNumberLocalResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberLocalResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberLocalResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_machine_to_machine.go b/rest/api/v2010/accounts_available_phone_numbers_machine_to_machine.go index 30f22af46..e54413836 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_machine_to_machine.go +++ b/rest/api/v2010/accounts_available_phone_numbers_machine_to_machine.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberMachineToMachine' type ListAvailablePhoneNumberMachineToMachineParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberMachineToMachineParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberMachineToMachineParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetContains(Contains string) *ListAvailablePhoneNumberMachineToMachineParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetContains(Contains string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetBeta(Beta bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberMachineToMachineParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberMachineToMachineParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetDistance(Distance int) *ListAvailablePhoneNumberMachineToMachineParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetDistance(Distance int) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberMachineToMachineParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberMachineToMachineParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberMachineToMachineParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInLata(InLata string) *ListAvailablePhoneNumberMachineToMachineParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInLata(InLata string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberMachineToMachineParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberMachineToMachineParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberMachineToMachineParams) SetLimit(Limit int) *ListAvailablePhoneNumberMachineToMachineParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberMachineToMachineParams) SetLimit(Limit int) (*ListAvailablePhoneNumberMachineToMachineParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberMachineToMachine records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberMachineToMachineResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/MachineToMachine.json" +func (c *ApiService) PageAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/MachineToMachine.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberMachineToMachineResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberMachineToMachine records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams) ([]ApiV2010AvailablePhoneNumberMachineToMachine, error) { +func (c *ApiService) ListAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams) (ListAvailablePhoneNumberMachineToMachine200Response, error) { response, errors := c.StreamAvailablePhoneNumberMachineToMachine(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberMachineToMachine, 0) + records := make(ListAvailablePhoneNumberMachineToMachine200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberMachineToMachine(CountryCode string } // Streams AvailablePhoneNumberMachineToMachine records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams) (chan ApiV2010AvailablePhoneNumberMachineToMachine, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams) (chan ListAvailablePhoneNumberMachineToMachine200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberMachineToMachineParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberMachineToMachine, 1) + recordChannel := make(chan ListAvailablePhoneNumberMachineToMachine200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberMachineToMachine(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberMachineToMachine(CountryCode stri return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberMachineToMachine(response *ListAvailablePhoneNumberMachineToMachineResponse, params *ListAvailablePhoneNumberMachineToMachineParams, recordChannel chan ApiV2010AvailablePhoneNumberMachineToMachine, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberMachineToMachine(response *, params *ListAvailablePhoneNumberMachineToMachineParams, recordChannel chan ListAvailablePhoneNumberMachineToMachine200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberMachineToMachine(response *ListAv } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberMachineToMachineResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberMachineToMachine(response *ListAv break } - response = record.(*ListAvailablePhoneNumberMachineToMachineResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberMachineToMachineResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberMachineToMachineResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_mobile.go b/rest/api/v2010/accounts_available_phone_numbers_mobile.go index df649b4d0..861d37fb4 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_mobile.go +++ b/rest/api/v2010/accounts_available_phone_numbers_mobile.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberMobile' type ListAvailablePhoneNumberMobileParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberMobileParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberMobileParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberMobileParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberMobileParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberMobileParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberMobileParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberMobileParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetContains(Contains string) *ListAvailablePhoneNumberMobileParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberMobileParams) SetContains(Contains string) (*ListAvailablePhoneNumberMobileParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberMobileParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberMobileParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberMobileParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberMobileParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberMobileParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberMobileParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberMobileParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberMobileParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberMobileParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberMobileParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberMobileParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberMobileParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberMobileParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberMobileParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberMobileParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberMobileParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberMobileParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberMobileParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetBeta(Beta bool) *ListAvailablePhoneNumberMobileParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberMobileParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberMobileParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberMobileParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberMobileParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberMobileParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberMobileParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberMobileParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberMobileParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetDistance(Distance int) *ListAvailablePhoneNumberMobileParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberMobileParams) SetDistance(Distance int) (*ListAvailablePhoneNumberMobileParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberMobileParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberMobileParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberMobileParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberMobileParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberMobileParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberMobileParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberMobileParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberMobileParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberMobileParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetInLata(InLata string) *ListAvailablePhoneNumberMobileParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberMobileParams) SetInLata(InLata string) (*ListAvailablePhoneNumberMobileParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberMobileParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberMobileParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberMobileParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberMobileParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberMobileParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberMobileParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberMobileParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberMobileParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberMobileParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberMobileParams) SetLimit(Limit int) *ListAvailablePhoneNumberMobileParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberMobileParams) SetLimit(Limit int) (*ListAvailablePhoneNumberMobileParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberMobile records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberMobile(CountryCode string, params *ListAvailablePhoneNumberMobileParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberMobileResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Mobile.json" +func (c *ApiService) PageAvailablePhoneNumberMobile(CountryCode string, params *ListAvailablePhoneNumberMobileParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Mobile.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberMobileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberMobile records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberMobile(CountryCode string, params *ListAvailablePhoneNumberMobileParams) ([]ApiV2010AvailablePhoneNumberMobile, error) { +func (c *ApiService) ListAvailablePhoneNumberMobile(CountryCode string, params *ListAvailablePhoneNumberMobileParams) (ListAvailablePhoneNumberMobile200Response, error) { response, errors := c.StreamAvailablePhoneNumberMobile(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberMobile, 0) + records := make(ListAvailablePhoneNumberMobile200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberMobile(CountryCode string, params * } // Streams AvailablePhoneNumberMobile records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberMobile(CountryCode string, params *ListAvailablePhoneNumberMobileParams) (chan ApiV2010AvailablePhoneNumberMobile, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberMobile(CountryCode string, params *ListAvailablePhoneNumberMobileParams) (chan ListAvailablePhoneNumberMobile200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberMobileParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberMobile, 1) + recordChannel := make(chan ListAvailablePhoneNumberMobile200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberMobile(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberMobile(CountryCode string, params return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberMobile(response *ListAvailablePhoneNumberMobileResponse, params *ListAvailablePhoneNumberMobileParams, recordChannel chan ApiV2010AvailablePhoneNumberMobile, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberMobile(response *, params *ListAvailablePhoneNumberMobileParams, recordChannel chan ListAvailablePhoneNumberMobile200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberMobile(response *ListAvailablePho } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberMobileResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberMobile(response *ListAvailablePho break } - response = record.(*ListAvailablePhoneNumberMobileResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberMobileResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberMobileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_national.go b/rest/api/v2010/accounts_available_phone_numbers_national.go index 46f936ea2..43874e233 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_national.go +++ b/rest/api/v2010/accounts_available_phone_numbers_national.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberNational' type ListAvailablePhoneNumberNationalParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberNationalParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberNationalParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberNationalParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberNationalParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberNationalParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberNationalParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberNationalParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetContains(Contains string) *ListAvailablePhoneNumberNationalParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberNationalParams) SetContains(Contains string) (*ListAvailablePhoneNumberNationalParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberNationalParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberNationalParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberNationalParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberNationalParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberNationalParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberNationalParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberNationalParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberNationalParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberNationalParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberNationalParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberNationalParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberNationalParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberNationalParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberNationalParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberNationalParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberNationalParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberNationalParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberNationalParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetBeta(Beta bool) *ListAvailablePhoneNumberNationalParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberNationalParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberNationalParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberNationalParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberNationalParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberNationalParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberNationalParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberNationalParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberNationalParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetDistance(Distance int) *ListAvailablePhoneNumberNationalParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberNationalParams) SetDistance(Distance int) (*ListAvailablePhoneNumberNationalParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberNationalParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberNationalParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberNationalParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberNationalParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberNationalParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberNationalParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberNationalParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberNationalParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberNationalParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetInLata(InLata string) *ListAvailablePhoneNumberNationalParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberNationalParams) SetInLata(InLata string) (*ListAvailablePhoneNumberNationalParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberNationalParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberNationalParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberNationalParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberNationalParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberNationalParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberNationalParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberNationalParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberNationalParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberNationalParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberNationalParams) SetLimit(Limit int) *ListAvailablePhoneNumberNationalParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberNationalParams) SetLimit(Limit int) (*ListAvailablePhoneNumberNationalParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberNational records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberNational(CountryCode string, params *ListAvailablePhoneNumberNationalParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberNationalResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/National.json" +func (c *ApiService) PageAvailablePhoneNumberNational(CountryCode string, params *ListAvailablePhoneNumberNationalParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/National.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberNationalResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberNational records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberNational(CountryCode string, params *ListAvailablePhoneNumberNationalParams) ([]ApiV2010AvailablePhoneNumberNational, error) { +func (c *ApiService) ListAvailablePhoneNumberNational(CountryCode string, params *ListAvailablePhoneNumberNationalParams) (ListAvailablePhoneNumberNational200Response, error) { response, errors := c.StreamAvailablePhoneNumberNational(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberNational, 0) + records := make(ListAvailablePhoneNumberNational200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberNational(CountryCode string, params } // Streams AvailablePhoneNumberNational records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberNational(CountryCode string, params *ListAvailablePhoneNumberNationalParams) (chan ApiV2010AvailablePhoneNumberNational, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberNational(CountryCode string, params *ListAvailablePhoneNumberNationalParams) (chan ListAvailablePhoneNumberNational200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberNationalParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberNational, 1) + recordChannel := make(chan ListAvailablePhoneNumberNational200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberNational(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberNational(CountryCode string, para return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberNational(response *ListAvailablePhoneNumberNationalResponse, params *ListAvailablePhoneNumberNationalParams, recordChannel chan ApiV2010AvailablePhoneNumberNational, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberNational(response *, params *ListAvailablePhoneNumberNationalParams, recordChannel chan ListAvailablePhoneNumberNational200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberNational(response *ListAvailableP } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberNationalResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberNational(response *ListAvailableP break } - response = record.(*ListAvailablePhoneNumberNationalResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberNationalResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberNationalResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_shared_cost.go b/rest/api/v2010/accounts_available_phone_numbers_shared_cost.go index 9c6abff87..d06b83a49 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_shared_cost.go +++ b/rest/api/v2010/accounts_available_phone_numbers_shared_cost.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberSharedCost' type ListAvailablePhoneNumberSharedCostParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberSharedCostParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberSharedCostParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberSharedCostParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberSharedCostParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberSharedCostParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetContains(Contains string) *ListAvailablePhoneNumberSharedCostParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetContains(Contains string) (*ListAvailablePhoneNumberSharedCostParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberSharedCostParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberSharedCostParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberSharedCostParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberSharedCostParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberSharedCostParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberSharedCostParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetBeta(Beta bool) *ListAvailablePhoneNumberSharedCostParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberSharedCostParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberSharedCostParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberSharedCostParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberSharedCostParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetDistance(Distance int) *ListAvailablePhoneNumberSharedCostParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetDistance(Distance int) (*ListAvailablePhoneNumberSharedCostParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberSharedCostParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberSharedCostParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberSharedCostParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberSharedCostParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberSharedCostParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberSharedCostParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetInLata(InLata string) *ListAvailablePhoneNumberSharedCostParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetInLata(InLata string) (*ListAvailablePhoneNumberSharedCostParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberSharedCostParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberSharedCostParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberSharedCostParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberSharedCostParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberSharedCostParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberSharedCostParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberSharedCostParams) SetLimit(Limit int) *ListAvailablePhoneNumberSharedCostParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberSharedCostParams) SetLimit(Limit int) (*ListAvailablePhoneNumberSharedCostParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberSharedCost records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberSharedCost(CountryCode string, params *ListAvailablePhoneNumberSharedCostParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberSharedCostResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/SharedCost.json" +func (c *ApiService) PageAvailablePhoneNumberSharedCost(CountryCode string, params *ListAvailablePhoneNumberSharedCostParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/SharedCost.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberSharedCostResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberSharedCost records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberSharedCost(CountryCode string, params *ListAvailablePhoneNumberSharedCostParams) ([]ApiV2010AvailablePhoneNumberSharedCost, error) { +func (c *ApiService) ListAvailablePhoneNumberSharedCost(CountryCode string, params *ListAvailablePhoneNumberSharedCostParams) (ListAvailablePhoneNumberSharedCost200Response, error) { response, errors := c.StreamAvailablePhoneNumberSharedCost(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberSharedCost, 0) + records := make(ListAvailablePhoneNumberSharedCost200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberSharedCost(CountryCode string, para } // Streams AvailablePhoneNumberSharedCost records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberSharedCost(CountryCode string, params *ListAvailablePhoneNumberSharedCostParams) (chan ApiV2010AvailablePhoneNumberSharedCost, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberSharedCost(CountryCode string, params *ListAvailablePhoneNumberSharedCostParams) (chan ListAvailablePhoneNumberSharedCost200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberSharedCostParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberSharedCost, 1) + recordChannel := make(chan ListAvailablePhoneNumberSharedCost200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberSharedCost(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberSharedCost(CountryCode string, pa return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberSharedCost(response *ListAvailablePhoneNumberSharedCostResponse, params *ListAvailablePhoneNumberSharedCostParams, recordChannel chan ApiV2010AvailablePhoneNumberSharedCost, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberSharedCost(response *, params *ListAvailablePhoneNumberSharedCostParams, recordChannel chan ListAvailablePhoneNumberSharedCost200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberSharedCost(response *ListAvailabl } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberSharedCostResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberSharedCost(response *ListAvailabl break } - response = record.(*ListAvailablePhoneNumberSharedCostResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberSharedCostResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberSharedCostResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_toll_free.go b/rest/api/v2010/accounts_available_phone_numbers_toll_free.go index 7d4be3c1f..fd4f2222c 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_toll_free.go +++ b/rest/api/v2010/accounts_available_phone_numbers_toll_free.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberTollFree' type ListAvailablePhoneNumberTollFreeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberTollFreeParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberTollFreeParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberTollFreeParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberTollFreeParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberTollFreeParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetContains(Contains string) *ListAvailablePhoneNumberTollFreeParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetContains(Contains string) (*ListAvailablePhoneNumberTollFreeParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberTollFreeParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberTollFreeParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberTollFreeParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberTollFreeParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberTollFreeParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberTollFreeParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetBeta(Beta bool) *ListAvailablePhoneNumberTollFreeParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberTollFreeParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberTollFreeParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberTollFreeParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberTollFreeParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetDistance(Distance int) *ListAvailablePhoneNumberTollFreeParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetDistance(Distance int) (*ListAvailablePhoneNumberTollFreeParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberTollFreeParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberTollFreeParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberTollFreeParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberTollFreeParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberTollFreeParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberTollFreeParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetInLata(InLata string) *ListAvailablePhoneNumberTollFreeParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetInLata(InLata string) (*ListAvailablePhoneNumberTollFreeParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberTollFreeParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberTollFreeParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberTollFreeParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberTollFreeParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberTollFreeParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberTollFreeParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberTollFreeParams) SetLimit(Limit int) *ListAvailablePhoneNumberTollFreeParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberTollFreeParams) SetLimit(Limit int) (*ListAvailablePhoneNumberTollFreeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberTollFree records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberTollFree(CountryCode string, params *ListAvailablePhoneNumberTollFreeParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberTollFreeResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/TollFree.json" +func (c *ApiService) PageAvailablePhoneNumberTollFree(CountryCode string, params *ListAvailablePhoneNumberTollFreeParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/TollFree.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberTollFreeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberTollFree records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberTollFree(CountryCode string, params *ListAvailablePhoneNumberTollFreeParams) ([]ApiV2010AvailablePhoneNumberTollFree, error) { +func (c *ApiService) ListAvailablePhoneNumberTollFree(CountryCode string, params *ListAvailablePhoneNumberTollFreeParams) (ListAvailablePhoneNumberTollFree200Response, error) { response, errors := c.StreamAvailablePhoneNumberTollFree(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberTollFree, 0) + records := make(ListAvailablePhoneNumberTollFree200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberTollFree(CountryCode string, params } // Streams AvailablePhoneNumberTollFree records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberTollFree(CountryCode string, params *ListAvailablePhoneNumberTollFreeParams) (chan ApiV2010AvailablePhoneNumberTollFree, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberTollFree(CountryCode string, params *ListAvailablePhoneNumberTollFreeParams) (chan ListAvailablePhoneNumberTollFree200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberTollFreeParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberTollFree, 1) + recordChannel := make(chan ListAvailablePhoneNumberTollFree200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberTollFree(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberTollFree(CountryCode string, para return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberTollFree(response *ListAvailablePhoneNumberTollFreeResponse, params *ListAvailablePhoneNumberTollFreeParams, recordChannel chan ApiV2010AvailablePhoneNumberTollFree, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberTollFree(response *, params *ListAvailablePhoneNumberTollFreeParams, recordChannel chan ListAvailablePhoneNumberTollFree200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberTollFree(response *ListAvailableP } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberTollFreeResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberTollFree(response *ListAvailableP break } - response = record.(*ListAvailablePhoneNumberTollFreeResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberTollFreeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberTollFreeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_available_phone_numbers_voip.go b/rest/api/v2010/accounts_available_phone_numbers_voip.go index a2534d8e5..2247967cf 100644 --- a/rest/api/v2010/accounts_available_phone_numbers_voip.go +++ b/rest/api/v2010/accounts_available_phone_numbers_voip.go @@ -18,241 +18,241 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAvailablePhoneNumberVoip' type ListAvailablePhoneNumberVoipParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. - AreaCode *int `json:"AreaCode,omitempty"` - // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. - Contains *string `json:"Contains,omitempty"` - // Whether the phone numbers can receive text messages. Can be: `true` or `false`. - SmsEnabled *bool `json:"SmsEnabled,omitempty"` - // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. - MmsEnabled *bool `json:"MmsEnabled,omitempty"` - // Whether the phone numbers can receive calls. Can be: `true` or `false`. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` - // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. - ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` - // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. - NearNumber *string `json:"NearNumber,omitempty"` - // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. - NearLatLong *string `json:"NearLatLong,omitempty"` - // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. - Distance *int `json:"Distance,omitempty"` - // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. - InPostalCode *string `json:"InPostalCode,omitempty"` - // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. - InRegion *string `json:"InRegion,omitempty"` - // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. - InRateCenter *string `json:"InRateCenter,omitempty"` - // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. - InLata *string `json:"InLata,omitempty"` - // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. - InLocality *string `json:"InLocality,omitempty"` - // Whether the phone numbers can receive faxes. Can be: `true` or `false`. - FaxEnabled *bool `json:"FaxEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) requesting the AvailablePhoneNumber resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada. + AreaCode *int `json:"AreaCode,omitempty"` + // The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. + Contains *string `json:"Contains,omitempty"` + // Whether the phone numbers can receive text messages. Can be: `true` or `false`. + SmsEnabled *bool `json:"SmsEnabled,omitempty"` + // Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. + MmsEnabled *bool `json:"MmsEnabled,omitempty"` + // Whether the phone numbers can receive calls. Can be: `true` or `false`. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"` + // Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. + ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"` + // Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. + NearNumber *string `json:"NearNumber,omitempty"` + // Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. + NearLatLong *string `json:"NearLatLong,omitempty"` + // The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. + Distance *int `json:"Distance,omitempty"` + // Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. + InPostalCode *string `json:"InPostalCode,omitempty"` + // Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. + InRegion *string `json:"InRegion,omitempty"` + // Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. + InRateCenter *string `json:"InRateCenter,omitempty"` + // Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. + InLata *string `json:"InLata,omitempty"` + // Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. + InLocality *string `json:"InLocality,omitempty"` + // Whether the phone numbers can receive faxes. Can be: `true` or `false`. + FaxEnabled *bool `json:"FaxEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAvailablePhoneNumberVoipParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberVoipParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListAvailablePhoneNumberVoipParams) SetPathAccountSid(PathAccountSid string) (*ListAvailablePhoneNumberVoipParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberVoipParams { - params.AreaCode = &AreaCode - return params +func (params *ListAvailablePhoneNumberVoipParams) SetAreaCode(AreaCode int) (*ListAvailablePhoneNumberVoipParams){ + params.AreaCode = &AreaCode + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetContains(Contains string) *ListAvailablePhoneNumberVoipParams { - params.Contains = &Contains - return params +func (params *ListAvailablePhoneNumberVoipParams) SetContains(Contains string) (*ListAvailablePhoneNumberVoipParams){ + params.Contains = &Contains + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberVoipParams { - params.SmsEnabled = &SmsEnabled - return params +func (params *ListAvailablePhoneNumberVoipParams) SetSmsEnabled(SmsEnabled bool) (*ListAvailablePhoneNumberVoipParams){ + params.SmsEnabled = &SmsEnabled + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberVoipParams { - params.MmsEnabled = &MmsEnabled - return params +func (params *ListAvailablePhoneNumberVoipParams) SetMmsEnabled(MmsEnabled bool) (*ListAvailablePhoneNumberVoipParams){ + params.MmsEnabled = &MmsEnabled + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberVoipParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *ListAvailablePhoneNumberVoipParams) SetVoiceEnabled(VoiceEnabled bool) (*ListAvailablePhoneNumberVoipParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberVoipParams { - params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired - return params +func (params *ListAvailablePhoneNumberVoipParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) (*ListAvailablePhoneNumberVoipParams){ + params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberVoipParams { - params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired - return params +func (params *ListAvailablePhoneNumberVoipParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) (*ListAvailablePhoneNumberVoipParams){ + params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberVoipParams { - params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired - return params +func (params *ListAvailablePhoneNumberVoipParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) (*ListAvailablePhoneNumberVoipParams){ + params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetBeta(Beta bool) *ListAvailablePhoneNumberVoipParams { - params.Beta = &Beta - return params +func (params *ListAvailablePhoneNumberVoipParams) SetBeta(Beta bool) (*ListAvailablePhoneNumberVoipParams){ + params.Beta = &Beta + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberVoipParams { - params.NearNumber = &NearNumber - return params +func (params *ListAvailablePhoneNumberVoipParams) SetNearNumber(NearNumber string) (*ListAvailablePhoneNumberVoipParams){ + params.NearNumber = &NearNumber + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberVoipParams { - params.NearLatLong = &NearLatLong - return params +func (params *ListAvailablePhoneNumberVoipParams) SetNearLatLong(NearLatLong string) (*ListAvailablePhoneNumberVoipParams){ + params.NearLatLong = &NearLatLong + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetDistance(Distance int) *ListAvailablePhoneNumberVoipParams { - params.Distance = &Distance - return params +func (params *ListAvailablePhoneNumberVoipParams) SetDistance(Distance int) (*ListAvailablePhoneNumberVoipParams){ + params.Distance = &Distance + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberVoipParams { - params.InPostalCode = &InPostalCode - return params +func (params *ListAvailablePhoneNumberVoipParams) SetInPostalCode(InPostalCode string) (*ListAvailablePhoneNumberVoipParams){ + params.InPostalCode = &InPostalCode + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberVoipParams { - params.InRegion = &InRegion - return params +func (params *ListAvailablePhoneNumberVoipParams) SetInRegion(InRegion string) (*ListAvailablePhoneNumberVoipParams){ + params.InRegion = &InRegion + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberVoipParams { - params.InRateCenter = &InRateCenter - return params +func (params *ListAvailablePhoneNumberVoipParams) SetInRateCenter(InRateCenter string) (*ListAvailablePhoneNumberVoipParams){ + params.InRateCenter = &InRateCenter + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetInLata(InLata string) *ListAvailablePhoneNumberVoipParams { - params.InLata = &InLata - return params +func (params *ListAvailablePhoneNumberVoipParams) SetInLata(InLata string) (*ListAvailablePhoneNumberVoipParams){ + params.InLata = &InLata + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberVoipParams { - params.InLocality = &InLocality - return params +func (params *ListAvailablePhoneNumberVoipParams) SetInLocality(InLocality string) (*ListAvailablePhoneNumberVoipParams){ + params.InLocality = &InLocality + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberVoipParams { - params.FaxEnabled = &FaxEnabled - return params +func (params *ListAvailablePhoneNumberVoipParams) SetFaxEnabled(FaxEnabled bool) (*ListAvailablePhoneNumberVoipParams){ + params.FaxEnabled = &FaxEnabled + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberVoipParams { - params.PageSize = &PageSize - return params +func (params *ListAvailablePhoneNumberVoipParams) SetPageSize(PageSize int) (*ListAvailablePhoneNumberVoipParams){ + params.PageSize = &PageSize + return params } -func (params *ListAvailablePhoneNumberVoipParams) SetLimit(Limit int) *ListAvailablePhoneNumberVoipParams { - params.Limit = &Limit - return params +func (params *ListAvailablePhoneNumberVoipParams) SetLimit(Limit int) (*ListAvailablePhoneNumberVoipParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AvailablePhoneNumberVoip records from the API. Request is executed immediately. -func (c *ApiService) PageAvailablePhoneNumberVoip(CountryCode string, params *ListAvailablePhoneNumberVoipParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberVoipResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Voip.json" +func (c *ApiService) PageAvailablePhoneNumberVoip(CountryCode string, params *ListAvailablePhoneNumberVoipParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Voip.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) - } - if params != nil && params.Contains != nil { - data.Set("Contains", *params.Contains) - } - if params != nil && params.SmsEnabled != nil { - data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) - } - if params != nil && params.MmsEnabled != nil { - data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.ExcludeAllAddressRequired != nil { - data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) - } - if params != nil && params.ExcludeLocalAddressRequired != nil { - data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) - } - if params != nil && params.ExcludeForeignAddressRequired != nil { - data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) - } - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.NearNumber != nil { - data.Set("NearNumber", *params.NearNumber) - } - if params != nil && params.NearLatLong != nil { - data.Set("NearLatLong", *params.NearLatLong) - } - if params != nil && params.Distance != nil { - data.Set("Distance", fmt.Sprint(*params.Distance)) - } - if params != nil && params.InPostalCode != nil { - data.Set("InPostalCode", *params.InPostalCode) - } - if params != nil && params.InRegion != nil { - data.Set("InRegion", *params.InRegion) - } - if params != nil && params.InRateCenter != nil { - data.Set("InRateCenter", *params.InRateCenter) - } - if params != nil && params.InLata != nil { - data.Set("InLata", *params.InLata) - } - if params != nil && params.InLocality != nil { - data.Set("InLocality", *params.InLocality) - } - if params != nil && params.FaxEnabled != nil { - data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", fmt.Sprint(*params.AreaCode)) + } + if params != nil && params.Contains != nil { + data.Set("Contains", *params.Contains) + } + if params != nil && params.SmsEnabled != nil { + data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled)) + } + if params != nil && params.MmsEnabled != nil { + data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.ExcludeAllAddressRequired != nil { + data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired)) + } + if params != nil && params.ExcludeLocalAddressRequired != nil { + data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired)) + } + if params != nil && params.ExcludeForeignAddressRequired != nil { + data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired)) + } + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.NearNumber != nil { + data.Set("NearNumber", *params.NearNumber) + } + if params != nil && params.NearLatLong != nil { + data.Set("NearLatLong", *params.NearLatLong) + } + if params != nil && params.Distance != nil { + data.Set("Distance", fmt.Sprint(*params.Distance)) + } + if params != nil && params.InPostalCode != nil { + data.Set("InPostalCode", *params.InPostalCode) + } + if params != nil && params.InRegion != nil { + data.Set("InRegion", *params.InRegion) + } + if params != nil && params.InRateCenter != nil { + data.Set("InRateCenter", *params.InRateCenter) + } + if params != nil && params.InLata != nil { + data.Set("InLata", *params.InLata) + } + if params != nil && params.InLocality != nil { + data.Set("InLocality", *params.InLocality) + } + if params != nil && params.FaxEnabled != nil { + data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberVoipResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AvailablePhoneNumberVoip records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListAvailablePhoneNumberVoip(CountryCode string, params *ListAvailablePhoneNumberVoipParams) ([]ApiV2010AvailablePhoneNumberVoip, error) { +func (c *ApiService) ListAvailablePhoneNumberVoip(CountryCode string, params *ListAvailablePhoneNumberVoipParams) (ListAvailablePhoneNumberVoip200Response, error) { response, errors := c.StreamAvailablePhoneNumberVoip(CountryCode, params) - records := make([]ApiV2010AvailablePhoneNumberVoip, 0) + records := make(ListAvailablePhoneNumberVoip200Response, 0) for record := range response { records = append(records, record) } @@ -265,13 +265,13 @@ func (c *ApiService) ListAvailablePhoneNumberVoip(CountryCode string, params *Li } // Streams AvailablePhoneNumberVoip records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamAvailablePhoneNumberVoip(CountryCode string, params *ListAvailablePhoneNumberVoipParams) (chan ApiV2010AvailablePhoneNumberVoip, chan error) { +func (c *ApiService) StreamAvailablePhoneNumberVoip(CountryCode string, params *ListAvailablePhoneNumberVoipParams) (chan ListAvailablePhoneNumberVoip200Response, chan error) { if params == nil { params = &ListAvailablePhoneNumberVoipParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010AvailablePhoneNumberVoip, 1) + recordChannel := make(chan ListAvailablePhoneNumberVoip200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageAvailablePhoneNumberVoip(CountryCode, params, "", "") @@ -286,11 +286,12 @@ func (c *ApiService) StreamAvailablePhoneNumberVoip(CountryCode string, params * return recordChannel, errorChannel } -func (c *ApiService) streamAvailablePhoneNumberVoip(response *ListAvailablePhoneNumberVoipResponse, params *ListAvailablePhoneNumberVoipParams, recordChannel chan ApiV2010AvailablePhoneNumberVoip, errorChannel chan error) { + +func (c *ApiService) streamAvailablePhoneNumberVoip(response *, params *ListAvailablePhoneNumberVoipParams, recordChannel chan ListAvailablePhoneNumberVoip200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AvailablePhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -301,7 +302,7 @@ func (c *ApiService) streamAvailablePhoneNumberVoip(response *ListAvailablePhone } } - record, err := client.GetNext(c.baseURL, response, c.getNextListAvailablePhoneNumberVoipResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -309,27 +310,28 @@ func (c *ApiService) streamAvailablePhoneNumberVoip(response *ListAvailablePhone break } - response = record.(*ListAvailablePhoneNumberVoipResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListAvailablePhoneNumberVoipResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAvailablePhoneNumberVoipResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_balance.go b/rest/api/v2010/accounts_balance.go index 043ab1aad..029ed99a3 100644 --- a/rest/api/v2010/accounts_balance.go +++ b/rest/api/v2010/accounts_balance.go @@ -16,44 +16,49 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchBalance' type FetchBalanceParams struct { - // The unique SID identifier of the Account. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique SID identifier of the Account. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchBalanceParams) SetPathAccountSid(PathAccountSid string) *FetchBalanceParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchBalanceParams) SetPathAccountSid(PathAccountSid string) (*FetchBalanceParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch the balance for an Account based on Account Sid. Balance changes may not be reflected immediately. Child accounts do not contain balance information func (c *ApiService) FetchBalance(params *FetchBalanceParams) (*ApiV2010Balance, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Balance.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/Balance.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010Balance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010Balance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_calls.go b/rest/api/v2010/accounts_calls.go index cb5b0cf61..ace60a63e 100644 --- a/rest/api/v2010/accounts_calls.go +++ b/rest/api/v2010/accounts_calls.go @@ -18,600 +18,568 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCall' type CreateCallParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number, SIP address, or client identifier to call. - To *string `json:"To,omitempty"` - // The phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `From` must also be a phone number. - From *string `json:"From,omitempty"` - // The HTTP method we should use when calling the `url` parameter's value. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - Method *string `json:"Method,omitempty"` - // The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. - FallbackUrl *string `json:"FallbackUrl,omitempty"` - // The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - FallbackMethod *string `json:"FallbackMethod,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). - StatusCallback *string `json:"StatusCallback,omitempty"` - // The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored. - StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` - // The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. - SendDigits *string `json:"SendDigits,omitempty"` - // The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. - Timeout *int `json:"Timeout,omitempty"` - // Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL. - Record *bool `json:"Record,omitempty"` - // The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. - RecordingChannels *string `json:"RecordingChannels,omitempty"` - // The URL that we call when the recording is available to be accessed. - RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` - // The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. - RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` - // The username used to authenticate the caller making a SIP call. - SipAuthUsername *string `json:"SipAuthUsername,omitempty"` - // The password required to authenticate the user account specified in `sip_auth_username`. - SipAuthPassword *string `json:"SipAuthPassword,omitempty"` - // Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). - MachineDetection *string `json:"MachineDetection,omitempty"` - // The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. - MachineDetectionTimeout *int `json:"MachineDetectionTimeout,omitempty"` - // The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. - RecordingStatusCallbackEvent *[]string `json:"RecordingStatusCallbackEvent,omitempty"` - // Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. - Trim *string `json:"Trim,omitempty"` - // The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. - CallerId *string `json:"CallerId,omitempty"` - // The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. - MachineDetectionSpeechThreshold *int `json:"MachineDetectionSpeechThreshold,omitempty"` - // The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. - MachineDetectionSpeechEndThreshold *int `json:"MachineDetectionSpeechEndThreshold,omitempty"` - // The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. - MachineDetectionSilenceTimeout *int `json:"MachineDetectionSilenceTimeout,omitempty"` - // Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. - AsyncAmd *string `json:"AsyncAmd,omitempty"` - // The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. - AsyncAmdStatusCallback *string `json:"AsyncAmdStatusCallback,omitempty"` - // The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. - AsyncAmdStatusCallbackMethod *string `json:"AsyncAmdStatusCallbackMethod,omitempty"` - // The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) - Byoc *string `json:"Byoc,omitempty"` - // The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) - CallReason *string `json:"CallReason,omitempty"` - // A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. - CallToken *string `json:"CallToken,omitempty"` - // The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. - RecordingTrack *string `json:"RecordingTrack,omitempty"` - // The maximum duration of the call in seconds. Constraints depend on account and configuration. - TimeLimit *int `json:"TimeLimit,omitempty"` - // The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). - Url *string `json:"Url,omitempty"` - // TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. - Twiml *string `json:"Twiml,omitempty"` - // The SID of the Application resource that will handle the call, if the call will be handled by an application. - ApplicationSid *string `json:"ApplicationSid,omitempty"` -} - -func (params *CreateCallParams) SetPathAccountSid(PathAccountSid string) *CreateCallParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateCallParams) SetTo(To string) *CreateCallParams { - params.To = &To - return params -} -func (params *CreateCallParams) SetFrom(From string) *CreateCallParams { - params.From = &From - return params -} -func (params *CreateCallParams) SetMethod(Method string) *CreateCallParams { - params.Method = &Method - return params -} -func (params *CreateCallParams) SetFallbackUrl(FallbackUrl string) *CreateCallParams { - params.FallbackUrl = &FallbackUrl - return params -} -func (params *CreateCallParams) SetFallbackMethod(FallbackMethod string) *CreateCallParams { - params.FallbackMethod = &FallbackMethod - return params -} -func (params *CreateCallParams) SetStatusCallback(StatusCallback string) *CreateCallParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateCallParams) SetStatusCallbackEvent(StatusCallbackEvent []string) *CreateCallParams { - params.StatusCallbackEvent = &StatusCallbackEvent - return params -} -func (params *CreateCallParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateCallParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateCallParams) SetSendDigits(SendDigits string) *CreateCallParams { - params.SendDigits = &SendDigits - return params -} -func (params *CreateCallParams) SetTimeout(Timeout int) *CreateCallParams { - params.Timeout = &Timeout - return params -} -func (params *CreateCallParams) SetRecord(Record bool) *CreateCallParams { - params.Record = &Record - return params -} -func (params *CreateCallParams) SetRecordingChannels(RecordingChannels string) *CreateCallParams { - params.RecordingChannels = &RecordingChannels - return params -} -func (params *CreateCallParams) SetRecordingStatusCallback(RecordingStatusCallback string) *CreateCallParams { - params.RecordingStatusCallback = &RecordingStatusCallback - return params -} -func (params *CreateCallParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) *CreateCallParams { - params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod - return params -} -func (params *CreateCallParams) SetSipAuthUsername(SipAuthUsername string) *CreateCallParams { - params.SipAuthUsername = &SipAuthUsername - return params -} -func (params *CreateCallParams) SetSipAuthPassword(SipAuthPassword string) *CreateCallParams { - params.SipAuthPassword = &SipAuthPassword - return params -} -func (params *CreateCallParams) SetMachineDetection(MachineDetection string) *CreateCallParams { - params.MachineDetection = &MachineDetection - return params -} -func (params *CreateCallParams) SetMachineDetectionTimeout(MachineDetectionTimeout int) *CreateCallParams { - params.MachineDetectionTimeout = &MachineDetectionTimeout - return params -} -func (params *CreateCallParams) SetRecordingStatusCallbackEvent(RecordingStatusCallbackEvent []string) *CreateCallParams { - params.RecordingStatusCallbackEvent = &RecordingStatusCallbackEvent - return params -} -func (params *CreateCallParams) SetTrim(Trim string) *CreateCallParams { - params.Trim = &Trim - return params -} -func (params *CreateCallParams) SetCallerId(CallerId string) *CreateCallParams { - params.CallerId = &CallerId - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number, SIP address, or client identifier to call. + To *string `json:"To,omitempty"` + // The phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `From` must also be a phone number. + From *string `json:"From,omitempty"` + // The HTTP method we should use when calling the `url` parameter's value. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. + Method *string `json:"Method,omitempty"` + // The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. + FallbackUrl *string `json:"FallbackUrl,omitempty"` + // The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. + FallbackMethod *string `json:"FallbackMethod,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). + StatusCallback *string `json:"StatusCallback,omitempty"` + // The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored. + StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` + // The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. + SendDigits *string `json:"SendDigits,omitempty"` + // The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. + Timeout *int `json:"Timeout,omitempty"` + // Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL. + Record *bool `json:"Record,omitempty"` + // The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. + RecordingChannels *string `json:"RecordingChannels,omitempty"` + // The URL that we call when the recording is available to be accessed. + RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` + // The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` + // The username used to authenticate the caller making a SIP call. + SipAuthUsername *string `json:"SipAuthUsername,omitempty"` + // The password required to authenticate the user account specified in `sip_auth_username`. + SipAuthPassword *string `json:"SipAuthPassword,omitempty"` + // Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). + MachineDetection *string `json:"MachineDetection,omitempty"` + // The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. + MachineDetectionTimeout *int `json:"MachineDetectionTimeout,omitempty"` + // The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. + RecordingStatusCallbackEvent *[]string `json:"RecordingStatusCallbackEvent,omitempty"` + // Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. + Trim *string `json:"Trim,omitempty"` + // The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. + CallerId *string `json:"CallerId,omitempty"` + // The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. + MachineDetectionSpeechThreshold *int `json:"MachineDetectionSpeechThreshold,omitempty"` + // The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. + MachineDetectionSpeechEndThreshold *int `json:"MachineDetectionSpeechEndThreshold,omitempty"` + // The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. + MachineDetectionSilenceTimeout *int `json:"MachineDetectionSilenceTimeout,omitempty"` + // Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. + AsyncAmd *string `json:"AsyncAmd,omitempty"` + // The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. + AsyncAmdStatusCallback *string `json:"AsyncAmdStatusCallback,omitempty"` + // The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + AsyncAmdStatusCallbackMethod *string `json:"AsyncAmdStatusCallbackMethod,omitempty"` + // The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) + Byoc *string `json:"Byoc,omitempty"` + // The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) + CallReason *string `json:"CallReason,omitempty"` + // A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. + CallToken *string `json:"CallToken,omitempty"` + // The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. + RecordingTrack *string `json:"RecordingTrack,omitempty"` + // The maximum duration of the call in seconds. Constraints depend on account and configuration. + TimeLimit *int `json:"TimeLimit,omitempty"` + // The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). + Url *string `json:"Url,omitempty"` + // TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. + Twiml *string `json:"Twiml,omitempty"` + // The SID of the Application resource that will handle the call, if the call will be handled by an application. + ApplicationSid *string `json:"ApplicationSid,omitempty"` +} + +func (params *CreateCallParams) SetPathAccountSid(PathAccountSid string) (*CreateCallParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateCallParams) SetTo(To string) (*CreateCallParams){ + params.To = &To + return params +} +func (params *CreateCallParams) SetFrom(From string) (*CreateCallParams){ + params.From = &From + return params +} +func (params *CreateCallParams) SetMethod(Method string) (*CreateCallParams){ + params.Method = &Method + return params +} +func (params *CreateCallParams) SetFallbackUrl(FallbackUrl string) (*CreateCallParams){ + params.FallbackUrl = &FallbackUrl + return params +} +func (params *CreateCallParams) SetFallbackMethod(FallbackMethod string) (*CreateCallParams){ + params.FallbackMethod = &FallbackMethod + return params +} +func (params *CreateCallParams) SetStatusCallback(StatusCallback string) (*CreateCallParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateCallParams) SetStatusCallbackEvent(StatusCallbackEvent []string) (*CreateCallParams){ + params.StatusCallbackEvent = &StatusCallbackEvent + return params +} +func (params *CreateCallParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateCallParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateCallParams) SetSendDigits(SendDigits string) (*CreateCallParams){ + params.SendDigits = &SendDigits + return params +} +func (params *CreateCallParams) SetTimeout(Timeout int) (*CreateCallParams){ + params.Timeout = &Timeout + return params +} +func (params *CreateCallParams) SetRecord(Record bool) (*CreateCallParams){ + params.Record = &Record + return params +} +func (params *CreateCallParams) SetRecordingChannels(RecordingChannels string) (*CreateCallParams){ + params.RecordingChannels = &RecordingChannels + return params +} +func (params *CreateCallParams) SetRecordingStatusCallback(RecordingStatusCallback string) (*CreateCallParams){ + params.RecordingStatusCallback = &RecordingStatusCallback + return params +} +func (params *CreateCallParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) (*CreateCallParams){ + params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod + return params +} +func (params *CreateCallParams) SetSipAuthUsername(SipAuthUsername string) (*CreateCallParams){ + params.SipAuthUsername = &SipAuthUsername + return params +} +func (params *CreateCallParams) SetSipAuthPassword(SipAuthPassword string) (*CreateCallParams){ + params.SipAuthPassword = &SipAuthPassword + return params +} +func (params *CreateCallParams) SetMachineDetection(MachineDetection string) (*CreateCallParams){ + params.MachineDetection = &MachineDetection + return params +} +func (params *CreateCallParams) SetMachineDetectionTimeout(MachineDetectionTimeout int) (*CreateCallParams){ + params.MachineDetectionTimeout = &MachineDetectionTimeout + return params +} +func (params *CreateCallParams) SetRecordingStatusCallbackEvent(RecordingStatusCallbackEvent []string) (*CreateCallParams){ + params.RecordingStatusCallbackEvent = &RecordingStatusCallbackEvent + return params +} +func (params *CreateCallParams) SetTrim(Trim string) (*CreateCallParams){ + params.Trim = &Trim + return params +} +func (params *CreateCallParams) SetCallerId(CallerId string) (*CreateCallParams){ + params.CallerId = &CallerId + return params } -func (params *CreateCallParams) SetMachineDetectionSpeechThreshold(MachineDetectionSpeechThreshold int) *CreateCallParams { - params.MachineDetectionSpeechThreshold = &MachineDetectionSpeechThreshold - return params +func (params *CreateCallParams) SetMachineDetectionSpeechThreshold(MachineDetectionSpeechThreshold int) (*CreateCallParams){ + params.MachineDetectionSpeechThreshold = &MachineDetectionSpeechThreshold + return params } -func (params *CreateCallParams) SetMachineDetectionSpeechEndThreshold(MachineDetectionSpeechEndThreshold int) *CreateCallParams { - params.MachineDetectionSpeechEndThreshold = &MachineDetectionSpeechEndThreshold - return params +func (params *CreateCallParams) SetMachineDetectionSpeechEndThreshold(MachineDetectionSpeechEndThreshold int) (*CreateCallParams){ + params.MachineDetectionSpeechEndThreshold = &MachineDetectionSpeechEndThreshold + return params } -func (params *CreateCallParams) SetMachineDetectionSilenceTimeout(MachineDetectionSilenceTimeout int) *CreateCallParams { - params.MachineDetectionSilenceTimeout = &MachineDetectionSilenceTimeout - return params +func (params *CreateCallParams) SetMachineDetectionSilenceTimeout(MachineDetectionSilenceTimeout int) (*CreateCallParams){ + params.MachineDetectionSilenceTimeout = &MachineDetectionSilenceTimeout + return params } -func (params *CreateCallParams) SetAsyncAmd(AsyncAmd string) *CreateCallParams { - params.AsyncAmd = &AsyncAmd - return params +func (params *CreateCallParams) SetAsyncAmd(AsyncAmd string) (*CreateCallParams){ + params.AsyncAmd = &AsyncAmd + return params } -func (params *CreateCallParams) SetAsyncAmdStatusCallback(AsyncAmdStatusCallback string) *CreateCallParams { - params.AsyncAmdStatusCallback = &AsyncAmdStatusCallback - return params +func (params *CreateCallParams) SetAsyncAmdStatusCallback(AsyncAmdStatusCallback string) (*CreateCallParams){ + params.AsyncAmdStatusCallback = &AsyncAmdStatusCallback + return params } -func (params *CreateCallParams) SetAsyncAmdStatusCallbackMethod(AsyncAmdStatusCallbackMethod string) *CreateCallParams { - params.AsyncAmdStatusCallbackMethod = &AsyncAmdStatusCallbackMethod - return params +func (params *CreateCallParams) SetAsyncAmdStatusCallbackMethod(AsyncAmdStatusCallbackMethod string) (*CreateCallParams){ + params.AsyncAmdStatusCallbackMethod = &AsyncAmdStatusCallbackMethod + return params } -func (params *CreateCallParams) SetByoc(Byoc string) *CreateCallParams { - params.Byoc = &Byoc - return params +func (params *CreateCallParams) SetByoc(Byoc string) (*CreateCallParams){ + params.Byoc = &Byoc + return params } -func (params *CreateCallParams) SetCallReason(CallReason string) *CreateCallParams { - params.CallReason = &CallReason - return params +func (params *CreateCallParams) SetCallReason(CallReason string) (*CreateCallParams){ + params.CallReason = &CallReason + return params } -func (params *CreateCallParams) SetCallToken(CallToken string) *CreateCallParams { - params.CallToken = &CallToken - return params +func (params *CreateCallParams) SetCallToken(CallToken string) (*CreateCallParams){ + params.CallToken = &CallToken + return params } -func (params *CreateCallParams) SetRecordingTrack(RecordingTrack string) *CreateCallParams { - params.RecordingTrack = &RecordingTrack - return params +func (params *CreateCallParams) SetRecordingTrack(RecordingTrack string) (*CreateCallParams){ + params.RecordingTrack = &RecordingTrack + return params } -func (params *CreateCallParams) SetTimeLimit(TimeLimit int) *CreateCallParams { - params.TimeLimit = &TimeLimit - return params +func (params *CreateCallParams) SetTimeLimit(TimeLimit int) (*CreateCallParams){ + params.TimeLimit = &TimeLimit + return params } -func (params *CreateCallParams) SetUrl(Url string) *CreateCallParams { - params.Url = &Url - return params +func (params *CreateCallParams) SetUrl(Url string) (*CreateCallParams){ + params.Url = &Url + return params } -func (params *CreateCallParams) SetTwiml(Twiml string) *CreateCallParams { - params.Twiml = &Twiml - return params +func (params *CreateCallParams) SetTwiml(Twiml string) (*CreateCallParams){ + params.Twiml = &Twiml + return params } -func (params *CreateCallParams) SetApplicationSid(ApplicationSid string) *CreateCallParams { - params.ApplicationSid = &ApplicationSid - return params +func (params *CreateCallParams) SetApplicationSid(ApplicationSid string) (*CreateCallParams){ + params.ApplicationSid = &ApplicationSid + return params } // Create a new outgoing call to phones, SIP-enabled endpoints or Twilio Client connections func (c *ApiService) CreateCall(params *CreateCallParams) (*ApiV2010Call, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Method != nil { - data.Set("Method", *params.Method) - } - if params != nil && params.FallbackUrl != nil { - data.Set("FallbackUrl", *params.FallbackUrl) - } - if params != nil && params.FallbackMethod != nil { - data.Set("FallbackMethod", *params.FallbackMethod) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackEvent != nil { - for _, item := range *params.StatusCallbackEvent { - data.Add("StatusCallbackEvent", item) - } - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.SendDigits != nil { - data.Set("SendDigits", *params.SendDigits) - } - if params != nil && params.Timeout != nil { - data.Set("Timeout", fmt.Sprint(*params.Timeout)) - } - if params != nil && params.Record != nil { - data.Set("Record", fmt.Sprint(*params.Record)) - } - if params != nil && params.RecordingChannels != nil { - data.Set("RecordingChannels", *params.RecordingChannels) - } - if params != nil && params.RecordingStatusCallback != nil { - data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) - } - if params != nil && params.RecordingStatusCallbackMethod != nil { - data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) - } - if params != nil && params.SipAuthUsername != nil { - data.Set("SipAuthUsername", *params.SipAuthUsername) - } - if params != nil && params.SipAuthPassword != nil { - data.Set("SipAuthPassword", *params.SipAuthPassword) - } - if params != nil && params.MachineDetection != nil { - data.Set("MachineDetection", *params.MachineDetection) - } - if params != nil && params.MachineDetectionTimeout != nil { - data.Set("MachineDetectionTimeout", fmt.Sprint(*params.MachineDetectionTimeout)) - } - if params != nil && params.RecordingStatusCallbackEvent != nil { - for _, item := range *params.RecordingStatusCallbackEvent { - data.Add("RecordingStatusCallbackEvent", item) - } - } - if params != nil && params.Trim != nil { - data.Set("Trim", *params.Trim) - } - if params != nil && params.CallerId != nil { - data.Set("CallerId", *params.CallerId) - } - if params != nil && params.MachineDetectionSpeechThreshold != nil { - data.Set("MachineDetectionSpeechThreshold", fmt.Sprint(*params.MachineDetectionSpeechThreshold)) - } - if params != nil && params.MachineDetectionSpeechEndThreshold != nil { - data.Set("MachineDetectionSpeechEndThreshold", fmt.Sprint(*params.MachineDetectionSpeechEndThreshold)) - } - if params != nil && params.MachineDetectionSilenceTimeout != nil { - data.Set("MachineDetectionSilenceTimeout", fmt.Sprint(*params.MachineDetectionSilenceTimeout)) - } - if params != nil && params.AsyncAmd != nil { - data.Set("AsyncAmd", *params.AsyncAmd) - } - if params != nil && params.AsyncAmdStatusCallback != nil { - data.Set("AsyncAmdStatusCallback", *params.AsyncAmdStatusCallback) - } - if params != nil && params.AsyncAmdStatusCallbackMethod != nil { - data.Set("AsyncAmdStatusCallbackMethod", *params.AsyncAmdStatusCallbackMethod) - } - if params != nil && params.Byoc != nil { - data.Set("Byoc", *params.Byoc) - } - if params != nil && params.CallReason != nil { - data.Set("CallReason", *params.CallReason) - } - if params != nil && params.CallToken != nil { - data.Set("CallToken", *params.CallToken) - } - if params != nil && params.RecordingTrack != nil { - data.Set("RecordingTrack", *params.RecordingTrack) - } - if params != nil && params.TimeLimit != nil { - data.Set("TimeLimit", fmt.Sprint(*params.TimeLimit)) - } - if params != nil && params.Url != nil { - data.Set("Url", *params.Url) - } - if params != nil && params.Twiml != nil { - data.Set("Twiml", *params.Twiml) - } - if params != nil && params.ApplicationSid != nil { - data.Set("ApplicationSid", *params.ApplicationSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Call{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Method != nil { + data.Set("Method", *params.Method) + } + if params != nil && params.FallbackUrl != nil { + data.Set("FallbackUrl", *params.FallbackUrl) + } + if params != nil && params.FallbackMethod != nil { + data.Set("FallbackMethod", *params.FallbackMethod) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackEvent != nil { + for _, item := range *params.StatusCallbackEvent { + data.Add("StatusCallbackEvent", item) + } + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.SendDigits != nil { + data.Set("SendDigits", *params.SendDigits) + } + if params != nil && params.Timeout != nil { + data.Set("Timeout", fmt.Sprint(*params.Timeout)) + } + if params != nil && params.Record != nil { + data.Set("Record", fmt.Sprint(*params.Record)) + } + if params != nil && params.RecordingChannels != nil { + data.Set("RecordingChannels", *params.RecordingChannels) + } + if params != nil && params.RecordingStatusCallback != nil { + data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) + } + if params != nil && params.RecordingStatusCallbackMethod != nil { + data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) + } + if params != nil && params.SipAuthUsername != nil { + data.Set("SipAuthUsername", *params.SipAuthUsername) + } + if params != nil && params.SipAuthPassword != nil { + data.Set("SipAuthPassword", *params.SipAuthPassword) + } + if params != nil && params.MachineDetection != nil { + data.Set("MachineDetection", *params.MachineDetection) + } + if params != nil && params.MachineDetectionTimeout != nil { + data.Set("MachineDetectionTimeout", fmt.Sprint(*params.MachineDetectionTimeout)) + } + if params != nil && params.RecordingStatusCallbackEvent != nil { + for _, item := range *params.RecordingStatusCallbackEvent { + data.Add("RecordingStatusCallbackEvent", item) + } + } + if params != nil && params.Trim != nil { + data.Set("Trim", *params.Trim) + } + if params != nil && params.CallerId != nil { + data.Set("CallerId", *params.CallerId) + } + if params != nil && params.MachineDetectionSpeechThreshold != nil { + data.Set("MachineDetectionSpeechThreshold", fmt.Sprint(*params.MachineDetectionSpeechThreshold)) + } + if params != nil && params.MachineDetectionSpeechEndThreshold != nil { + data.Set("MachineDetectionSpeechEndThreshold", fmt.Sprint(*params.MachineDetectionSpeechEndThreshold)) + } + if params != nil && params.MachineDetectionSilenceTimeout != nil { + data.Set("MachineDetectionSilenceTimeout", fmt.Sprint(*params.MachineDetectionSilenceTimeout)) + } + if params != nil && params.AsyncAmd != nil { + data.Set("AsyncAmd", *params.AsyncAmd) + } + if params != nil && params.AsyncAmdStatusCallback != nil { + data.Set("AsyncAmdStatusCallback", *params.AsyncAmdStatusCallback) + } + if params != nil && params.AsyncAmdStatusCallbackMethod != nil { + data.Set("AsyncAmdStatusCallbackMethod", *params.AsyncAmdStatusCallbackMethod) + } + if params != nil && params.Byoc != nil { + data.Set("Byoc", *params.Byoc) + } + if params != nil && params.CallReason != nil { + data.Set("CallReason", *params.CallReason) + } + if params != nil && params.CallToken != nil { + data.Set("CallToken", *params.CallToken) + } + if params != nil && params.RecordingTrack != nil { + data.Set("RecordingTrack", *params.RecordingTrack) + } + if params != nil && params.TimeLimit != nil { + data.Set("TimeLimit", fmt.Sprint(*params.TimeLimit)) + } + if params != nil && params.Url != nil { + data.Set("Url", *params.Url) + } + if params != nil && params.Twiml != nil { + data.Set("Twiml", *params.Twiml) + } + if params != nil && params.ApplicationSid != nil { + data.Set("ApplicationSid", *params.ApplicationSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Call{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteCall' type DeleteCallParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteCallParams) SetPathAccountSid(PathAccountSid string) *DeleteCallParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteCallParams) SetPathAccountSid(PathAccountSid string) (*DeleteCallParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a Call record from your account. Once the record is deleted, it will no longer appear in the API and Account Portal logs. -func (c *ApiService) DeleteCall(Sid string, params *DeleteCallParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCall(Sid string, params *DeleteCallParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchCall' type FetchCallParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchCallParams) SetPathAccountSid(PathAccountSid string) *FetchCallParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchCallParams) SetPathAccountSid(PathAccountSid string) (*FetchCallParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch the call specified by the provided Call SID func (c *ApiService) FetchCall(Sid string, params *FetchCallParams) (*ApiV2010Call, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Call{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Call{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListCall' type ListCallParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Only show calls made to this phone number, SIP address, Client identifier or SIM SID. - To *string `json:"To,omitempty"` - // Only include calls from this phone number, SIP address, Client identifier or SIM SID. - From *string `json:"From,omitempty"` - // Only include calls spawned by calls with this SID. - ParentCallSid *string `json:"ParentCallSid,omitempty"` - // The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. - Status *string `json:"Status,omitempty"` - // Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - StartTime *time.Time `json:"StartTime,omitempty"` - // Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - StartTimeBefore *time.Time `json:"StartTime<,omitempty"` - // Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - StartTimeAfter *time.Time `json:"StartTime>,omitempty"` - // Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - EndTime *time.Time `json:"EndTime,omitempty"` - // Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - EndTimeBefore *time.Time `json:"EndTime<,omitempty"` - // Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - EndTimeAfter *time.Time `json:"EndTime>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListCallParams) SetPathAccountSid(PathAccountSid string) *ListCallParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListCallParams) SetTo(To string) *ListCallParams { - params.To = &To - return params -} -func (params *ListCallParams) SetFrom(From string) *ListCallParams { - params.From = &From - return params -} -func (params *ListCallParams) SetParentCallSid(ParentCallSid string) *ListCallParams { - params.ParentCallSid = &ParentCallSid - return params -} -func (params *ListCallParams) SetStatus(Status string) *ListCallParams { - params.Status = &Status - return params -} -func (params *ListCallParams) SetStartTime(StartTime time.Time) *ListCallParams { - params.StartTime = &StartTime - return params -} -func (params *ListCallParams) SetStartTimeBefore(StartTimeBefore time.Time) *ListCallParams { - params.StartTimeBefore = &StartTimeBefore - return params -} -func (params *ListCallParams) SetStartTimeAfter(StartTimeAfter time.Time) *ListCallParams { - params.StartTimeAfter = &StartTimeAfter - return params -} -func (params *ListCallParams) SetEndTime(EndTime time.Time) *ListCallParams { - params.EndTime = &EndTime - return params -} -func (params *ListCallParams) SetEndTimeBefore(EndTimeBefore time.Time) *ListCallParams { - params.EndTimeBefore = &EndTimeBefore - return params -} -func (params *ListCallParams) SetEndTimeAfter(EndTimeAfter time.Time) *ListCallParams { - params.EndTimeAfter = &EndTimeAfter - return params -} -func (params *ListCallParams) SetPageSize(PageSize int) *ListCallParams { - params.PageSize = &PageSize - return params -} -func (params *ListCallParams) SetLimit(Limit int) *ListCallParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Only show calls made to this phone number, SIP address, Client identifier or SIM SID. + To *string `json:"To,omitempty"` + // Only include calls from this phone number, SIP address, Client identifier or SIM SID. + From *string `json:"From,omitempty"` + // Only include calls spawned by calls with this SID. + ParentCallSid *string `json:"ParentCallSid,omitempty"` + // The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. + Status *string `json:"Status,omitempty"` + // Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. + StartTime *time.Time `json:"StartTime,omitempty"` + // Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. + EndTime *time.Time `json:"EndTime,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListCallParams) SetPathAccountSid(PathAccountSid string) (*ListCallParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListCallParams) SetTo(To string) (*ListCallParams){ + params.To = &To + return params +} +func (params *ListCallParams) SetFrom(From string) (*ListCallParams){ + params.From = &From + return params +} +func (params *ListCallParams) SetParentCallSid(ParentCallSid string) (*ListCallParams){ + params.ParentCallSid = &ParentCallSid + return params +} +func (params *ListCallParams) SetStatus(Status string) (*ListCallParams){ + params.Status = &Status + return params +} +func (params *ListCallParams) SetStartTime(StartTime time.Time) (*ListCallParams){ + params.StartTime = &StartTime + return params +} +func (params *ListCallParams) SetEndTime(EndTime time.Time) (*ListCallParams){ + params.EndTime = &EndTime + return params +} +func (params *ListCallParams) SetPageSize(PageSize int) (*ListCallParams){ + params.PageSize = &PageSize + return params +} +func (params *ListCallParams) SetLimit(Limit int) (*ListCallParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Call records from the API. Request is executed immediately. -func (c *ApiService) PageCall(params *ListCallParams, pageToken, pageNumber string) (*ListCallResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.ParentCallSid != nil { - data.Set("ParentCallSid", *params.ParentCallSid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.StartTime != nil { - data.Set("StartTime", fmt.Sprint((*params.StartTime).Format(time.RFC3339))) - } - if params != nil && params.StartTimeBefore != nil { - data.Set("StartTime<", fmt.Sprint((*params.StartTimeBefore).Format(time.RFC3339))) - } - if params != nil && params.StartTimeAfter != nil { - data.Set("StartTime>", fmt.Sprint((*params.StartTimeAfter).Format(time.RFC3339))) - } - if params != nil && params.EndTime != nil { - data.Set("EndTime", fmt.Sprint((*params.EndTime).Format(time.RFC3339))) - } - if params != nil && params.EndTimeBefore != nil { - data.Set("EndTime<", fmt.Sprint((*params.EndTimeBefore).Format(time.RFC3339))) - } - if params != nil && params.EndTimeAfter != nil { - data.Set("EndTime>", fmt.Sprint((*params.EndTimeAfter).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCallResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageCall(params *ListCallParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.ParentCallSid != nil { + data.Set("ParentCallSid", *params.ParentCallSid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.StartTime != nil { + data.Set("StartTime", fmt.Sprint((*params.StartTime).Format(time.RFC3339))) + } + if params != nil && params.EndTime != nil { + data.Set("EndTime", fmt.Sprint((*params.EndTime).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Call records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListCall(params *ListCallParams) ([]ApiV2010Call, error) { +func (c *ApiService) ListCall(params *ListCallParams) (ListCall200Response, error) { response, errors := c.StreamCall(params) - records := make([]ApiV2010Call, 0) + records := make(ListCall200Response, 0) for record := range response { records = append(records, record) } @@ -624,13 +592,13 @@ func (c *ApiService) ListCall(params *ListCallParams) ([]ApiV2010Call, error) { } // Streams Call records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamCall(params *ListCallParams) (chan ApiV2010Call, chan error) { +func (c *ApiService) StreamCall(params *ListCallParams) (chan ListCall200Response, chan error) { if params == nil { params = &ListCallParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Call, 1) + recordChannel := make(chan ListCall200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageCall(params, "", "") @@ -645,11 +613,12 @@ func (c *ApiService) StreamCall(params *ListCallParams) (chan ApiV2010Call, chan return recordChannel, errorChannel } -func (c *ApiService) streamCall(response *ListCallResponse, params *ListCallParams, recordChannel chan ApiV2010Call, errorChannel chan error) { + +func (c *ApiService) streamCall(response *, params *ListCallParams, recordChannel chan ListCall200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Calls + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -660,7 +629,7 @@ func (c *ApiService) streamCall(response *ListCallResponse, params *ListCallPara } } - record, err := client.GetNext(c.baseURL, response, c.getNextListCallResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -668,148 +637,150 @@ func (c *ApiService) streamCall(response *ListCallResponse, params *ListCallPara break } - response = record.(*ListCallResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListCallResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCallResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCall' type UpdateCallParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). - Url *string `json:"Url,omitempty"` - // The HTTP method we should use when calling the `url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - Method *string `json:"Method,omitempty"` - // - Status *string `json:"Status,omitempty"` - // The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. - FallbackUrl *string `json:"FallbackUrl,omitempty"` - // The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - FallbackMethod *string `json:"FallbackMethod,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use when requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive - Twiml *string `json:"Twiml,omitempty"` - // The maximum duration of the call in seconds. Constraints depend on account and configuration. - TimeLimit *int `json:"TimeLimit,omitempty"` -} - -func (params *UpdateCallParams) SetPathAccountSid(PathAccountSid string) *UpdateCallParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *UpdateCallParams) SetUrl(Url string) *UpdateCallParams { - params.Url = &Url - return params -} -func (params *UpdateCallParams) SetMethod(Method string) *UpdateCallParams { - params.Method = &Method - return params -} -func (params *UpdateCallParams) SetStatus(Status string) *UpdateCallParams { - params.Status = &Status - return params -} -func (params *UpdateCallParams) SetFallbackUrl(FallbackUrl string) *UpdateCallParams { - params.FallbackUrl = &FallbackUrl - return params -} -func (params *UpdateCallParams) SetFallbackMethod(FallbackMethod string) *UpdateCallParams { - params.FallbackMethod = &FallbackMethod - return params -} -func (params *UpdateCallParams) SetStatusCallback(StatusCallback string) *UpdateCallParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *UpdateCallParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateCallParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *UpdateCallParams) SetTwiml(Twiml string) *UpdateCallParams { - params.Twiml = &Twiml - return params -} -func (params *UpdateCallParams) SetTimeLimit(TimeLimit int) *UpdateCallParams { - params.TimeLimit = &TimeLimit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call resource(s) to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). + Url *string `json:"Url,omitempty"` + // The HTTP method we should use when calling the `url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. + Method *string `json:"Method,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. + FallbackUrl *string `json:"FallbackUrl,omitempty"` + // The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. + FallbackMethod *string `json:"FallbackMethod,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use when requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive + Twiml *string `json:"Twiml,omitempty"` + // The maximum duration of the call in seconds. Constraints depend on account and configuration. + TimeLimit *int `json:"TimeLimit,omitempty"` +} + +func (params *UpdateCallParams) SetPathAccountSid(PathAccountSid string) (*UpdateCallParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *UpdateCallParams) SetUrl(Url string) (*UpdateCallParams){ + params.Url = &Url + return params +} +func (params *UpdateCallParams) SetMethod(Method string) (*UpdateCallParams){ + params.Method = &Method + return params +} +func (params *UpdateCallParams) SetStatus(Status string) (*UpdateCallParams){ + params.Status = &Status + return params +} +func (params *UpdateCallParams) SetFallbackUrl(FallbackUrl string) (*UpdateCallParams){ + params.FallbackUrl = &FallbackUrl + return params +} +func (params *UpdateCallParams) SetFallbackMethod(FallbackMethod string) (*UpdateCallParams){ + params.FallbackMethod = &FallbackMethod + return params +} +func (params *UpdateCallParams) SetStatusCallback(StatusCallback string) (*UpdateCallParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *UpdateCallParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateCallParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *UpdateCallParams) SetTwiml(Twiml string) (*UpdateCallParams){ + params.Twiml = &Twiml + return params +} +func (params *UpdateCallParams) SetTimeLimit(TimeLimit int) (*UpdateCallParams){ + params.TimeLimit = &TimeLimit + return params } // Initiates a call redirect or terminates a call func (c *ApiService) UpdateCall(Sid string, params *UpdateCallParams) (*ApiV2010Call, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Url != nil { - data.Set("Url", *params.Url) - } - if params != nil && params.Method != nil { - data.Set("Method", *params.Method) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.FallbackUrl != nil { - data.Set("FallbackUrl", *params.FallbackUrl) - } - if params != nil && params.FallbackMethod != nil { - data.Set("FallbackMethod", *params.FallbackMethod) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.Twiml != nil { - data.Set("Twiml", *params.Twiml) - } - if params != nil && params.TimeLimit != nil { - data.Set("TimeLimit", fmt.Sprint(*params.TimeLimit)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Call{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Url != nil { + data.Set("Url", *params.Url) + } + if params != nil && params.Method != nil { + data.Set("Method", *params.Method) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.FallbackUrl != nil { + data.Set("FallbackUrl", *params.FallbackUrl) + } + if params != nil && params.FallbackMethod != nil { + data.Set("FallbackMethod", *params.FallbackMethod) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.Twiml != nil { + data.Set("Twiml", *params.Twiml) + } + if params != nil && params.TimeLimit != nil { + data.Set("TimeLimit", fmt.Sprint(*params.TimeLimit)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Call{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_calls_events.go b/rest/api/v2010/accounts_calls_events.go index 07ce9789a..3547168c4 100644 --- a/rest/api/v2010/accounts_calls_events.go +++ b/rest/api/v2010/accounts_calls_events.go @@ -18,79 +18,79 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListCallEvent' type ListCallEventParams struct { - // The unique SID identifier of the Account. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique SID identifier of the Account. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCallEventParams) SetPathAccountSid(PathAccountSid string) *ListCallEventParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListCallEventParams) SetPathAccountSid(PathAccountSid string) (*ListCallEventParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListCallEventParams) SetPageSize(PageSize int) *ListCallEventParams { - params.PageSize = &PageSize - return params +func (params *ListCallEventParams) SetPageSize(PageSize int) (*ListCallEventParams){ + params.PageSize = &PageSize + return params } -func (params *ListCallEventParams) SetLimit(Limit int) *ListCallEventParams { - params.Limit = &Limit - return params +func (params *ListCallEventParams) SetLimit(Limit int) (*ListCallEventParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CallEvent records from the API. Request is executed immediately. -func (c *ApiService) PageCallEvent(CallSid string, params *ListCallEventParams, pageToken, pageNumber string) (*ListCallEventResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Events.json" +func (c *ApiService) PageCallEvent(CallSid string, params *ListCallEventParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Events.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCallEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CallEvent records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListCallEvent(CallSid string, params *ListCallEventParams) ([]ApiV2010CallEvent, error) { +func (c *ApiService) ListCallEvent(CallSid string, params *ListCallEventParams) (ListCallEvent200Response, error) { response, errors := c.StreamCallEvent(CallSid, params) - records := make([]ApiV2010CallEvent, 0) + records := make(ListCallEvent200Response, 0) for record := range response { records = append(records, record) } @@ -103,13 +103,13 @@ func (c *ApiService) ListCallEvent(CallSid string, params *ListCallEventParams) } // Streams CallEvent records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamCallEvent(CallSid string, params *ListCallEventParams) (chan ApiV2010CallEvent, chan error) { +func (c *ApiService) StreamCallEvent(CallSid string, params *ListCallEventParams) (chan ListCallEvent200Response, chan error) { if params == nil { params = &ListCallEventParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010CallEvent, 1) + recordChannel := make(chan ListCallEvent200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageCallEvent(CallSid, params, "", "") @@ -124,11 +124,12 @@ func (c *ApiService) StreamCallEvent(CallSid string, params *ListCallEventParams return recordChannel, errorChannel } -func (c *ApiService) streamCallEvent(response *ListCallEventResponse, params *ListCallEventParams, recordChannel chan ApiV2010CallEvent, errorChannel chan error) { + +func (c *ApiService) streamCallEvent(response *, params *ListCallEventParams, recordChannel chan ListCallEvent200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Events + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -139,7 +140,7 @@ func (c *ApiService) streamCallEvent(response *ListCallEventResponse, params *Li } } - record, err := client.GetNext(c.baseURL, response, c.getNextListCallEventResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -147,27 +148,28 @@ func (c *ApiService) streamCallEvent(response *ListCallEventResponse, params *Li break } - response = record.(*ListCallEventResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListCallEventResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCallEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_calls_feedback.go b/rest/api/v2010/accounts_calls_feedback.go index 93e2b9a43..e0b56a7b1 100644 --- a/rest/api/v2010/accounts_calls_feedback.go +++ b/rest/api/v2010/accounts_calls_feedback.go @@ -18,104 +18,109 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchCallFeedback' type FetchCallFeedbackParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchCallFeedbackParams) SetPathAccountSid(PathAccountSid string) *FetchCallFeedbackParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchCallFeedbackParams) SetPathAccountSid(PathAccountSid string) (*FetchCallFeedbackParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a Feedback resource from a call func (c *ApiService) FetchCallFeedback(CallSid string, params *FetchCallFeedbackParams) (*ApiV2010CallFeedback, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Feedback.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010CallFeedback{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Feedback.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010CallFeedback{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateCallFeedback' type UpdateCallFeedbackParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. - QualityScore *int `json:"QualityScore,omitempty"` - // One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - Issue *[]string `json:"Issue,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. + QualityScore *int `json:"QualityScore,omitempty"` + // One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. + Issue *[]string `json:"Issue,omitempty"` } -func (params *UpdateCallFeedbackParams) SetPathAccountSid(PathAccountSid string) *UpdateCallFeedbackParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateCallFeedbackParams) SetPathAccountSid(PathAccountSid string) (*UpdateCallFeedbackParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateCallFeedbackParams) SetQualityScore(QualityScore int) *UpdateCallFeedbackParams { - params.QualityScore = &QualityScore - return params +func (params *UpdateCallFeedbackParams) SetQualityScore(QualityScore int) (*UpdateCallFeedbackParams){ + params.QualityScore = &QualityScore + return params } -func (params *UpdateCallFeedbackParams) SetIssue(Issue []string) *UpdateCallFeedbackParams { - params.Issue = &Issue - return params +func (params *UpdateCallFeedbackParams) SetIssue(Issue []string) (*UpdateCallFeedbackParams){ + params.Issue = &Issue + return params } // Update a Feedback resource for a call func (c *ApiService) UpdateCallFeedback(CallSid string, params *UpdateCallFeedbackParams) (*ApiV2010CallFeedback, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Feedback.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.QualityScore != nil { - data.Set("QualityScore", fmt.Sprint(*params.QualityScore)) - } - if params != nil && params.Issue != nil { - for _, item := range *params.Issue { - data.Add("Issue", item) - } - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010CallFeedback{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Feedback.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.QualityScore != nil { + data.Set("QualityScore", fmt.Sprint(*params.QualityScore)) + } + if params != nil && params.Issue != nil { + for _, item := range *params.Issue { + data.Add("Issue", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010CallFeedback{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_calls_feedback_summary.go b/rest/api/v2010/accounts_calls_feedback_summary.go index 0cdef1d54..8d1689555 100644 --- a/rest/api/v2010/accounts_calls_feedback_summary.go +++ b/rest/api/v2010/accounts_calls_feedback_summary.go @@ -18,162 +18,169 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCallFeedbackSummary' type CreateCallFeedbackSummaryParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Only include feedback given on or after this date. Format is `YYYY-MM-DD` and specified in UTC. - StartDate *string `json:"StartDate,omitempty"` - // Only include feedback given on or before this date. Format is `YYYY-MM-DD` and specified in UTC. - EndDate *string `json:"EndDate,omitempty"` - // Whether to also include Feedback resources from all subaccounts. `true` includes feedback from all subaccounts and `false`, the default, includes feedback from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // The URL that we will request when the feedback summary is complete. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method (`GET` or `POST`) we use to make the request to the `StatusCallback` URL. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Only include feedback given on or after this date. Format is `YYYY-MM-DD` and specified in UTC. + StartDate *string `json:"StartDate,omitempty"` + // Only include feedback given on or before this date. Format is `YYYY-MM-DD` and specified in UTC. + EndDate *string `json:"EndDate,omitempty"` + // Whether to also include Feedback resources from all subaccounts. `true` includes feedback from all subaccounts and `false`, the default, includes feedback from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // The URL that we will request when the feedback summary is complete. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method (`GET` or `POST`) we use to make the request to the `StatusCallback` URL. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` } -func (params *CreateCallFeedbackSummaryParams) SetPathAccountSid(PathAccountSid string) *CreateCallFeedbackSummaryParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateCallFeedbackSummaryParams) SetPathAccountSid(PathAccountSid string) (*CreateCallFeedbackSummaryParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateCallFeedbackSummaryParams) SetStartDate(StartDate string) *CreateCallFeedbackSummaryParams { - params.StartDate = &StartDate - return params +func (params *CreateCallFeedbackSummaryParams) SetStartDate(StartDate string) (*CreateCallFeedbackSummaryParams){ + params.StartDate = &StartDate + return params } -func (params *CreateCallFeedbackSummaryParams) SetEndDate(EndDate string) *CreateCallFeedbackSummaryParams { - params.EndDate = &EndDate - return params +func (params *CreateCallFeedbackSummaryParams) SetEndDate(EndDate string) (*CreateCallFeedbackSummaryParams){ + params.EndDate = &EndDate + return params } -func (params *CreateCallFeedbackSummaryParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *CreateCallFeedbackSummaryParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *CreateCallFeedbackSummaryParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*CreateCallFeedbackSummaryParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *CreateCallFeedbackSummaryParams) SetStatusCallback(StatusCallback string) *CreateCallFeedbackSummaryParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateCallFeedbackSummaryParams) SetStatusCallback(StatusCallback string) (*CreateCallFeedbackSummaryParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreateCallFeedbackSummaryParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateCallFeedbackSummaryParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *CreateCallFeedbackSummaryParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateCallFeedbackSummaryParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } // Create a FeedbackSummary resource for a call func (c *ApiService) CreateCallFeedbackSummary(params *CreateCallFeedbackSummaryParams) (*ApiV2010CallFeedbackSummary, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/FeedbackSummary.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010CallFeedbackSummary{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/FeedbackSummary.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010CallFeedbackSummary{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteCallFeedbackSummary' type DeleteCallFeedbackSummaryParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteCallFeedbackSummaryParams) SetPathAccountSid(PathAccountSid string) *DeleteCallFeedbackSummaryParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteCallFeedbackSummaryParams) SetPathAccountSid(PathAccountSid string) (*DeleteCallFeedbackSummaryParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a FeedbackSummary resource from a call -func (c *ApiService) DeleteCallFeedbackSummary(Sid string, params *DeleteCallFeedbackSummaryParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/FeedbackSummary/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCallFeedbackSummary(Sid string, params *DeleteCallFeedbackSummaryParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/FeedbackSummary/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchCallFeedbackSummary' type FetchCallFeedbackSummaryParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchCallFeedbackSummaryParams) SetPathAccountSid(PathAccountSid string) *FetchCallFeedbackSummaryParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchCallFeedbackSummaryParams) SetPathAccountSid(PathAccountSid string) (*FetchCallFeedbackSummaryParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a FeedbackSummary resource from a call func (c *ApiService) FetchCallFeedbackSummary(Sid string, params *FetchCallFeedbackSummaryParams) (*ApiV2010CallFeedbackSummary, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/FeedbackSummary/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010CallFeedbackSummary{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/FeedbackSummary/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010CallFeedbackSummary{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_calls_notifications.go b/rest/api/v2010/accounts_calls_notifications.go index 4004ae82b..b2a9346b8 100644 --- a/rest/api/v2010/accounts_calls_notifications.go +++ b/rest/api/v2010/accounts_calls_notifications.go @@ -18,155 +18,157 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchCallNotification' type FetchCallNotificationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchCallNotificationParams) SetPathAccountSid(PathAccountSid string) *FetchCallNotificationParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchCallNotificationParams) SetPathAccountSid(PathAccountSid string) (*FetchCallNotificationParams){ + params.PathAccountSid = &PathAccountSid + return params } -// +// func (c *ApiService) FetchCallNotification(CallSid string, Sid string, params *FetchCallNotificationParams) (*ApiV2010CallNotificationInstance, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Notifications/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Notifications/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010CallNotificationInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010CallNotificationInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCallNotification' type ListCallNotificationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. - Log *int `json:"Log,omitempty"` - // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. - MessageDate *string `json:"MessageDate,omitempty"` - // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. - MessageDateBefore *string `json:"MessageDate<,omitempty"` - // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. - MessageDateAfter *string `json:"MessageDate>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListCallNotificationParams) SetPathAccountSid(PathAccountSid string) *ListCallNotificationParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListCallNotificationParams) SetLog(Log int) *ListCallNotificationParams { - params.Log = &Log - return params -} -func (params *ListCallNotificationParams) SetMessageDate(MessageDate string) *ListCallNotificationParams { - params.MessageDate = &MessageDate - return params -} -func (params *ListCallNotificationParams) SetMessageDateBefore(MessageDateBefore string) *ListCallNotificationParams { - params.MessageDateBefore = &MessageDateBefore - return params -} -func (params *ListCallNotificationParams) SetMessageDateAfter(MessageDateAfter string) *ListCallNotificationParams { - params.MessageDateAfter = &MessageDateAfter - return params -} -func (params *ListCallNotificationParams) SetPageSize(PageSize int) *ListCallNotificationParams { - params.PageSize = &PageSize - return params -} -func (params *ListCallNotificationParams) SetLimit(Limit int) *ListCallNotificationParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. + Log *int `json:"Log,omitempty"` + // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. + MessageDate *string `json:"MessageDate,omitempty"` + // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. + MessageDateBefore *string `json:"MessageDate<,omitempty"` + // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. + MessageDateAfter *string `json:"MessageDate>,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListCallNotificationParams) SetPathAccountSid(PathAccountSid string) (*ListCallNotificationParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListCallNotificationParams) SetLog(Log int) (*ListCallNotificationParams){ + params.Log = &Log + return params +} +func (params *ListCallNotificationParams) SetMessageDate(MessageDate string) (*ListCallNotificationParams){ + params.MessageDate = &MessageDate + return params +} +func (params *ListCallNotificationParams) SetMessageDateBefore(MessageDateBefore string) (*ListCallNotificationParams){ + params.MessageDateBefore = &MessageDateBefore + return params +} +func (params *ListCallNotificationParams) SetMessageDateAfter(MessageDateAfter string) (*ListCallNotificationParams){ + params.MessageDateAfter = &MessageDateAfter + return params +} +func (params *ListCallNotificationParams) SetPageSize(PageSize int) (*ListCallNotificationParams){ + params.PageSize = &PageSize + return params +} +func (params *ListCallNotificationParams) SetLimit(Limit int) (*ListCallNotificationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CallNotification records from the API. Request is executed immediately. -func (c *ApiService) PageCallNotification(CallSid string, params *ListCallNotificationParams, pageToken, pageNumber string) (*ListCallNotificationResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Notifications.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Log != nil { - data.Set("Log", fmt.Sprint(*params.Log)) - } - if params != nil && params.MessageDate != nil { - data.Set("MessageDate", fmt.Sprint(*params.MessageDate)) - } - if params != nil && params.MessageDateBefore != nil { - data.Set("MessageDate<", fmt.Sprint(*params.MessageDateBefore)) - } - if params != nil && params.MessageDateAfter != nil { - data.Set("MessageDate>", fmt.Sprint(*params.MessageDateAfter)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCallNotificationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageCallNotification(CallSid string, params *ListCallNotificationParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Notifications.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Log != nil { + data.Set("Log", fmt.Sprint(*params.Log)) + } + if params != nil && params.MessageDate != nil { + data.Set("MessageDate", fmt.Sprint(*params.MessageDate)) + } + if params != nil && params.MessageDateBefore != nil { + data.Set("MessageDate<", fmt.Sprint(*params.MessageDateBefore)) + } + if params != nil && params.MessageDateAfter != nil { + data.Set("MessageDate>", fmt.Sprint(*params.MessageDateAfter)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists CallNotification records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListCallNotification(CallSid string, params *ListCallNotificationParams) ([]ApiV2010CallNotification, error) { +func (c *ApiService) ListCallNotification(CallSid string, params *ListCallNotificationParams) (ListCallNotification200Response, error) { response, errors := c.StreamCallNotification(CallSid, params) - records := make([]ApiV2010CallNotification, 0) + records := make(ListCallNotification200Response, 0) for record := range response { records = append(records, record) } @@ -179,13 +181,13 @@ func (c *ApiService) ListCallNotification(CallSid string, params *ListCallNotifi } // Streams CallNotification records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamCallNotification(CallSid string, params *ListCallNotificationParams) (chan ApiV2010CallNotification, chan error) { +func (c *ApiService) StreamCallNotification(CallSid string, params *ListCallNotificationParams) (chan ListCallNotification200Response, chan error) { if params == nil { params = &ListCallNotificationParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010CallNotification, 1) + recordChannel := make(chan ListCallNotification200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageCallNotification(CallSid, params, "", "") @@ -200,11 +202,12 @@ func (c *ApiService) StreamCallNotification(CallSid string, params *ListCallNoti return recordChannel, errorChannel } -func (c *ApiService) streamCallNotification(response *ListCallNotificationResponse, params *ListCallNotificationParams, recordChannel chan ApiV2010CallNotification, errorChannel chan error) { + +func (c *ApiService) streamCallNotification(response *, params *ListCallNotificationParams, recordChannel chan ListCallNotification200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Notifications + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -215,7 +218,7 @@ func (c *ApiService) streamCallNotification(response *ListCallNotificationRespon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListCallNotificationResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -223,27 +226,28 @@ func (c *ApiService) streamCallNotification(response *ListCallNotificationRespon break } - response = record.(*ListCallNotificationResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListCallNotificationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCallNotificationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_calls_payments.go b/rest/api/v2010/accounts_calls_payments.go index 82e68055c..1892ab353 100644 --- a/rest/api/v2010/accounts_calls_payments.go +++ b/rest/api/v2010/accounts_calls_payments.go @@ -18,272 +18,276 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePayments' type CreatePaymentsParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. - IdempotencyKey *string `json:"IdempotencyKey,omitempty"` - // Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [expected StatusCallback values](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback) - StatusCallback *string `json:"StatusCallback,omitempty"` - // - BankAccountType *string `json:"BankAccountType,omitempty"` - // A positive decimal value less than 1,000,000 to charge against the credit card or bank account. Default currency can be overwritten with `currency` field. Leave blank or set to 0 to tokenize. - ChargeAmount *float32 `json:"ChargeAmount,omitempty"` - // The currency of the `charge_amount`, formatted as [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format. The default value is `USD` and all values allowed from the Pay Connector are accepted. - Currency *string `json:"Currency,omitempty"` - // The description can be used to provide more details regarding the transaction. This information is submitted along with the payment details to the Payment Connector which are then posted on the transactions. - Description *string `json:"Description,omitempty"` - // A list of inputs that should be accepted. Currently only `dtmf` is supported. All digits captured during a pay session are redacted from the logs. - Input *string `json:"Input,omitempty"` - // A positive integer that is used to validate the length of the `PostalCode` inputted by the user. User must enter this many digits. - MinPostalCodeLength *int `json:"MinPostalCodeLength,omitempty"` - // A single-level JSON object used to pass custom parameters to payment processors. (Required for ACH payments). The information that has to be included here depends on the Connector. [Read more](https://www.twilio.com/console/voice/pay-connectors). - Parameter *interface{} `json:"Parameter,omitempty"` - // This is the unique name corresponding to the Pay Connector installed in the Twilio Add-ons. Learn more about [ Connectors](https://www.twilio.com/console/voice/pay-connectors). The default value is `Default`. - PaymentConnector *string `json:"PaymentConnector,omitempty"` - // - PaymentMethod *string `json:"PaymentMethod,omitempty"` - // Indicates whether the credit card postal code (zip code) is a required piece of payment information that must be provided by the caller. The default is `true`. - PostalCode *bool `json:"PostalCode,omitempty"` - // Indicates whether the credit card security code is a required piece of payment information that must be provided by the caller. The default is `true`. - SecurityCode *bool `json:"SecurityCode,omitempty"` - // The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. - Timeout *int `json:"Timeout,omitempty"` - // - TokenType *string `json:"TokenType,omitempty"` - // Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` - ValidCardTypes *string `json:"ValidCardTypes,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. + IdempotencyKey *string `json:"IdempotencyKey,omitempty"` + // Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [expected StatusCallback values](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback) + StatusCallback *string `json:"StatusCallback,omitempty"` + // + BankAccountType *string `json:"BankAccountType,omitempty"` + // A positive decimal value less than 1,000,000 to charge against the credit card or bank account. Default currency can be overwritten with `currency` field. Leave blank or set to 0 to tokenize. + ChargeAmount *float32 `json:"ChargeAmount,omitempty"` + // The currency of the `charge_amount`, formatted as [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format. The default value is `USD` and all values allowed from the Pay Connector are accepted. + Currency *string `json:"Currency,omitempty"` + // The description can be used to provide more details regarding the transaction. This information is submitted along with the payment details to the Payment Connector which are then posted on the transactions. + Description *string `json:"Description,omitempty"` + // A list of inputs that should be accepted. Currently only `dtmf` is supported. All digits captured during a pay session are redacted from the logs. + Input *string `json:"Input,omitempty"` + // A positive integer that is used to validate the length of the `PostalCode` inputted by the user. User must enter this many digits. + MinPostalCodeLength *int `json:"MinPostalCodeLength,omitempty"` + // A single-level JSON object used to pass custom parameters to payment processors. (Required for ACH payments). The information that has to be included here depends on the Connector. [Read more](https://www.twilio.com/console/voice/pay-connectors). + Parameter *interface{} `json:"Parameter,omitempty"` + // This is the unique name corresponding to the Pay Connector installed in the Twilio Add-ons. Learn more about [ Connectors](https://www.twilio.com/console/voice/pay-connectors). The default value is `Default`. + PaymentConnector *string `json:"PaymentConnector,omitempty"` + // + PaymentMethod *string `json:"PaymentMethod,omitempty"` + // Indicates whether the credit card postal code (zip code) is a required piece of payment information that must be provided by the caller. The default is `true`. + PostalCode *bool `json:"PostalCode,omitempty"` + // Indicates whether the credit card security code is a required piece of payment information that must be provided by the caller. The default is `true`. + SecurityCode *bool `json:"SecurityCode,omitempty"` + // The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. + Timeout *int `json:"Timeout,omitempty"` + // + TokenType *string `json:"TokenType,omitempty"` + // Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` + ValidCardTypes *string `json:"ValidCardTypes,omitempty"` } -func (params *CreatePaymentsParams) SetPathAccountSid(PathAccountSid string) *CreatePaymentsParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreatePaymentsParams) SetPathAccountSid(PathAccountSid string) (*CreatePaymentsParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreatePaymentsParams) SetIdempotencyKey(IdempotencyKey string) *CreatePaymentsParams { - params.IdempotencyKey = &IdempotencyKey - return params +func (params *CreatePaymentsParams) SetIdempotencyKey(IdempotencyKey string) (*CreatePaymentsParams){ + params.IdempotencyKey = &IdempotencyKey + return params } -func (params *CreatePaymentsParams) SetStatusCallback(StatusCallback string) *CreatePaymentsParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreatePaymentsParams) SetStatusCallback(StatusCallback string) (*CreatePaymentsParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreatePaymentsParams) SetBankAccountType(BankAccountType string) *CreatePaymentsParams { - params.BankAccountType = &BankAccountType - return params +func (params *CreatePaymentsParams) SetBankAccountType(BankAccountType string) (*CreatePaymentsParams){ + params.BankAccountType = &BankAccountType + return params } -func (params *CreatePaymentsParams) SetChargeAmount(ChargeAmount float32) *CreatePaymentsParams { - params.ChargeAmount = &ChargeAmount - return params +func (params *CreatePaymentsParams) SetChargeAmount(ChargeAmount float32) (*CreatePaymentsParams){ + params.ChargeAmount = &ChargeAmount + return params } -func (params *CreatePaymentsParams) SetCurrency(Currency string) *CreatePaymentsParams { - params.Currency = &Currency - return params +func (params *CreatePaymentsParams) SetCurrency(Currency string) (*CreatePaymentsParams){ + params.Currency = &Currency + return params } -func (params *CreatePaymentsParams) SetDescription(Description string) *CreatePaymentsParams { - params.Description = &Description - return params +func (params *CreatePaymentsParams) SetDescription(Description string) (*CreatePaymentsParams){ + params.Description = &Description + return params } -func (params *CreatePaymentsParams) SetInput(Input string) *CreatePaymentsParams { - params.Input = &Input - return params +func (params *CreatePaymentsParams) SetInput(Input string) (*CreatePaymentsParams){ + params.Input = &Input + return params } -func (params *CreatePaymentsParams) SetMinPostalCodeLength(MinPostalCodeLength int) *CreatePaymentsParams { - params.MinPostalCodeLength = &MinPostalCodeLength - return params +func (params *CreatePaymentsParams) SetMinPostalCodeLength(MinPostalCodeLength int) (*CreatePaymentsParams){ + params.MinPostalCodeLength = &MinPostalCodeLength + return params } -func (params *CreatePaymentsParams) SetParameter(Parameter interface{}) *CreatePaymentsParams { - params.Parameter = &Parameter - return params +func (params *CreatePaymentsParams) SetParameter(Parameter interface{}) (*CreatePaymentsParams){ + params.Parameter = &Parameter + return params } -func (params *CreatePaymentsParams) SetPaymentConnector(PaymentConnector string) *CreatePaymentsParams { - params.PaymentConnector = &PaymentConnector - return params +func (params *CreatePaymentsParams) SetPaymentConnector(PaymentConnector string) (*CreatePaymentsParams){ + params.PaymentConnector = &PaymentConnector + return params } -func (params *CreatePaymentsParams) SetPaymentMethod(PaymentMethod string) *CreatePaymentsParams { - params.PaymentMethod = &PaymentMethod - return params +func (params *CreatePaymentsParams) SetPaymentMethod(PaymentMethod string) (*CreatePaymentsParams){ + params.PaymentMethod = &PaymentMethod + return params } -func (params *CreatePaymentsParams) SetPostalCode(PostalCode bool) *CreatePaymentsParams { - params.PostalCode = &PostalCode - return params +func (params *CreatePaymentsParams) SetPostalCode(PostalCode bool) (*CreatePaymentsParams){ + params.PostalCode = &PostalCode + return params } -func (params *CreatePaymentsParams) SetSecurityCode(SecurityCode bool) *CreatePaymentsParams { - params.SecurityCode = &SecurityCode - return params +func (params *CreatePaymentsParams) SetSecurityCode(SecurityCode bool) (*CreatePaymentsParams){ + params.SecurityCode = &SecurityCode + return params } -func (params *CreatePaymentsParams) SetTimeout(Timeout int) *CreatePaymentsParams { - params.Timeout = &Timeout - return params +func (params *CreatePaymentsParams) SetTimeout(Timeout int) (*CreatePaymentsParams){ + params.Timeout = &Timeout + return params } -func (params *CreatePaymentsParams) SetTokenType(TokenType string) *CreatePaymentsParams { - params.TokenType = &TokenType - return params +func (params *CreatePaymentsParams) SetTokenType(TokenType string) (*CreatePaymentsParams){ + params.TokenType = &TokenType + return params } -func (params *CreatePaymentsParams) SetValidCardTypes(ValidCardTypes string) *CreatePaymentsParams { - params.ValidCardTypes = &ValidCardTypes - return params +func (params *CreatePaymentsParams) SetValidCardTypes(ValidCardTypes string) (*CreatePaymentsParams){ + params.ValidCardTypes = &ValidCardTypes + return params } // create an instance of payments. This will start a new payments session func (c *ApiService) CreatePayments(CallSid string, params *CreatePaymentsParams) (*ApiV2010Payments, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IdempotencyKey != nil { - data.Set("IdempotencyKey", *params.IdempotencyKey) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.BankAccountType != nil { - data.Set("BankAccountType", *params.BankAccountType) - } - if params != nil && params.ChargeAmount != nil { - data.Set("ChargeAmount", fmt.Sprint(*params.ChargeAmount)) - } - if params != nil && params.Currency != nil { - data.Set("Currency", *params.Currency) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.Input != nil { - data.Set("Input", *params.Input) - } - if params != nil && params.MinPostalCodeLength != nil { - data.Set("MinPostalCodeLength", fmt.Sprint(*params.MinPostalCodeLength)) - } - if params != nil && params.Parameter != nil { - v, err := json.Marshal(params.Parameter) + if params != nil && params.IdempotencyKey != nil { + data.Set("IdempotencyKey", *params.IdempotencyKey) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.BankAccountType != nil { + data.Set("BankAccountType", *params.BankAccountType) + } + if params != nil && params.ChargeAmount != nil { + data.Set("ChargeAmount", fmt.Sprint(*params.ChargeAmount)) + } + if params != nil && params.Currency != nil { + data.Set("Currency", *params.Currency) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.Input != nil { + data.Set("Input", *params.Input) + } + if params != nil && params.MinPostalCodeLength != nil { + data.Set("MinPostalCodeLength", fmt.Sprint(*params.MinPostalCodeLength)) + } + if params != nil && params.Parameter != nil { + v, err := json.Marshal(params.Parameter) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Parameter", string(v)) - } - if params != nil && params.PaymentConnector != nil { - data.Set("PaymentConnector", *params.PaymentConnector) - } - if params != nil && params.PaymentMethod != nil { - data.Set("PaymentMethod", *params.PaymentMethod) - } - if params != nil && params.PostalCode != nil { - data.Set("PostalCode", fmt.Sprint(*params.PostalCode)) - } - if params != nil && params.SecurityCode != nil { - data.Set("SecurityCode", fmt.Sprint(*params.SecurityCode)) - } - if params != nil && params.Timeout != nil { - data.Set("Timeout", fmt.Sprint(*params.Timeout)) - } - if params != nil && params.TokenType != nil { - data.Set("TokenType", *params.TokenType) - } - if params != nil && params.ValidCardTypes != nil { - data.Set("ValidCardTypes", *params.ValidCardTypes) - } + data.Set("Parameter", string(v)) + } + if params != nil && params.PaymentConnector != nil { + data.Set("PaymentConnector", *params.PaymentConnector) + } + if params != nil && params.PaymentMethod != nil { + data.Set("PaymentMethod", *params.PaymentMethod) + } + if params != nil && params.PostalCode != nil { + data.Set("PostalCode", fmt.Sprint(*params.PostalCode)) + } + if params != nil && params.SecurityCode != nil { + data.Set("SecurityCode", fmt.Sprint(*params.SecurityCode)) + } + if params != nil && params.Timeout != nil { + data.Set("Timeout", fmt.Sprint(*params.Timeout)) + } + if params != nil && params.TokenType != nil { + data.Set("TokenType", *params.TokenType) + } + if params != nil && params.ValidCardTypes != nil { + data.Set("ValidCardTypes", *params.ValidCardTypes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Payments{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Payments{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdatePayments' type UpdatePaymentsParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will update the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. - IdempotencyKey *string `json:"IdempotencyKey,omitempty"` - // Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [Update](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-update) and [Complete/Cancel](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-cancelcomplete) POST requests. - StatusCallback *string `json:"StatusCallback,omitempty"` - // - Capture *string `json:"Capture,omitempty"` - // - Status *string `json:"Status,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will update the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A unique token that will be used to ensure that multiple API calls with the same information do not result in multiple transactions. This should be a unique string value per API call and can be a randomly generated. + IdempotencyKey *string `json:"IdempotencyKey,omitempty"` + // Provide an absolute or relative URL to receive status updates regarding your Pay session. Read more about the [Update](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-update) and [Complete/Cancel](https://www.twilio.com/docs/voice/api/payment-resource#statuscallback-cancelcomplete) POST requests. + StatusCallback *string `json:"StatusCallback,omitempty"` + // + Capture *string `json:"Capture,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdatePaymentsParams) SetPathAccountSid(PathAccountSid string) *UpdatePaymentsParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdatePaymentsParams) SetPathAccountSid(PathAccountSid string) (*UpdatePaymentsParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdatePaymentsParams) SetIdempotencyKey(IdempotencyKey string) *UpdatePaymentsParams { - params.IdempotencyKey = &IdempotencyKey - return params +func (params *UpdatePaymentsParams) SetIdempotencyKey(IdempotencyKey string) (*UpdatePaymentsParams){ + params.IdempotencyKey = &IdempotencyKey + return params } -func (params *UpdatePaymentsParams) SetStatusCallback(StatusCallback string) *UpdatePaymentsParams { - params.StatusCallback = &StatusCallback - return params +func (params *UpdatePaymentsParams) SetStatusCallback(StatusCallback string) (*UpdatePaymentsParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *UpdatePaymentsParams) SetCapture(Capture string) *UpdatePaymentsParams { - params.Capture = &Capture - return params +func (params *UpdatePaymentsParams) SetCapture(Capture string) (*UpdatePaymentsParams){ + params.Capture = &Capture + return params } -func (params *UpdatePaymentsParams) SetStatus(Status string) *UpdatePaymentsParams { - params.Status = &Status - return params +func (params *UpdatePaymentsParams) SetStatus(Status string) (*UpdatePaymentsParams){ + params.Status = &Status + return params } // update an instance of payments with different phases of payment flows. func (c *ApiService) UpdatePayments(CallSid string, Sid string, params *UpdatePaymentsParams) (*ApiV2010Payments, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Payments/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.IdempotencyKey != nil { + data.Set("IdempotencyKey", *params.IdempotencyKey) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.Capture != nil { + data.Set("Capture", *params.Capture) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - if params != nil && params.IdempotencyKey != nil { - data.Set("IdempotencyKey", *params.IdempotencyKey) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.Capture != nil { - data.Set("Capture", *params.Capture) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010Payments{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010Payments{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_calls_recordings.go b/rest/api/v2010/accounts_calls_recordings.go index 955ded6e5..1e2b48801 100644 --- a/rest/api/v2010/accounts_calls_recordings.go +++ b/rest/api/v2010/accounts_calls_recordings.go @@ -18,277 +18,282 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCallRecording' type CreateCallRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. - RecordingStatusCallbackEvent *[]string `json:"RecordingStatusCallbackEvent,omitempty"` - // The URL we should call using the `recording_status_callback_method` on each recording event specified in `recording_status_callback_event`. For more information, see [RecordingStatusCallback parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback). - RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` - // The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. - RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` - // Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. - Trim *string `json:"Trim,omitempty"` - // The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. - RecordingChannels *string `json:"RecordingChannels,omitempty"` - // The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. - RecordingTrack *string `json:"RecordingTrack,omitempty"` -} - -func (params *CreateCallRecordingParams) SetPathAccountSid(PathAccountSid string) *CreateCallRecordingParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateCallRecordingParams) SetRecordingStatusCallbackEvent(RecordingStatusCallbackEvent []string) *CreateCallRecordingParams { - params.RecordingStatusCallbackEvent = &RecordingStatusCallbackEvent - return params -} -func (params *CreateCallRecordingParams) SetRecordingStatusCallback(RecordingStatusCallback string) *CreateCallRecordingParams { - params.RecordingStatusCallback = &RecordingStatusCallback - return params -} -func (params *CreateCallRecordingParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) *CreateCallRecordingParams { - params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod - return params -} -func (params *CreateCallRecordingParams) SetTrim(Trim string) *CreateCallRecordingParams { - params.Trim = &Trim - return params -} -func (params *CreateCallRecordingParams) SetRecordingChannels(RecordingChannels string) *CreateCallRecordingParams { - params.RecordingChannels = &RecordingChannels - return params -} -func (params *CreateCallRecordingParams) SetRecordingTrack(RecordingTrack string) *CreateCallRecordingParams { - params.RecordingTrack = &RecordingTrack - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. + RecordingStatusCallbackEvent *[]string `json:"RecordingStatusCallbackEvent,omitempty"` + // The URL we should call using the `recording_status_callback_method` on each recording event specified in `recording_status_callback_event`. For more information, see [RecordingStatusCallback parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback). + RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` + // The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. + RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` + // Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. + Trim *string `json:"Trim,omitempty"` + // The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. + RecordingChannels *string `json:"RecordingChannels,omitempty"` + // The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. + RecordingTrack *string `json:"RecordingTrack,omitempty"` +} + +func (params *CreateCallRecordingParams) SetPathAccountSid(PathAccountSid string) (*CreateCallRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateCallRecordingParams) SetRecordingStatusCallbackEvent(RecordingStatusCallbackEvent []string) (*CreateCallRecordingParams){ + params.RecordingStatusCallbackEvent = &RecordingStatusCallbackEvent + return params +} +func (params *CreateCallRecordingParams) SetRecordingStatusCallback(RecordingStatusCallback string) (*CreateCallRecordingParams){ + params.RecordingStatusCallback = &RecordingStatusCallback + return params +} +func (params *CreateCallRecordingParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) (*CreateCallRecordingParams){ + params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod + return params +} +func (params *CreateCallRecordingParams) SetTrim(Trim string) (*CreateCallRecordingParams){ + params.Trim = &Trim + return params +} +func (params *CreateCallRecordingParams) SetRecordingChannels(RecordingChannels string) (*CreateCallRecordingParams){ + params.RecordingChannels = &RecordingChannels + return params +} +func (params *CreateCallRecordingParams) SetRecordingTrack(RecordingTrack string) (*CreateCallRecordingParams){ + params.RecordingTrack = &RecordingTrack + return params } // Create a recording for the call func (c *ApiService) CreateCallRecording(CallSid string, params *CreateCallRecordingParams) (*ApiV2010CallRecording, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.RecordingStatusCallbackEvent != nil { - for _, item := range *params.RecordingStatusCallbackEvent { - data.Add("RecordingStatusCallbackEvent", item) - } - } - if params != nil && params.RecordingStatusCallback != nil { - data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) - } - if params != nil && params.RecordingStatusCallbackMethod != nil { - data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) - } - if params != nil && params.Trim != nil { - data.Set("Trim", *params.Trim) - } - if params != nil && params.RecordingChannels != nil { - data.Set("RecordingChannels", *params.RecordingChannels) - } - if params != nil && params.RecordingTrack != nil { - data.Set("RecordingTrack", *params.RecordingTrack) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010CallRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RecordingStatusCallbackEvent != nil { + for _, item := range *params.RecordingStatusCallbackEvent { + data.Add("RecordingStatusCallbackEvent", item) + } + } + if params != nil && params.RecordingStatusCallback != nil { + data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) + } + if params != nil && params.RecordingStatusCallbackMethod != nil { + data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) + } + if params != nil && params.Trim != nil { + data.Set("Trim", *params.Trim) + } + if params != nil && params.RecordingChannels != nil { + data.Set("RecordingChannels", *params.RecordingChannels) + } + if params != nil && params.RecordingTrack != nil { + data.Set("RecordingTrack", *params.RecordingTrack) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010CallRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteCallRecording' type DeleteCallRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteCallRecordingParams) SetPathAccountSid(PathAccountSid string) *DeleteCallRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteCallRecordingParams) SetPathAccountSid(PathAccountSid string) (*DeleteCallRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a recording from your account -func (c *ApiService) DeleteCallRecording(CallSid string, Sid string, params *DeleteCallRecordingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCallRecording(CallSid string, Sid string, params *DeleteCallRecordingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchCallRecording' type FetchCallRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchCallRecordingParams) SetPathAccountSid(PathAccountSid string) *FetchCallRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchCallRecordingParams) SetPathAccountSid(PathAccountSid string) (*FetchCallRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a recording for a call func (c *ApiService) FetchCallRecording(CallSid string, Sid string, params *FetchCallRecordingParams) (*ApiV2010CallRecording, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010CallRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010CallRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListCallRecording' type ListCallRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. - DateCreated *string `json:"DateCreated,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. - DateCreatedBefore *string `json:"DateCreated<,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. - DateCreatedAfter *string `json:"DateCreated>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. + DateCreated *string `json:"DateCreated,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. + DateCreatedBefore *string `json:"DateCreated<,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. + DateCreatedAfter *string `json:"DateCreated>,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCallRecordingParams) SetPathAccountSid(PathAccountSid string) *ListCallRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListCallRecordingParams) SetPathAccountSid(PathAccountSid string) (*ListCallRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListCallRecordingParams) SetDateCreated(DateCreated string) *ListCallRecordingParams { - params.DateCreated = &DateCreated - return params +func (params *ListCallRecordingParams) SetDateCreated(DateCreated string) (*ListCallRecordingParams){ + params.DateCreated = &DateCreated + return params } -func (params *ListCallRecordingParams) SetDateCreatedBefore(DateCreatedBefore string) *ListCallRecordingParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListCallRecordingParams) SetDateCreatedBefore(DateCreatedBefore string) (*ListCallRecordingParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListCallRecordingParams) SetDateCreatedAfter(DateCreatedAfter string) *ListCallRecordingParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListCallRecordingParams) SetDateCreatedAfter(DateCreatedAfter string) (*ListCallRecordingParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListCallRecordingParams) SetPageSize(PageSize int) *ListCallRecordingParams { - params.PageSize = &PageSize - return params +func (params *ListCallRecordingParams) SetPageSize(PageSize int) (*ListCallRecordingParams){ + params.PageSize = &PageSize + return params } -func (params *ListCallRecordingParams) SetLimit(Limit int) *ListCallRecordingParams { - params.Limit = &Limit - return params +func (params *ListCallRecordingParams) SetLimit(Limit int) (*ListCallRecordingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CallRecording records from the API. Request is executed immediately. -func (c *ApiService) PageCallRecording(CallSid string, params *ListCallRecordingParams, pageToken, pageNumber string) (*ListCallRecordingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint(*params.DateCreated)) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreated<", fmt.Sprint(*params.DateCreatedBefore)) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreated>", fmt.Sprint(*params.DateCreatedAfter)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCallRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageCallRecording(CallSid string, params *ListCallRecordingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint(*params.DateCreated)) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreated<", fmt.Sprint(*params.DateCreatedBefore)) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreated>", fmt.Sprint(*params.DateCreatedAfter)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists CallRecording records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListCallRecording(CallSid string, params *ListCallRecordingParams) ([]ApiV2010CallRecording, error) { +func (c *ApiService) ListCallRecording(CallSid string, params *ListCallRecordingParams) (ListCallRecording200Response, error) { response, errors := c.StreamCallRecording(CallSid, params) - records := make([]ApiV2010CallRecording, 0) + records := make(ListCallRecording200Response, 0) for record := range response { records = append(records, record) } @@ -301,13 +306,13 @@ func (c *ApiService) ListCallRecording(CallSid string, params *ListCallRecording } // Streams CallRecording records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamCallRecording(CallSid string, params *ListCallRecordingParams) (chan ApiV2010CallRecording, chan error) { +func (c *ApiService) StreamCallRecording(CallSid string, params *ListCallRecordingParams) (chan ListCallRecording200Response, chan error) { if params == nil { params = &ListCallRecordingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010CallRecording, 1) + recordChannel := make(chan ListCallRecording200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageCallRecording(CallSid, params, "", "") @@ -322,11 +327,12 @@ func (c *ApiService) StreamCallRecording(CallSid string, params *ListCallRecordi return recordChannel, errorChannel } -func (c *ApiService) streamCallRecording(response *ListCallRecordingResponse, params *ListCallRecordingParams, recordChannel chan ApiV2010CallRecording, errorChannel chan error) { + +func (c *ApiService) streamCallRecording(response *, params *ListCallRecordingParams, recordChannel chan ListCallRecording200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Recordings + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -337,7 +343,7 @@ func (c *ApiService) streamCallRecording(response *ListCallRecordingResponse, pa } } - record, err := client.GetNext(c.baseURL, response, c.getNextListCallRecordingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -345,86 +351,88 @@ func (c *ApiService) streamCallRecording(response *ListCallRecordingResponse, pa break } - response = record.(*ListCallRecordingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListCallRecordingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCallRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCallRecording' type UpdateCallRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - Status *string `json:"Status,omitempty"` - // Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. - PauseBehavior *string `json:"PauseBehavior,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + Status *string `json:"Status,omitempty"` + // Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + PauseBehavior *string `json:"PauseBehavior,omitempty"` } -func (params *UpdateCallRecordingParams) SetPathAccountSid(PathAccountSid string) *UpdateCallRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateCallRecordingParams) SetPathAccountSid(PathAccountSid string) (*UpdateCallRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateCallRecordingParams) SetStatus(Status string) *UpdateCallRecordingParams { - params.Status = &Status - return params +func (params *UpdateCallRecordingParams) SetStatus(Status string) (*UpdateCallRecordingParams){ + params.Status = &Status + return params } -func (params *UpdateCallRecordingParams) SetPauseBehavior(PauseBehavior string) *UpdateCallRecordingParams { - params.PauseBehavior = &PauseBehavior - return params +func (params *UpdateCallRecordingParams) SetPauseBehavior(PauseBehavior string) (*UpdateCallRecordingParams){ + params.PauseBehavior = &PauseBehavior + return params } // Changes the status of the recording to paused, stopped, or in-progress. Note: Pass `Twilio.CURRENT` instead of recording sid to reference current active recording. func (c *ApiService) UpdateCallRecording(CallSid string, Sid string, params *UpdateCallRecordingParams) (*ApiV2010CallRecording, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PauseBehavior != nil { - data.Set("PauseBehavior", *params.PauseBehavior) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PauseBehavior != nil { + data.Set("PauseBehavior", *params.PauseBehavior) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010CallRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010CallRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_calls_siprec.go b/rest/api/v2010/accounts_calls_siprec.go index b793c9934..0fa7e51e4 100644 --- a/rest/api/v2010/accounts_calls_siprec.go +++ b/rest/api/v2010/accounts_calls_siprec.go @@ -16,1923 +16,1928 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSiprec' type CreateSiprecParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. - Name *string `json:"Name,omitempty"` - // Unique name used when configuring the connector via Marketplace Add-on. - ConnectorName *string `json:"ConnectorName,omitempty"` - // - Track *string `json:"Track,omitempty"` - // Absolute URL of the status callback. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The http method for the status_callback (one of GET, POST). - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Parameter name - Parameter1Name *string `json:"Parameter1.Name,omitempty"` - // Parameter value - Parameter1Value *string `json:"Parameter1.Value,omitempty"` - // Parameter name - Parameter2Name *string `json:"Parameter2.Name,omitempty"` - // Parameter value - Parameter2Value *string `json:"Parameter2.Value,omitempty"` - // Parameter name - Parameter3Name *string `json:"Parameter3.Name,omitempty"` - // Parameter value - Parameter3Value *string `json:"Parameter3.Value,omitempty"` - // Parameter name - Parameter4Name *string `json:"Parameter4.Name,omitempty"` - // Parameter value - Parameter4Value *string `json:"Parameter4.Value,omitempty"` - // Parameter name - Parameter5Name *string `json:"Parameter5.Name,omitempty"` - // Parameter value - Parameter5Value *string `json:"Parameter5.Value,omitempty"` - // Parameter name - Parameter6Name *string `json:"Parameter6.Name,omitempty"` - // Parameter value - Parameter6Value *string `json:"Parameter6.Value,omitempty"` - // Parameter name - Parameter7Name *string `json:"Parameter7.Name,omitempty"` - // Parameter value - Parameter7Value *string `json:"Parameter7.Value,omitempty"` - // Parameter name - Parameter8Name *string `json:"Parameter8.Name,omitempty"` - // Parameter value - Parameter8Value *string `json:"Parameter8.Value,omitempty"` - // Parameter name - Parameter9Name *string `json:"Parameter9.Name,omitempty"` - // Parameter value - Parameter9Value *string `json:"Parameter9.Value,omitempty"` - // Parameter name - Parameter10Name *string `json:"Parameter10.Name,omitempty"` - // Parameter value - Parameter10Value *string `json:"Parameter10.Value,omitempty"` - // Parameter name - Parameter11Name *string `json:"Parameter11.Name,omitempty"` - // Parameter value - Parameter11Value *string `json:"Parameter11.Value,omitempty"` - // Parameter name - Parameter12Name *string `json:"Parameter12.Name,omitempty"` - // Parameter value - Parameter12Value *string `json:"Parameter12.Value,omitempty"` - // Parameter name - Parameter13Name *string `json:"Parameter13.Name,omitempty"` - // Parameter value - Parameter13Value *string `json:"Parameter13.Value,omitempty"` - // Parameter name - Parameter14Name *string `json:"Parameter14.Name,omitempty"` - // Parameter value - Parameter14Value *string `json:"Parameter14.Value,omitempty"` - // Parameter name - Parameter15Name *string `json:"Parameter15.Name,omitempty"` - // Parameter value - Parameter15Value *string `json:"Parameter15.Value,omitempty"` - // Parameter name - Parameter16Name *string `json:"Parameter16.Name,omitempty"` - // Parameter value - Parameter16Value *string `json:"Parameter16.Value,omitempty"` - // Parameter name - Parameter17Name *string `json:"Parameter17.Name,omitempty"` - // Parameter value - Parameter17Value *string `json:"Parameter17.Value,omitempty"` - // Parameter name - Parameter18Name *string `json:"Parameter18.Name,omitempty"` - // Parameter value - Parameter18Value *string `json:"Parameter18.Value,omitempty"` - // Parameter name - Parameter19Name *string `json:"Parameter19.Name,omitempty"` - // Parameter value - Parameter19Value *string `json:"Parameter19.Value,omitempty"` - // Parameter name - Parameter20Name *string `json:"Parameter20.Name,omitempty"` - // Parameter value - Parameter20Value *string `json:"Parameter20.Value,omitempty"` - // Parameter name - Parameter21Name *string `json:"Parameter21.Name,omitempty"` - // Parameter value - Parameter21Value *string `json:"Parameter21.Value,omitempty"` - // Parameter name - Parameter22Name *string `json:"Parameter22.Name,omitempty"` - // Parameter value - Parameter22Value *string `json:"Parameter22.Value,omitempty"` - // Parameter name - Parameter23Name *string `json:"Parameter23.Name,omitempty"` - // Parameter value - Parameter23Value *string `json:"Parameter23.Value,omitempty"` - // Parameter name - Parameter24Name *string `json:"Parameter24.Name,omitempty"` - // Parameter value - Parameter24Value *string `json:"Parameter24.Value,omitempty"` - // Parameter name - Parameter25Name *string `json:"Parameter25.Name,omitempty"` - // Parameter value - Parameter25Value *string `json:"Parameter25.Value,omitempty"` - // Parameter name - Parameter26Name *string `json:"Parameter26.Name,omitempty"` - // Parameter value - Parameter26Value *string `json:"Parameter26.Value,omitempty"` - // Parameter name - Parameter27Name *string `json:"Parameter27.Name,omitempty"` - // Parameter value - Parameter27Value *string `json:"Parameter27.Value,omitempty"` - // Parameter name - Parameter28Name *string `json:"Parameter28.Name,omitempty"` - // Parameter value - Parameter28Value *string `json:"Parameter28.Value,omitempty"` - // Parameter name - Parameter29Name *string `json:"Parameter29.Name,omitempty"` - // Parameter value - Parameter29Value *string `json:"Parameter29.Value,omitempty"` - // Parameter name - Parameter30Name *string `json:"Parameter30.Name,omitempty"` - // Parameter value - Parameter30Value *string `json:"Parameter30.Value,omitempty"` - // Parameter name - Parameter31Name *string `json:"Parameter31.Name,omitempty"` - // Parameter value - Parameter31Value *string `json:"Parameter31.Value,omitempty"` - // Parameter name - Parameter32Name *string `json:"Parameter32.Name,omitempty"` - // Parameter value - Parameter32Value *string `json:"Parameter32.Value,omitempty"` - // Parameter name - Parameter33Name *string `json:"Parameter33.Name,omitempty"` - // Parameter value - Parameter33Value *string `json:"Parameter33.Value,omitempty"` - // Parameter name - Parameter34Name *string `json:"Parameter34.Name,omitempty"` - // Parameter value - Parameter34Value *string `json:"Parameter34.Value,omitempty"` - // Parameter name - Parameter35Name *string `json:"Parameter35.Name,omitempty"` - // Parameter value - Parameter35Value *string `json:"Parameter35.Value,omitempty"` - // Parameter name - Parameter36Name *string `json:"Parameter36.Name,omitempty"` - // Parameter value - Parameter36Value *string `json:"Parameter36.Value,omitempty"` - // Parameter name - Parameter37Name *string `json:"Parameter37.Name,omitempty"` - // Parameter value - Parameter37Value *string `json:"Parameter37.Value,omitempty"` - // Parameter name - Parameter38Name *string `json:"Parameter38.Name,omitempty"` - // Parameter value - Parameter38Value *string `json:"Parameter38.Value,omitempty"` - // Parameter name - Parameter39Name *string `json:"Parameter39.Name,omitempty"` - // Parameter value - Parameter39Value *string `json:"Parameter39.Value,omitempty"` - // Parameter name - Parameter40Name *string `json:"Parameter40.Name,omitempty"` - // Parameter value - Parameter40Value *string `json:"Parameter40.Value,omitempty"` - // Parameter name - Parameter41Name *string `json:"Parameter41.Name,omitempty"` - // Parameter value - Parameter41Value *string `json:"Parameter41.Value,omitempty"` - // Parameter name - Parameter42Name *string `json:"Parameter42.Name,omitempty"` - // Parameter value - Parameter42Value *string `json:"Parameter42.Value,omitempty"` - // Parameter name - Parameter43Name *string `json:"Parameter43.Name,omitempty"` - // Parameter value - Parameter43Value *string `json:"Parameter43.Value,omitempty"` - // Parameter name - Parameter44Name *string `json:"Parameter44.Name,omitempty"` - // Parameter value - Parameter44Value *string `json:"Parameter44.Value,omitempty"` - // Parameter name - Parameter45Name *string `json:"Parameter45.Name,omitempty"` - // Parameter value - Parameter45Value *string `json:"Parameter45.Value,omitempty"` - // Parameter name - Parameter46Name *string `json:"Parameter46.Name,omitempty"` - // Parameter value - Parameter46Value *string `json:"Parameter46.Value,omitempty"` - // Parameter name - Parameter47Name *string `json:"Parameter47.Name,omitempty"` - // Parameter value - Parameter47Value *string `json:"Parameter47.Value,omitempty"` - // Parameter name - Parameter48Name *string `json:"Parameter48.Name,omitempty"` - // Parameter value - Parameter48Value *string `json:"Parameter48.Value,omitempty"` - // Parameter name - Parameter49Name *string `json:"Parameter49.Name,omitempty"` - // Parameter value - Parameter49Value *string `json:"Parameter49.Value,omitempty"` - // Parameter name - Parameter50Name *string `json:"Parameter50.Name,omitempty"` - // Parameter value - Parameter50Value *string `json:"Parameter50.Value,omitempty"` - // Parameter name - Parameter51Name *string `json:"Parameter51.Name,omitempty"` - // Parameter value - Parameter51Value *string `json:"Parameter51.Value,omitempty"` - // Parameter name - Parameter52Name *string `json:"Parameter52.Name,omitempty"` - // Parameter value - Parameter52Value *string `json:"Parameter52.Value,omitempty"` - // Parameter name - Parameter53Name *string `json:"Parameter53.Name,omitempty"` - // Parameter value - Parameter53Value *string `json:"Parameter53.Value,omitempty"` - // Parameter name - Parameter54Name *string `json:"Parameter54.Name,omitempty"` - // Parameter value - Parameter54Value *string `json:"Parameter54.Value,omitempty"` - // Parameter name - Parameter55Name *string `json:"Parameter55.Name,omitempty"` - // Parameter value - Parameter55Value *string `json:"Parameter55.Value,omitempty"` - // Parameter name - Parameter56Name *string `json:"Parameter56.Name,omitempty"` - // Parameter value - Parameter56Value *string `json:"Parameter56.Value,omitempty"` - // Parameter name - Parameter57Name *string `json:"Parameter57.Name,omitempty"` - // Parameter value - Parameter57Value *string `json:"Parameter57.Value,omitempty"` - // Parameter name - Parameter58Name *string `json:"Parameter58.Name,omitempty"` - // Parameter value - Parameter58Value *string `json:"Parameter58.Value,omitempty"` - // Parameter name - Parameter59Name *string `json:"Parameter59.Name,omitempty"` - // Parameter value - Parameter59Value *string `json:"Parameter59.Value,omitempty"` - // Parameter name - Parameter60Name *string `json:"Parameter60.Name,omitempty"` - // Parameter value - Parameter60Value *string `json:"Parameter60.Value,omitempty"` - // Parameter name - Parameter61Name *string `json:"Parameter61.Name,omitempty"` - // Parameter value - Parameter61Value *string `json:"Parameter61.Value,omitempty"` - // Parameter name - Parameter62Name *string `json:"Parameter62.Name,omitempty"` - // Parameter value - Parameter62Value *string `json:"Parameter62.Value,omitempty"` - // Parameter name - Parameter63Name *string `json:"Parameter63.Name,omitempty"` - // Parameter value - Parameter63Value *string `json:"Parameter63.Value,omitempty"` - // Parameter name - Parameter64Name *string `json:"Parameter64.Name,omitempty"` - // Parameter value - Parameter64Value *string `json:"Parameter64.Value,omitempty"` - // Parameter name - Parameter65Name *string `json:"Parameter65.Name,omitempty"` - // Parameter value - Parameter65Value *string `json:"Parameter65.Value,omitempty"` - // Parameter name - Parameter66Name *string `json:"Parameter66.Name,omitempty"` - // Parameter value - Parameter66Value *string `json:"Parameter66.Value,omitempty"` - // Parameter name - Parameter67Name *string `json:"Parameter67.Name,omitempty"` - // Parameter value - Parameter67Value *string `json:"Parameter67.Value,omitempty"` - // Parameter name - Parameter68Name *string `json:"Parameter68.Name,omitempty"` - // Parameter value - Parameter68Value *string `json:"Parameter68.Value,omitempty"` - // Parameter name - Parameter69Name *string `json:"Parameter69.Name,omitempty"` - // Parameter value - Parameter69Value *string `json:"Parameter69.Value,omitempty"` - // Parameter name - Parameter70Name *string `json:"Parameter70.Name,omitempty"` - // Parameter value - Parameter70Value *string `json:"Parameter70.Value,omitempty"` - // Parameter name - Parameter71Name *string `json:"Parameter71.Name,omitempty"` - // Parameter value - Parameter71Value *string `json:"Parameter71.Value,omitempty"` - // Parameter name - Parameter72Name *string `json:"Parameter72.Name,omitempty"` - // Parameter value - Parameter72Value *string `json:"Parameter72.Value,omitempty"` - // Parameter name - Parameter73Name *string `json:"Parameter73.Name,omitempty"` - // Parameter value - Parameter73Value *string `json:"Parameter73.Value,omitempty"` - // Parameter name - Parameter74Name *string `json:"Parameter74.Name,omitempty"` - // Parameter value - Parameter74Value *string `json:"Parameter74.Value,omitempty"` - // Parameter name - Parameter75Name *string `json:"Parameter75.Name,omitempty"` - // Parameter value - Parameter75Value *string `json:"Parameter75.Value,omitempty"` - // Parameter name - Parameter76Name *string `json:"Parameter76.Name,omitempty"` - // Parameter value - Parameter76Value *string `json:"Parameter76.Value,omitempty"` - // Parameter name - Parameter77Name *string `json:"Parameter77.Name,omitempty"` - // Parameter value - Parameter77Value *string `json:"Parameter77.Value,omitempty"` - // Parameter name - Parameter78Name *string `json:"Parameter78.Name,omitempty"` - // Parameter value - Parameter78Value *string `json:"Parameter78.Value,omitempty"` - // Parameter name - Parameter79Name *string `json:"Parameter79.Name,omitempty"` - // Parameter value - Parameter79Value *string `json:"Parameter79.Value,omitempty"` - // Parameter name - Parameter80Name *string `json:"Parameter80.Name,omitempty"` - // Parameter value - Parameter80Value *string `json:"Parameter80.Value,omitempty"` - // Parameter name - Parameter81Name *string `json:"Parameter81.Name,omitempty"` - // Parameter value - Parameter81Value *string `json:"Parameter81.Value,omitempty"` - // Parameter name - Parameter82Name *string `json:"Parameter82.Name,omitempty"` - // Parameter value - Parameter82Value *string `json:"Parameter82.Value,omitempty"` - // Parameter name - Parameter83Name *string `json:"Parameter83.Name,omitempty"` - // Parameter value - Parameter83Value *string `json:"Parameter83.Value,omitempty"` - // Parameter name - Parameter84Name *string `json:"Parameter84.Name,omitempty"` - // Parameter value - Parameter84Value *string `json:"Parameter84.Value,omitempty"` - // Parameter name - Parameter85Name *string `json:"Parameter85.Name,omitempty"` - // Parameter value - Parameter85Value *string `json:"Parameter85.Value,omitempty"` - // Parameter name - Parameter86Name *string `json:"Parameter86.Name,omitempty"` - // Parameter value - Parameter86Value *string `json:"Parameter86.Value,omitempty"` - // Parameter name - Parameter87Name *string `json:"Parameter87.Name,omitempty"` - // Parameter value - Parameter87Value *string `json:"Parameter87.Value,omitempty"` - // Parameter name - Parameter88Name *string `json:"Parameter88.Name,omitempty"` - // Parameter value - Parameter88Value *string `json:"Parameter88.Value,omitempty"` - // Parameter name - Parameter89Name *string `json:"Parameter89.Name,omitempty"` - // Parameter value - Parameter89Value *string `json:"Parameter89.Value,omitempty"` - // Parameter name - Parameter90Name *string `json:"Parameter90.Name,omitempty"` - // Parameter value - Parameter90Value *string `json:"Parameter90.Value,omitempty"` - // Parameter name - Parameter91Name *string `json:"Parameter91.Name,omitempty"` - // Parameter value - Parameter91Value *string `json:"Parameter91.Value,omitempty"` - // Parameter name - Parameter92Name *string `json:"Parameter92.Name,omitempty"` - // Parameter value - Parameter92Value *string `json:"Parameter92.Value,omitempty"` - // Parameter name - Parameter93Name *string `json:"Parameter93.Name,omitempty"` - // Parameter value - Parameter93Value *string `json:"Parameter93.Value,omitempty"` - // Parameter name - Parameter94Name *string `json:"Parameter94.Name,omitempty"` - // Parameter value - Parameter94Value *string `json:"Parameter94.Value,omitempty"` - // Parameter name - Parameter95Name *string `json:"Parameter95.Name,omitempty"` - // Parameter value - Parameter95Value *string `json:"Parameter95.Value,omitempty"` - // Parameter name - Parameter96Name *string `json:"Parameter96.Name,omitempty"` - // Parameter value - Parameter96Value *string `json:"Parameter96.Value,omitempty"` - // Parameter name - Parameter97Name *string `json:"Parameter97.Name,omitempty"` - // Parameter value - Parameter97Value *string `json:"Parameter97.Value,omitempty"` - // Parameter name - Parameter98Name *string `json:"Parameter98.Name,omitempty"` - // Parameter value - Parameter98Value *string `json:"Parameter98.Value,omitempty"` - // Parameter name - Parameter99Name *string `json:"Parameter99.Name,omitempty"` - // Parameter value - Parameter99Value *string `json:"Parameter99.Value,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. + Name *string `json:"Name,omitempty"` + // Unique name used when configuring the connector via Marketplace Add-on. + ConnectorName *string `json:"ConnectorName,omitempty"` + // + Track *string `json:"Track,omitempty"` + // Absolute URL of the status callback. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The http method for the status_callback (one of GET, POST). + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Parameter name + Parameter1Name *string `json:"Parameter1.Name,omitempty"` + // Parameter value + Parameter1Value *string `json:"Parameter1.Value,omitempty"` + // Parameter name + Parameter2Name *string `json:"Parameter2.Name,omitempty"` + // Parameter value + Parameter2Value *string `json:"Parameter2.Value,omitempty"` + // Parameter name + Parameter3Name *string `json:"Parameter3.Name,omitempty"` + // Parameter value + Parameter3Value *string `json:"Parameter3.Value,omitempty"` + // Parameter name + Parameter4Name *string `json:"Parameter4.Name,omitempty"` + // Parameter value + Parameter4Value *string `json:"Parameter4.Value,omitempty"` + // Parameter name + Parameter5Name *string `json:"Parameter5.Name,omitempty"` + // Parameter value + Parameter5Value *string `json:"Parameter5.Value,omitempty"` + // Parameter name + Parameter6Name *string `json:"Parameter6.Name,omitempty"` + // Parameter value + Parameter6Value *string `json:"Parameter6.Value,omitempty"` + // Parameter name + Parameter7Name *string `json:"Parameter7.Name,omitempty"` + // Parameter value + Parameter7Value *string `json:"Parameter7.Value,omitempty"` + // Parameter name + Parameter8Name *string `json:"Parameter8.Name,omitempty"` + // Parameter value + Parameter8Value *string `json:"Parameter8.Value,omitempty"` + // Parameter name + Parameter9Name *string `json:"Parameter9.Name,omitempty"` + // Parameter value + Parameter9Value *string `json:"Parameter9.Value,omitempty"` + // Parameter name + Parameter10Name *string `json:"Parameter10.Name,omitempty"` + // Parameter value + Parameter10Value *string `json:"Parameter10.Value,omitempty"` + // Parameter name + Parameter11Name *string `json:"Parameter11.Name,omitempty"` + // Parameter value + Parameter11Value *string `json:"Parameter11.Value,omitempty"` + // Parameter name + Parameter12Name *string `json:"Parameter12.Name,omitempty"` + // Parameter value + Parameter12Value *string `json:"Parameter12.Value,omitempty"` + // Parameter name + Parameter13Name *string `json:"Parameter13.Name,omitempty"` + // Parameter value + Parameter13Value *string `json:"Parameter13.Value,omitempty"` + // Parameter name + Parameter14Name *string `json:"Parameter14.Name,omitempty"` + // Parameter value + Parameter14Value *string `json:"Parameter14.Value,omitempty"` + // Parameter name + Parameter15Name *string `json:"Parameter15.Name,omitempty"` + // Parameter value + Parameter15Value *string `json:"Parameter15.Value,omitempty"` + // Parameter name + Parameter16Name *string `json:"Parameter16.Name,omitempty"` + // Parameter value + Parameter16Value *string `json:"Parameter16.Value,omitempty"` + // Parameter name + Parameter17Name *string `json:"Parameter17.Name,omitempty"` + // Parameter value + Parameter17Value *string `json:"Parameter17.Value,omitempty"` + // Parameter name + Parameter18Name *string `json:"Parameter18.Name,omitempty"` + // Parameter value + Parameter18Value *string `json:"Parameter18.Value,omitempty"` + // Parameter name + Parameter19Name *string `json:"Parameter19.Name,omitempty"` + // Parameter value + Parameter19Value *string `json:"Parameter19.Value,omitempty"` + // Parameter name + Parameter20Name *string `json:"Parameter20.Name,omitempty"` + // Parameter value + Parameter20Value *string `json:"Parameter20.Value,omitempty"` + // Parameter name + Parameter21Name *string `json:"Parameter21.Name,omitempty"` + // Parameter value + Parameter21Value *string `json:"Parameter21.Value,omitempty"` + // Parameter name + Parameter22Name *string `json:"Parameter22.Name,omitempty"` + // Parameter value + Parameter22Value *string `json:"Parameter22.Value,omitempty"` + // Parameter name + Parameter23Name *string `json:"Parameter23.Name,omitempty"` + // Parameter value + Parameter23Value *string `json:"Parameter23.Value,omitempty"` + // Parameter name + Parameter24Name *string `json:"Parameter24.Name,omitempty"` + // Parameter value + Parameter24Value *string `json:"Parameter24.Value,omitempty"` + // Parameter name + Parameter25Name *string `json:"Parameter25.Name,omitempty"` + // Parameter value + Parameter25Value *string `json:"Parameter25.Value,omitempty"` + // Parameter name + Parameter26Name *string `json:"Parameter26.Name,omitempty"` + // Parameter value + Parameter26Value *string `json:"Parameter26.Value,omitempty"` + // Parameter name + Parameter27Name *string `json:"Parameter27.Name,omitempty"` + // Parameter value + Parameter27Value *string `json:"Parameter27.Value,omitempty"` + // Parameter name + Parameter28Name *string `json:"Parameter28.Name,omitempty"` + // Parameter value + Parameter28Value *string `json:"Parameter28.Value,omitempty"` + // Parameter name + Parameter29Name *string `json:"Parameter29.Name,omitempty"` + // Parameter value + Parameter29Value *string `json:"Parameter29.Value,omitempty"` + // Parameter name + Parameter30Name *string `json:"Parameter30.Name,omitempty"` + // Parameter value + Parameter30Value *string `json:"Parameter30.Value,omitempty"` + // Parameter name + Parameter31Name *string `json:"Parameter31.Name,omitempty"` + // Parameter value + Parameter31Value *string `json:"Parameter31.Value,omitempty"` + // Parameter name + Parameter32Name *string `json:"Parameter32.Name,omitempty"` + // Parameter value + Parameter32Value *string `json:"Parameter32.Value,omitempty"` + // Parameter name + Parameter33Name *string `json:"Parameter33.Name,omitempty"` + // Parameter value + Parameter33Value *string `json:"Parameter33.Value,omitempty"` + // Parameter name + Parameter34Name *string `json:"Parameter34.Name,omitempty"` + // Parameter value + Parameter34Value *string `json:"Parameter34.Value,omitempty"` + // Parameter name + Parameter35Name *string `json:"Parameter35.Name,omitempty"` + // Parameter value + Parameter35Value *string `json:"Parameter35.Value,omitempty"` + // Parameter name + Parameter36Name *string `json:"Parameter36.Name,omitempty"` + // Parameter value + Parameter36Value *string `json:"Parameter36.Value,omitempty"` + // Parameter name + Parameter37Name *string `json:"Parameter37.Name,omitempty"` + // Parameter value + Parameter37Value *string `json:"Parameter37.Value,omitempty"` + // Parameter name + Parameter38Name *string `json:"Parameter38.Name,omitempty"` + // Parameter value + Parameter38Value *string `json:"Parameter38.Value,omitempty"` + // Parameter name + Parameter39Name *string `json:"Parameter39.Name,omitempty"` + // Parameter value + Parameter39Value *string `json:"Parameter39.Value,omitempty"` + // Parameter name + Parameter40Name *string `json:"Parameter40.Name,omitempty"` + // Parameter value + Parameter40Value *string `json:"Parameter40.Value,omitempty"` + // Parameter name + Parameter41Name *string `json:"Parameter41.Name,omitempty"` + // Parameter value + Parameter41Value *string `json:"Parameter41.Value,omitempty"` + // Parameter name + Parameter42Name *string `json:"Parameter42.Name,omitempty"` + // Parameter value + Parameter42Value *string `json:"Parameter42.Value,omitempty"` + // Parameter name + Parameter43Name *string `json:"Parameter43.Name,omitempty"` + // Parameter value + Parameter43Value *string `json:"Parameter43.Value,omitempty"` + // Parameter name + Parameter44Name *string `json:"Parameter44.Name,omitempty"` + // Parameter value + Parameter44Value *string `json:"Parameter44.Value,omitempty"` + // Parameter name + Parameter45Name *string `json:"Parameter45.Name,omitempty"` + // Parameter value + Parameter45Value *string `json:"Parameter45.Value,omitempty"` + // Parameter name + Parameter46Name *string `json:"Parameter46.Name,omitempty"` + // Parameter value + Parameter46Value *string `json:"Parameter46.Value,omitempty"` + // Parameter name + Parameter47Name *string `json:"Parameter47.Name,omitempty"` + // Parameter value + Parameter47Value *string `json:"Parameter47.Value,omitempty"` + // Parameter name + Parameter48Name *string `json:"Parameter48.Name,omitempty"` + // Parameter value + Parameter48Value *string `json:"Parameter48.Value,omitempty"` + // Parameter name + Parameter49Name *string `json:"Parameter49.Name,omitempty"` + // Parameter value + Parameter49Value *string `json:"Parameter49.Value,omitempty"` + // Parameter name + Parameter50Name *string `json:"Parameter50.Name,omitempty"` + // Parameter value + Parameter50Value *string `json:"Parameter50.Value,omitempty"` + // Parameter name + Parameter51Name *string `json:"Parameter51.Name,omitempty"` + // Parameter value + Parameter51Value *string `json:"Parameter51.Value,omitempty"` + // Parameter name + Parameter52Name *string `json:"Parameter52.Name,omitempty"` + // Parameter value + Parameter52Value *string `json:"Parameter52.Value,omitempty"` + // Parameter name + Parameter53Name *string `json:"Parameter53.Name,omitempty"` + // Parameter value + Parameter53Value *string `json:"Parameter53.Value,omitempty"` + // Parameter name + Parameter54Name *string `json:"Parameter54.Name,omitempty"` + // Parameter value + Parameter54Value *string `json:"Parameter54.Value,omitempty"` + // Parameter name + Parameter55Name *string `json:"Parameter55.Name,omitempty"` + // Parameter value + Parameter55Value *string `json:"Parameter55.Value,omitempty"` + // Parameter name + Parameter56Name *string `json:"Parameter56.Name,omitempty"` + // Parameter value + Parameter56Value *string `json:"Parameter56.Value,omitempty"` + // Parameter name + Parameter57Name *string `json:"Parameter57.Name,omitempty"` + // Parameter value + Parameter57Value *string `json:"Parameter57.Value,omitempty"` + // Parameter name + Parameter58Name *string `json:"Parameter58.Name,omitempty"` + // Parameter value + Parameter58Value *string `json:"Parameter58.Value,omitempty"` + // Parameter name + Parameter59Name *string `json:"Parameter59.Name,omitempty"` + // Parameter value + Parameter59Value *string `json:"Parameter59.Value,omitempty"` + // Parameter name + Parameter60Name *string `json:"Parameter60.Name,omitempty"` + // Parameter value + Parameter60Value *string `json:"Parameter60.Value,omitempty"` + // Parameter name + Parameter61Name *string `json:"Parameter61.Name,omitempty"` + // Parameter value + Parameter61Value *string `json:"Parameter61.Value,omitempty"` + // Parameter name + Parameter62Name *string `json:"Parameter62.Name,omitempty"` + // Parameter value + Parameter62Value *string `json:"Parameter62.Value,omitempty"` + // Parameter name + Parameter63Name *string `json:"Parameter63.Name,omitempty"` + // Parameter value + Parameter63Value *string `json:"Parameter63.Value,omitempty"` + // Parameter name + Parameter64Name *string `json:"Parameter64.Name,omitempty"` + // Parameter value + Parameter64Value *string `json:"Parameter64.Value,omitempty"` + // Parameter name + Parameter65Name *string `json:"Parameter65.Name,omitempty"` + // Parameter value + Parameter65Value *string `json:"Parameter65.Value,omitempty"` + // Parameter name + Parameter66Name *string `json:"Parameter66.Name,omitempty"` + // Parameter value + Parameter66Value *string `json:"Parameter66.Value,omitempty"` + // Parameter name + Parameter67Name *string `json:"Parameter67.Name,omitempty"` + // Parameter value + Parameter67Value *string `json:"Parameter67.Value,omitempty"` + // Parameter name + Parameter68Name *string `json:"Parameter68.Name,omitempty"` + // Parameter value + Parameter68Value *string `json:"Parameter68.Value,omitempty"` + // Parameter name + Parameter69Name *string `json:"Parameter69.Name,omitempty"` + // Parameter value + Parameter69Value *string `json:"Parameter69.Value,omitempty"` + // Parameter name + Parameter70Name *string `json:"Parameter70.Name,omitempty"` + // Parameter value + Parameter70Value *string `json:"Parameter70.Value,omitempty"` + // Parameter name + Parameter71Name *string `json:"Parameter71.Name,omitempty"` + // Parameter value + Parameter71Value *string `json:"Parameter71.Value,omitempty"` + // Parameter name + Parameter72Name *string `json:"Parameter72.Name,omitempty"` + // Parameter value + Parameter72Value *string `json:"Parameter72.Value,omitempty"` + // Parameter name + Parameter73Name *string `json:"Parameter73.Name,omitempty"` + // Parameter value + Parameter73Value *string `json:"Parameter73.Value,omitempty"` + // Parameter name + Parameter74Name *string `json:"Parameter74.Name,omitempty"` + // Parameter value + Parameter74Value *string `json:"Parameter74.Value,omitempty"` + // Parameter name + Parameter75Name *string `json:"Parameter75.Name,omitempty"` + // Parameter value + Parameter75Value *string `json:"Parameter75.Value,omitempty"` + // Parameter name + Parameter76Name *string `json:"Parameter76.Name,omitempty"` + // Parameter value + Parameter76Value *string `json:"Parameter76.Value,omitempty"` + // Parameter name + Parameter77Name *string `json:"Parameter77.Name,omitempty"` + // Parameter value + Parameter77Value *string `json:"Parameter77.Value,omitempty"` + // Parameter name + Parameter78Name *string `json:"Parameter78.Name,omitempty"` + // Parameter value + Parameter78Value *string `json:"Parameter78.Value,omitempty"` + // Parameter name + Parameter79Name *string `json:"Parameter79.Name,omitempty"` + // Parameter value + Parameter79Value *string `json:"Parameter79.Value,omitempty"` + // Parameter name + Parameter80Name *string `json:"Parameter80.Name,omitempty"` + // Parameter value + Parameter80Value *string `json:"Parameter80.Value,omitempty"` + // Parameter name + Parameter81Name *string `json:"Parameter81.Name,omitempty"` + // Parameter value + Parameter81Value *string `json:"Parameter81.Value,omitempty"` + // Parameter name + Parameter82Name *string `json:"Parameter82.Name,omitempty"` + // Parameter value + Parameter82Value *string `json:"Parameter82.Value,omitempty"` + // Parameter name + Parameter83Name *string `json:"Parameter83.Name,omitempty"` + // Parameter value + Parameter83Value *string `json:"Parameter83.Value,omitempty"` + // Parameter name + Parameter84Name *string `json:"Parameter84.Name,omitempty"` + // Parameter value + Parameter84Value *string `json:"Parameter84.Value,omitempty"` + // Parameter name + Parameter85Name *string `json:"Parameter85.Name,omitempty"` + // Parameter value + Parameter85Value *string `json:"Parameter85.Value,omitempty"` + // Parameter name + Parameter86Name *string `json:"Parameter86.Name,omitempty"` + // Parameter value + Parameter86Value *string `json:"Parameter86.Value,omitempty"` + // Parameter name + Parameter87Name *string `json:"Parameter87.Name,omitempty"` + // Parameter value + Parameter87Value *string `json:"Parameter87.Value,omitempty"` + // Parameter name + Parameter88Name *string `json:"Parameter88.Name,omitempty"` + // Parameter value + Parameter88Value *string `json:"Parameter88.Value,omitempty"` + // Parameter name + Parameter89Name *string `json:"Parameter89.Name,omitempty"` + // Parameter value + Parameter89Value *string `json:"Parameter89.Value,omitempty"` + // Parameter name + Parameter90Name *string `json:"Parameter90.Name,omitempty"` + // Parameter value + Parameter90Value *string `json:"Parameter90.Value,omitempty"` + // Parameter name + Parameter91Name *string `json:"Parameter91.Name,omitempty"` + // Parameter value + Parameter91Value *string `json:"Parameter91.Value,omitempty"` + // Parameter name + Parameter92Name *string `json:"Parameter92.Name,omitempty"` + // Parameter value + Parameter92Value *string `json:"Parameter92.Value,omitempty"` + // Parameter name + Parameter93Name *string `json:"Parameter93.Name,omitempty"` + // Parameter value + Parameter93Value *string `json:"Parameter93.Value,omitempty"` + // Parameter name + Parameter94Name *string `json:"Parameter94.Name,omitempty"` + // Parameter value + Parameter94Value *string `json:"Parameter94.Value,omitempty"` + // Parameter name + Parameter95Name *string `json:"Parameter95.Name,omitempty"` + // Parameter value + Parameter95Value *string `json:"Parameter95.Value,omitempty"` + // Parameter name + Parameter96Name *string `json:"Parameter96.Name,omitempty"` + // Parameter value + Parameter96Value *string `json:"Parameter96.Value,omitempty"` + // Parameter name + Parameter97Name *string `json:"Parameter97.Name,omitempty"` + // Parameter value + Parameter97Value *string `json:"Parameter97.Value,omitempty"` + // Parameter name + Parameter98Name *string `json:"Parameter98.Name,omitempty"` + // Parameter value + Parameter98Value *string `json:"Parameter98.Value,omitempty"` + // Parameter name + Parameter99Name *string `json:"Parameter99.Name,omitempty"` + // Parameter value + Parameter99Value *string `json:"Parameter99.Value,omitempty"` } -func (params *CreateSiprecParams) SetPathAccountSid(PathAccountSid string) *CreateSiprecParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSiprecParams) SetPathAccountSid(PathAccountSid string) (*CreateSiprecParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSiprecParams) SetName(Name string) *CreateSiprecParams { - params.Name = &Name - return params +func (params *CreateSiprecParams) SetName(Name string) (*CreateSiprecParams){ + params.Name = &Name + return params } -func (params *CreateSiprecParams) SetConnectorName(ConnectorName string) *CreateSiprecParams { - params.ConnectorName = &ConnectorName - return params +func (params *CreateSiprecParams) SetConnectorName(ConnectorName string) (*CreateSiprecParams){ + params.ConnectorName = &ConnectorName + return params } -func (params *CreateSiprecParams) SetTrack(Track string) *CreateSiprecParams { - params.Track = &Track - return params +func (params *CreateSiprecParams) SetTrack(Track string) (*CreateSiprecParams){ + params.Track = &Track + return params } -func (params *CreateSiprecParams) SetStatusCallback(StatusCallback string) *CreateSiprecParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateSiprecParams) SetStatusCallback(StatusCallback string) (*CreateSiprecParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreateSiprecParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateSiprecParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *CreateSiprecParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateSiprecParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *CreateSiprecParams) SetParameter1Name(Parameter1Name string) *CreateSiprecParams { - params.Parameter1Name = &Parameter1Name - return params +func (params *CreateSiprecParams) SetParameter1Name(Parameter1Name string) (*CreateSiprecParams){ + params.Parameter1Name = &Parameter1Name + return params } -func (params *CreateSiprecParams) SetParameter1Value(Parameter1Value string) *CreateSiprecParams { - params.Parameter1Value = &Parameter1Value - return params +func (params *CreateSiprecParams) SetParameter1Value(Parameter1Value string) (*CreateSiprecParams){ + params.Parameter1Value = &Parameter1Value + return params } -func (params *CreateSiprecParams) SetParameter2Name(Parameter2Name string) *CreateSiprecParams { - params.Parameter2Name = &Parameter2Name - return params +func (params *CreateSiprecParams) SetParameter2Name(Parameter2Name string) (*CreateSiprecParams){ + params.Parameter2Name = &Parameter2Name + return params } -func (params *CreateSiprecParams) SetParameter2Value(Parameter2Value string) *CreateSiprecParams { - params.Parameter2Value = &Parameter2Value - return params +func (params *CreateSiprecParams) SetParameter2Value(Parameter2Value string) (*CreateSiprecParams){ + params.Parameter2Value = &Parameter2Value + return params } -func (params *CreateSiprecParams) SetParameter3Name(Parameter3Name string) *CreateSiprecParams { - params.Parameter3Name = &Parameter3Name - return params +func (params *CreateSiprecParams) SetParameter3Name(Parameter3Name string) (*CreateSiprecParams){ + params.Parameter3Name = &Parameter3Name + return params } -func (params *CreateSiprecParams) SetParameter3Value(Parameter3Value string) *CreateSiprecParams { - params.Parameter3Value = &Parameter3Value - return params +func (params *CreateSiprecParams) SetParameter3Value(Parameter3Value string) (*CreateSiprecParams){ + params.Parameter3Value = &Parameter3Value + return params } -func (params *CreateSiprecParams) SetParameter4Name(Parameter4Name string) *CreateSiprecParams { - params.Parameter4Name = &Parameter4Name - return params +func (params *CreateSiprecParams) SetParameter4Name(Parameter4Name string) (*CreateSiprecParams){ + params.Parameter4Name = &Parameter4Name + return params } -func (params *CreateSiprecParams) SetParameter4Value(Parameter4Value string) *CreateSiprecParams { - params.Parameter4Value = &Parameter4Value - return params +func (params *CreateSiprecParams) SetParameter4Value(Parameter4Value string) (*CreateSiprecParams){ + params.Parameter4Value = &Parameter4Value + return params } -func (params *CreateSiprecParams) SetParameter5Name(Parameter5Name string) *CreateSiprecParams { - params.Parameter5Name = &Parameter5Name - return params +func (params *CreateSiprecParams) SetParameter5Name(Parameter5Name string) (*CreateSiprecParams){ + params.Parameter5Name = &Parameter5Name + return params } -func (params *CreateSiprecParams) SetParameter5Value(Parameter5Value string) *CreateSiprecParams { - params.Parameter5Value = &Parameter5Value - return params +func (params *CreateSiprecParams) SetParameter5Value(Parameter5Value string) (*CreateSiprecParams){ + params.Parameter5Value = &Parameter5Value + return params } -func (params *CreateSiprecParams) SetParameter6Name(Parameter6Name string) *CreateSiprecParams { - params.Parameter6Name = &Parameter6Name - return params +func (params *CreateSiprecParams) SetParameter6Name(Parameter6Name string) (*CreateSiprecParams){ + params.Parameter6Name = &Parameter6Name + return params } -func (params *CreateSiprecParams) SetParameter6Value(Parameter6Value string) *CreateSiprecParams { - params.Parameter6Value = &Parameter6Value - return params +func (params *CreateSiprecParams) SetParameter6Value(Parameter6Value string) (*CreateSiprecParams){ + params.Parameter6Value = &Parameter6Value + return params } -func (params *CreateSiprecParams) SetParameter7Name(Parameter7Name string) *CreateSiprecParams { - params.Parameter7Name = &Parameter7Name - return params +func (params *CreateSiprecParams) SetParameter7Name(Parameter7Name string) (*CreateSiprecParams){ + params.Parameter7Name = &Parameter7Name + return params } -func (params *CreateSiprecParams) SetParameter7Value(Parameter7Value string) *CreateSiprecParams { - params.Parameter7Value = &Parameter7Value - return params +func (params *CreateSiprecParams) SetParameter7Value(Parameter7Value string) (*CreateSiprecParams){ + params.Parameter7Value = &Parameter7Value + return params } -func (params *CreateSiprecParams) SetParameter8Name(Parameter8Name string) *CreateSiprecParams { - params.Parameter8Name = &Parameter8Name - return params +func (params *CreateSiprecParams) SetParameter8Name(Parameter8Name string) (*CreateSiprecParams){ + params.Parameter8Name = &Parameter8Name + return params } -func (params *CreateSiprecParams) SetParameter8Value(Parameter8Value string) *CreateSiprecParams { - params.Parameter8Value = &Parameter8Value - return params +func (params *CreateSiprecParams) SetParameter8Value(Parameter8Value string) (*CreateSiprecParams){ + params.Parameter8Value = &Parameter8Value + return params } -func (params *CreateSiprecParams) SetParameter9Name(Parameter9Name string) *CreateSiprecParams { - params.Parameter9Name = &Parameter9Name - return params +func (params *CreateSiprecParams) SetParameter9Name(Parameter9Name string) (*CreateSiprecParams){ + params.Parameter9Name = &Parameter9Name + return params } -func (params *CreateSiprecParams) SetParameter9Value(Parameter9Value string) *CreateSiprecParams { - params.Parameter9Value = &Parameter9Value - return params +func (params *CreateSiprecParams) SetParameter9Value(Parameter9Value string) (*CreateSiprecParams){ + params.Parameter9Value = &Parameter9Value + return params } -func (params *CreateSiprecParams) SetParameter10Name(Parameter10Name string) *CreateSiprecParams { - params.Parameter10Name = &Parameter10Name - return params +func (params *CreateSiprecParams) SetParameter10Name(Parameter10Name string) (*CreateSiprecParams){ + params.Parameter10Name = &Parameter10Name + return params } -func (params *CreateSiprecParams) SetParameter10Value(Parameter10Value string) *CreateSiprecParams { - params.Parameter10Value = &Parameter10Value - return params +func (params *CreateSiprecParams) SetParameter10Value(Parameter10Value string) (*CreateSiprecParams){ + params.Parameter10Value = &Parameter10Value + return params } -func (params *CreateSiprecParams) SetParameter11Name(Parameter11Name string) *CreateSiprecParams { - params.Parameter11Name = &Parameter11Name - return params +func (params *CreateSiprecParams) SetParameter11Name(Parameter11Name string) (*CreateSiprecParams){ + params.Parameter11Name = &Parameter11Name + return params } -func (params *CreateSiprecParams) SetParameter11Value(Parameter11Value string) *CreateSiprecParams { - params.Parameter11Value = &Parameter11Value - return params +func (params *CreateSiprecParams) SetParameter11Value(Parameter11Value string) (*CreateSiprecParams){ + params.Parameter11Value = &Parameter11Value + return params } -func (params *CreateSiprecParams) SetParameter12Name(Parameter12Name string) *CreateSiprecParams { - params.Parameter12Name = &Parameter12Name - return params +func (params *CreateSiprecParams) SetParameter12Name(Parameter12Name string) (*CreateSiprecParams){ + params.Parameter12Name = &Parameter12Name + return params } -func (params *CreateSiprecParams) SetParameter12Value(Parameter12Value string) *CreateSiprecParams { - params.Parameter12Value = &Parameter12Value - return params +func (params *CreateSiprecParams) SetParameter12Value(Parameter12Value string) (*CreateSiprecParams){ + params.Parameter12Value = &Parameter12Value + return params } -func (params *CreateSiprecParams) SetParameter13Name(Parameter13Name string) *CreateSiprecParams { - params.Parameter13Name = &Parameter13Name - return params +func (params *CreateSiprecParams) SetParameter13Name(Parameter13Name string) (*CreateSiprecParams){ + params.Parameter13Name = &Parameter13Name + return params } -func (params *CreateSiprecParams) SetParameter13Value(Parameter13Value string) *CreateSiprecParams { - params.Parameter13Value = &Parameter13Value - return params +func (params *CreateSiprecParams) SetParameter13Value(Parameter13Value string) (*CreateSiprecParams){ + params.Parameter13Value = &Parameter13Value + return params } -func (params *CreateSiprecParams) SetParameter14Name(Parameter14Name string) *CreateSiprecParams { - params.Parameter14Name = &Parameter14Name - return params +func (params *CreateSiprecParams) SetParameter14Name(Parameter14Name string) (*CreateSiprecParams){ + params.Parameter14Name = &Parameter14Name + return params } -func (params *CreateSiprecParams) SetParameter14Value(Parameter14Value string) *CreateSiprecParams { - params.Parameter14Value = &Parameter14Value - return params +func (params *CreateSiprecParams) SetParameter14Value(Parameter14Value string) (*CreateSiprecParams){ + params.Parameter14Value = &Parameter14Value + return params } -func (params *CreateSiprecParams) SetParameter15Name(Parameter15Name string) *CreateSiprecParams { - params.Parameter15Name = &Parameter15Name - return params +func (params *CreateSiprecParams) SetParameter15Name(Parameter15Name string) (*CreateSiprecParams){ + params.Parameter15Name = &Parameter15Name + return params } -func (params *CreateSiprecParams) SetParameter15Value(Parameter15Value string) *CreateSiprecParams { - params.Parameter15Value = &Parameter15Value - return params +func (params *CreateSiprecParams) SetParameter15Value(Parameter15Value string) (*CreateSiprecParams){ + params.Parameter15Value = &Parameter15Value + return params } -func (params *CreateSiprecParams) SetParameter16Name(Parameter16Name string) *CreateSiprecParams { - params.Parameter16Name = &Parameter16Name - return params +func (params *CreateSiprecParams) SetParameter16Name(Parameter16Name string) (*CreateSiprecParams){ + params.Parameter16Name = &Parameter16Name + return params } -func (params *CreateSiprecParams) SetParameter16Value(Parameter16Value string) *CreateSiprecParams { - params.Parameter16Value = &Parameter16Value - return params +func (params *CreateSiprecParams) SetParameter16Value(Parameter16Value string) (*CreateSiprecParams){ + params.Parameter16Value = &Parameter16Value + return params } -func (params *CreateSiprecParams) SetParameter17Name(Parameter17Name string) *CreateSiprecParams { - params.Parameter17Name = &Parameter17Name - return params +func (params *CreateSiprecParams) SetParameter17Name(Parameter17Name string) (*CreateSiprecParams){ + params.Parameter17Name = &Parameter17Name + return params } -func (params *CreateSiprecParams) SetParameter17Value(Parameter17Value string) *CreateSiprecParams { - params.Parameter17Value = &Parameter17Value - return params +func (params *CreateSiprecParams) SetParameter17Value(Parameter17Value string) (*CreateSiprecParams){ + params.Parameter17Value = &Parameter17Value + return params } -func (params *CreateSiprecParams) SetParameter18Name(Parameter18Name string) *CreateSiprecParams { - params.Parameter18Name = &Parameter18Name - return params +func (params *CreateSiprecParams) SetParameter18Name(Parameter18Name string) (*CreateSiprecParams){ + params.Parameter18Name = &Parameter18Name + return params } -func (params *CreateSiprecParams) SetParameter18Value(Parameter18Value string) *CreateSiprecParams { - params.Parameter18Value = &Parameter18Value - return params +func (params *CreateSiprecParams) SetParameter18Value(Parameter18Value string) (*CreateSiprecParams){ + params.Parameter18Value = &Parameter18Value + return params } -func (params *CreateSiprecParams) SetParameter19Name(Parameter19Name string) *CreateSiprecParams { - params.Parameter19Name = &Parameter19Name - return params +func (params *CreateSiprecParams) SetParameter19Name(Parameter19Name string) (*CreateSiprecParams){ + params.Parameter19Name = &Parameter19Name + return params } -func (params *CreateSiprecParams) SetParameter19Value(Parameter19Value string) *CreateSiprecParams { - params.Parameter19Value = &Parameter19Value - return params +func (params *CreateSiprecParams) SetParameter19Value(Parameter19Value string) (*CreateSiprecParams){ + params.Parameter19Value = &Parameter19Value + return params } -func (params *CreateSiprecParams) SetParameter20Name(Parameter20Name string) *CreateSiprecParams { - params.Parameter20Name = &Parameter20Name - return params +func (params *CreateSiprecParams) SetParameter20Name(Parameter20Name string) (*CreateSiprecParams){ + params.Parameter20Name = &Parameter20Name + return params } -func (params *CreateSiprecParams) SetParameter20Value(Parameter20Value string) *CreateSiprecParams { - params.Parameter20Value = &Parameter20Value - return params +func (params *CreateSiprecParams) SetParameter20Value(Parameter20Value string) (*CreateSiprecParams){ + params.Parameter20Value = &Parameter20Value + return params } -func (params *CreateSiprecParams) SetParameter21Name(Parameter21Name string) *CreateSiprecParams { - params.Parameter21Name = &Parameter21Name - return params +func (params *CreateSiprecParams) SetParameter21Name(Parameter21Name string) (*CreateSiprecParams){ + params.Parameter21Name = &Parameter21Name + return params } -func (params *CreateSiprecParams) SetParameter21Value(Parameter21Value string) *CreateSiprecParams { - params.Parameter21Value = &Parameter21Value - return params +func (params *CreateSiprecParams) SetParameter21Value(Parameter21Value string) (*CreateSiprecParams){ + params.Parameter21Value = &Parameter21Value + return params } -func (params *CreateSiprecParams) SetParameter22Name(Parameter22Name string) *CreateSiprecParams { - params.Parameter22Name = &Parameter22Name - return params +func (params *CreateSiprecParams) SetParameter22Name(Parameter22Name string) (*CreateSiprecParams){ + params.Parameter22Name = &Parameter22Name + return params } -func (params *CreateSiprecParams) SetParameter22Value(Parameter22Value string) *CreateSiprecParams { - params.Parameter22Value = &Parameter22Value - return params +func (params *CreateSiprecParams) SetParameter22Value(Parameter22Value string) (*CreateSiprecParams){ + params.Parameter22Value = &Parameter22Value + return params } -func (params *CreateSiprecParams) SetParameter23Name(Parameter23Name string) *CreateSiprecParams { - params.Parameter23Name = &Parameter23Name - return params +func (params *CreateSiprecParams) SetParameter23Name(Parameter23Name string) (*CreateSiprecParams){ + params.Parameter23Name = &Parameter23Name + return params } -func (params *CreateSiprecParams) SetParameter23Value(Parameter23Value string) *CreateSiprecParams { - params.Parameter23Value = &Parameter23Value - return params +func (params *CreateSiprecParams) SetParameter23Value(Parameter23Value string) (*CreateSiprecParams){ + params.Parameter23Value = &Parameter23Value + return params } -func (params *CreateSiprecParams) SetParameter24Name(Parameter24Name string) *CreateSiprecParams { - params.Parameter24Name = &Parameter24Name - return params +func (params *CreateSiprecParams) SetParameter24Name(Parameter24Name string) (*CreateSiprecParams){ + params.Parameter24Name = &Parameter24Name + return params } -func (params *CreateSiprecParams) SetParameter24Value(Parameter24Value string) *CreateSiprecParams { - params.Parameter24Value = &Parameter24Value - return params +func (params *CreateSiprecParams) SetParameter24Value(Parameter24Value string) (*CreateSiprecParams){ + params.Parameter24Value = &Parameter24Value + return params } -func (params *CreateSiprecParams) SetParameter25Name(Parameter25Name string) *CreateSiprecParams { - params.Parameter25Name = &Parameter25Name - return params +func (params *CreateSiprecParams) SetParameter25Name(Parameter25Name string) (*CreateSiprecParams){ + params.Parameter25Name = &Parameter25Name + return params } -func (params *CreateSiprecParams) SetParameter25Value(Parameter25Value string) *CreateSiprecParams { - params.Parameter25Value = &Parameter25Value - return params +func (params *CreateSiprecParams) SetParameter25Value(Parameter25Value string) (*CreateSiprecParams){ + params.Parameter25Value = &Parameter25Value + return params } -func (params *CreateSiprecParams) SetParameter26Name(Parameter26Name string) *CreateSiprecParams { - params.Parameter26Name = &Parameter26Name - return params +func (params *CreateSiprecParams) SetParameter26Name(Parameter26Name string) (*CreateSiprecParams){ + params.Parameter26Name = &Parameter26Name + return params } -func (params *CreateSiprecParams) SetParameter26Value(Parameter26Value string) *CreateSiprecParams { - params.Parameter26Value = &Parameter26Value - return params +func (params *CreateSiprecParams) SetParameter26Value(Parameter26Value string) (*CreateSiprecParams){ + params.Parameter26Value = &Parameter26Value + return params } -func (params *CreateSiprecParams) SetParameter27Name(Parameter27Name string) *CreateSiprecParams { - params.Parameter27Name = &Parameter27Name - return params +func (params *CreateSiprecParams) SetParameter27Name(Parameter27Name string) (*CreateSiprecParams){ + params.Parameter27Name = &Parameter27Name + return params } -func (params *CreateSiprecParams) SetParameter27Value(Parameter27Value string) *CreateSiprecParams { - params.Parameter27Value = &Parameter27Value - return params +func (params *CreateSiprecParams) SetParameter27Value(Parameter27Value string) (*CreateSiprecParams){ + params.Parameter27Value = &Parameter27Value + return params } -func (params *CreateSiprecParams) SetParameter28Name(Parameter28Name string) *CreateSiprecParams { - params.Parameter28Name = &Parameter28Name - return params +func (params *CreateSiprecParams) SetParameter28Name(Parameter28Name string) (*CreateSiprecParams){ + params.Parameter28Name = &Parameter28Name + return params } -func (params *CreateSiprecParams) SetParameter28Value(Parameter28Value string) *CreateSiprecParams { - params.Parameter28Value = &Parameter28Value - return params +func (params *CreateSiprecParams) SetParameter28Value(Parameter28Value string) (*CreateSiprecParams){ + params.Parameter28Value = &Parameter28Value + return params } -func (params *CreateSiprecParams) SetParameter29Name(Parameter29Name string) *CreateSiprecParams { - params.Parameter29Name = &Parameter29Name - return params +func (params *CreateSiprecParams) SetParameter29Name(Parameter29Name string) (*CreateSiprecParams){ + params.Parameter29Name = &Parameter29Name + return params } -func (params *CreateSiprecParams) SetParameter29Value(Parameter29Value string) *CreateSiprecParams { - params.Parameter29Value = &Parameter29Value - return params +func (params *CreateSiprecParams) SetParameter29Value(Parameter29Value string) (*CreateSiprecParams){ + params.Parameter29Value = &Parameter29Value + return params } -func (params *CreateSiprecParams) SetParameter30Name(Parameter30Name string) *CreateSiprecParams { - params.Parameter30Name = &Parameter30Name - return params +func (params *CreateSiprecParams) SetParameter30Name(Parameter30Name string) (*CreateSiprecParams){ + params.Parameter30Name = &Parameter30Name + return params } -func (params *CreateSiprecParams) SetParameter30Value(Parameter30Value string) *CreateSiprecParams { - params.Parameter30Value = &Parameter30Value - return params +func (params *CreateSiprecParams) SetParameter30Value(Parameter30Value string) (*CreateSiprecParams){ + params.Parameter30Value = &Parameter30Value + return params } -func (params *CreateSiprecParams) SetParameter31Name(Parameter31Name string) *CreateSiprecParams { - params.Parameter31Name = &Parameter31Name - return params +func (params *CreateSiprecParams) SetParameter31Name(Parameter31Name string) (*CreateSiprecParams){ + params.Parameter31Name = &Parameter31Name + return params } -func (params *CreateSiprecParams) SetParameter31Value(Parameter31Value string) *CreateSiprecParams { - params.Parameter31Value = &Parameter31Value - return params +func (params *CreateSiprecParams) SetParameter31Value(Parameter31Value string) (*CreateSiprecParams){ + params.Parameter31Value = &Parameter31Value + return params } -func (params *CreateSiprecParams) SetParameter32Name(Parameter32Name string) *CreateSiprecParams { - params.Parameter32Name = &Parameter32Name - return params +func (params *CreateSiprecParams) SetParameter32Name(Parameter32Name string) (*CreateSiprecParams){ + params.Parameter32Name = &Parameter32Name + return params } -func (params *CreateSiprecParams) SetParameter32Value(Parameter32Value string) *CreateSiprecParams { - params.Parameter32Value = &Parameter32Value - return params +func (params *CreateSiprecParams) SetParameter32Value(Parameter32Value string) (*CreateSiprecParams){ + params.Parameter32Value = &Parameter32Value + return params } -func (params *CreateSiprecParams) SetParameter33Name(Parameter33Name string) *CreateSiprecParams { - params.Parameter33Name = &Parameter33Name - return params +func (params *CreateSiprecParams) SetParameter33Name(Parameter33Name string) (*CreateSiprecParams){ + params.Parameter33Name = &Parameter33Name + return params } -func (params *CreateSiprecParams) SetParameter33Value(Parameter33Value string) *CreateSiprecParams { - params.Parameter33Value = &Parameter33Value - return params +func (params *CreateSiprecParams) SetParameter33Value(Parameter33Value string) (*CreateSiprecParams){ + params.Parameter33Value = &Parameter33Value + return params } -func (params *CreateSiprecParams) SetParameter34Name(Parameter34Name string) *CreateSiprecParams { - params.Parameter34Name = &Parameter34Name - return params +func (params *CreateSiprecParams) SetParameter34Name(Parameter34Name string) (*CreateSiprecParams){ + params.Parameter34Name = &Parameter34Name + return params } -func (params *CreateSiprecParams) SetParameter34Value(Parameter34Value string) *CreateSiprecParams { - params.Parameter34Value = &Parameter34Value - return params +func (params *CreateSiprecParams) SetParameter34Value(Parameter34Value string) (*CreateSiprecParams){ + params.Parameter34Value = &Parameter34Value + return params } -func (params *CreateSiprecParams) SetParameter35Name(Parameter35Name string) *CreateSiprecParams { - params.Parameter35Name = &Parameter35Name - return params +func (params *CreateSiprecParams) SetParameter35Name(Parameter35Name string) (*CreateSiprecParams){ + params.Parameter35Name = &Parameter35Name + return params } -func (params *CreateSiprecParams) SetParameter35Value(Parameter35Value string) *CreateSiprecParams { - params.Parameter35Value = &Parameter35Value - return params +func (params *CreateSiprecParams) SetParameter35Value(Parameter35Value string) (*CreateSiprecParams){ + params.Parameter35Value = &Parameter35Value + return params } -func (params *CreateSiprecParams) SetParameter36Name(Parameter36Name string) *CreateSiprecParams { - params.Parameter36Name = &Parameter36Name - return params +func (params *CreateSiprecParams) SetParameter36Name(Parameter36Name string) (*CreateSiprecParams){ + params.Parameter36Name = &Parameter36Name + return params } -func (params *CreateSiprecParams) SetParameter36Value(Parameter36Value string) *CreateSiprecParams { - params.Parameter36Value = &Parameter36Value - return params +func (params *CreateSiprecParams) SetParameter36Value(Parameter36Value string) (*CreateSiprecParams){ + params.Parameter36Value = &Parameter36Value + return params } -func (params *CreateSiprecParams) SetParameter37Name(Parameter37Name string) *CreateSiprecParams { - params.Parameter37Name = &Parameter37Name - return params +func (params *CreateSiprecParams) SetParameter37Name(Parameter37Name string) (*CreateSiprecParams){ + params.Parameter37Name = &Parameter37Name + return params } -func (params *CreateSiprecParams) SetParameter37Value(Parameter37Value string) *CreateSiprecParams { - params.Parameter37Value = &Parameter37Value - return params +func (params *CreateSiprecParams) SetParameter37Value(Parameter37Value string) (*CreateSiprecParams){ + params.Parameter37Value = &Parameter37Value + return params } -func (params *CreateSiprecParams) SetParameter38Name(Parameter38Name string) *CreateSiprecParams { - params.Parameter38Name = &Parameter38Name - return params +func (params *CreateSiprecParams) SetParameter38Name(Parameter38Name string) (*CreateSiprecParams){ + params.Parameter38Name = &Parameter38Name + return params } -func (params *CreateSiprecParams) SetParameter38Value(Parameter38Value string) *CreateSiprecParams { - params.Parameter38Value = &Parameter38Value - return params +func (params *CreateSiprecParams) SetParameter38Value(Parameter38Value string) (*CreateSiprecParams){ + params.Parameter38Value = &Parameter38Value + return params } -func (params *CreateSiprecParams) SetParameter39Name(Parameter39Name string) *CreateSiprecParams { - params.Parameter39Name = &Parameter39Name - return params +func (params *CreateSiprecParams) SetParameter39Name(Parameter39Name string) (*CreateSiprecParams){ + params.Parameter39Name = &Parameter39Name + return params } -func (params *CreateSiprecParams) SetParameter39Value(Parameter39Value string) *CreateSiprecParams { - params.Parameter39Value = &Parameter39Value - return params +func (params *CreateSiprecParams) SetParameter39Value(Parameter39Value string) (*CreateSiprecParams){ + params.Parameter39Value = &Parameter39Value + return params } -func (params *CreateSiprecParams) SetParameter40Name(Parameter40Name string) *CreateSiprecParams { - params.Parameter40Name = &Parameter40Name - return params +func (params *CreateSiprecParams) SetParameter40Name(Parameter40Name string) (*CreateSiprecParams){ + params.Parameter40Name = &Parameter40Name + return params } -func (params *CreateSiprecParams) SetParameter40Value(Parameter40Value string) *CreateSiprecParams { - params.Parameter40Value = &Parameter40Value - return params +func (params *CreateSiprecParams) SetParameter40Value(Parameter40Value string) (*CreateSiprecParams){ + params.Parameter40Value = &Parameter40Value + return params } -func (params *CreateSiprecParams) SetParameter41Name(Parameter41Name string) *CreateSiprecParams { - params.Parameter41Name = &Parameter41Name - return params +func (params *CreateSiprecParams) SetParameter41Name(Parameter41Name string) (*CreateSiprecParams){ + params.Parameter41Name = &Parameter41Name + return params } -func (params *CreateSiprecParams) SetParameter41Value(Parameter41Value string) *CreateSiprecParams { - params.Parameter41Value = &Parameter41Value - return params +func (params *CreateSiprecParams) SetParameter41Value(Parameter41Value string) (*CreateSiprecParams){ + params.Parameter41Value = &Parameter41Value + return params } -func (params *CreateSiprecParams) SetParameter42Name(Parameter42Name string) *CreateSiprecParams { - params.Parameter42Name = &Parameter42Name - return params +func (params *CreateSiprecParams) SetParameter42Name(Parameter42Name string) (*CreateSiprecParams){ + params.Parameter42Name = &Parameter42Name + return params } -func (params *CreateSiprecParams) SetParameter42Value(Parameter42Value string) *CreateSiprecParams { - params.Parameter42Value = &Parameter42Value - return params +func (params *CreateSiprecParams) SetParameter42Value(Parameter42Value string) (*CreateSiprecParams){ + params.Parameter42Value = &Parameter42Value + return params } -func (params *CreateSiprecParams) SetParameter43Name(Parameter43Name string) *CreateSiprecParams { - params.Parameter43Name = &Parameter43Name - return params +func (params *CreateSiprecParams) SetParameter43Name(Parameter43Name string) (*CreateSiprecParams){ + params.Parameter43Name = &Parameter43Name + return params } -func (params *CreateSiprecParams) SetParameter43Value(Parameter43Value string) *CreateSiprecParams { - params.Parameter43Value = &Parameter43Value - return params +func (params *CreateSiprecParams) SetParameter43Value(Parameter43Value string) (*CreateSiprecParams){ + params.Parameter43Value = &Parameter43Value + return params } -func (params *CreateSiprecParams) SetParameter44Name(Parameter44Name string) *CreateSiprecParams { - params.Parameter44Name = &Parameter44Name - return params +func (params *CreateSiprecParams) SetParameter44Name(Parameter44Name string) (*CreateSiprecParams){ + params.Parameter44Name = &Parameter44Name + return params } -func (params *CreateSiprecParams) SetParameter44Value(Parameter44Value string) *CreateSiprecParams { - params.Parameter44Value = &Parameter44Value - return params +func (params *CreateSiprecParams) SetParameter44Value(Parameter44Value string) (*CreateSiprecParams){ + params.Parameter44Value = &Parameter44Value + return params } -func (params *CreateSiprecParams) SetParameter45Name(Parameter45Name string) *CreateSiprecParams { - params.Parameter45Name = &Parameter45Name - return params +func (params *CreateSiprecParams) SetParameter45Name(Parameter45Name string) (*CreateSiprecParams){ + params.Parameter45Name = &Parameter45Name + return params } -func (params *CreateSiprecParams) SetParameter45Value(Parameter45Value string) *CreateSiprecParams { - params.Parameter45Value = &Parameter45Value - return params +func (params *CreateSiprecParams) SetParameter45Value(Parameter45Value string) (*CreateSiprecParams){ + params.Parameter45Value = &Parameter45Value + return params } -func (params *CreateSiprecParams) SetParameter46Name(Parameter46Name string) *CreateSiprecParams { - params.Parameter46Name = &Parameter46Name - return params +func (params *CreateSiprecParams) SetParameter46Name(Parameter46Name string) (*CreateSiprecParams){ + params.Parameter46Name = &Parameter46Name + return params } -func (params *CreateSiprecParams) SetParameter46Value(Parameter46Value string) *CreateSiprecParams { - params.Parameter46Value = &Parameter46Value - return params +func (params *CreateSiprecParams) SetParameter46Value(Parameter46Value string) (*CreateSiprecParams){ + params.Parameter46Value = &Parameter46Value + return params } -func (params *CreateSiprecParams) SetParameter47Name(Parameter47Name string) *CreateSiprecParams { - params.Parameter47Name = &Parameter47Name - return params +func (params *CreateSiprecParams) SetParameter47Name(Parameter47Name string) (*CreateSiprecParams){ + params.Parameter47Name = &Parameter47Name + return params } -func (params *CreateSiprecParams) SetParameter47Value(Parameter47Value string) *CreateSiprecParams { - params.Parameter47Value = &Parameter47Value - return params +func (params *CreateSiprecParams) SetParameter47Value(Parameter47Value string) (*CreateSiprecParams){ + params.Parameter47Value = &Parameter47Value + return params } -func (params *CreateSiprecParams) SetParameter48Name(Parameter48Name string) *CreateSiprecParams { - params.Parameter48Name = &Parameter48Name - return params +func (params *CreateSiprecParams) SetParameter48Name(Parameter48Name string) (*CreateSiprecParams){ + params.Parameter48Name = &Parameter48Name + return params } -func (params *CreateSiprecParams) SetParameter48Value(Parameter48Value string) *CreateSiprecParams { - params.Parameter48Value = &Parameter48Value - return params +func (params *CreateSiprecParams) SetParameter48Value(Parameter48Value string) (*CreateSiprecParams){ + params.Parameter48Value = &Parameter48Value + return params } -func (params *CreateSiprecParams) SetParameter49Name(Parameter49Name string) *CreateSiprecParams { - params.Parameter49Name = &Parameter49Name - return params +func (params *CreateSiprecParams) SetParameter49Name(Parameter49Name string) (*CreateSiprecParams){ + params.Parameter49Name = &Parameter49Name + return params } -func (params *CreateSiprecParams) SetParameter49Value(Parameter49Value string) *CreateSiprecParams { - params.Parameter49Value = &Parameter49Value - return params +func (params *CreateSiprecParams) SetParameter49Value(Parameter49Value string) (*CreateSiprecParams){ + params.Parameter49Value = &Parameter49Value + return params } -func (params *CreateSiprecParams) SetParameter50Name(Parameter50Name string) *CreateSiprecParams { - params.Parameter50Name = &Parameter50Name - return params +func (params *CreateSiprecParams) SetParameter50Name(Parameter50Name string) (*CreateSiprecParams){ + params.Parameter50Name = &Parameter50Name + return params } -func (params *CreateSiprecParams) SetParameter50Value(Parameter50Value string) *CreateSiprecParams { - params.Parameter50Value = &Parameter50Value - return params +func (params *CreateSiprecParams) SetParameter50Value(Parameter50Value string) (*CreateSiprecParams){ + params.Parameter50Value = &Parameter50Value + return params } -func (params *CreateSiprecParams) SetParameter51Name(Parameter51Name string) *CreateSiprecParams { - params.Parameter51Name = &Parameter51Name - return params +func (params *CreateSiprecParams) SetParameter51Name(Parameter51Name string) (*CreateSiprecParams){ + params.Parameter51Name = &Parameter51Name + return params } -func (params *CreateSiprecParams) SetParameter51Value(Parameter51Value string) *CreateSiprecParams { - params.Parameter51Value = &Parameter51Value - return params +func (params *CreateSiprecParams) SetParameter51Value(Parameter51Value string) (*CreateSiprecParams){ + params.Parameter51Value = &Parameter51Value + return params } -func (params *CreateSiprecParams) SetParameter52Name(Parameter52Name string) *CreateSiprecParams { - params.Parameter52Name = &Parameter52Name - return params +func (params *CreateSiprecParams) SetParameter52Name(Parameter52Name string) (*CreateSiprecParams){ + params.Parameter52Name = &Parameter52Name + return params } -func (params *CreateSiprecParams) SetParameter52Value(Parameter52Value string) *CreateSiprecParams { - params.Parameter52Value = &Parameter52Value - return params +func (params *CreateSiprecParams) SetParameter52Value(Parameter52Value string) (*CreateSiprecParams){ + params.Parameter52Value = &Parameter52Value + return params } -func (params *CreateSiprecParams) SetParameter53Name(Parameter53Name string) *CreateSiprecParams { - params.Parameter53Name = &Parameter53Name - return params +func (params *CreateSiprecParams) SetParameter53Name(Parameter53Name string) (*CreateSiprecParams){ + params.Parameter53Name = &Parameter53Name + return params } -func (params *CreateSiprecParams) SetParameter53Value(Parameter53Value string) *CreateSiprecParams { - params.Parameter53Value = &Parameter53Value - return params +func (params *CreateSiprecParams) SetParameter53Value(Parameter53Value string) (*CreateSiprecParams){ + params.Parameter53Value = &Parameter53Value + return params } -func (params *CreateSiprecParams) SetParameter54Name(Parameter54Name string) *CreateSiprecParams { - params.Parameter54Name = &Parameter54Name - return params +func (params *CreateSiprecParams) SetParameter54Name(Parameter54Name string) (*CreateSiprecParams){ + params.Parameter54Name = &Parameter54Name + return params } -func (params *CreateSiprecParams) SetParameter54Value(Parameter54Value string) *CreateSiprecParams { - params.Parameter54Value = &Parameter54Value - return params +func (params *CreateSiprecParams) SetParameter54Value(Parameter54Value string) (*CreateSiprecParams){ + params.Parameter54Value = &Parameter54Value + return params } -func (params *CreateSiprecParams) SetParameter55Name(Parameter55Name string) *CreateSiprecParams { - params.Parameter55Name = &Parameter55Name - return params +func (params *CreateSiprecParams) SetParameter55Name(Parameter55Name string) (*CreateSiprecParams){ + params.Parameter55Name = &Parameter55Name + return params } -func (params *CreateSiprecParams) SetParameter55Value(Parameter55Value string) *CreateSiprecParams { - params.Parameter55Value = &Parameter55Value - return params +func (params *CreateSiprecParams) SetParameter55Value(Parameter55Value string) (*CreateSiprecParams){ + params.Parameter55Value = &Parameter55Value + return params } -func (params *CreateSiprecParams) SetParameter56Name(Parameter56Name string) *CreateSiprecParams { - params.Parameter56Name = &Parameter56Name - return params +func (params *CreateSiprecParams) SetParameter56Name(Parameter56Name string) (*CreateSiprecParams){ + params.Parameter56Name = &Parameter56Name + return params } -func (params *CreateSiprecParams) SetParameter56Value(Parameter56Value string) *CreateSiprecParams { - params.Parameter56Value = &Parameter56Value - return params +func (params *CreateSiprecParams) SetParameter56Value(Parameter56Value string) (*CreateSiprecParams){ + params.Parameter56Value = &Parameter56Value + return params } -func (params *CreateSiprecParams) SetParameter57Name(Parameter57Name string) *CreateSiprecParams { - params.Parameter57Name = &Parameter57Name - return params +func (params *CreateSiprecParams) SetParameter57Name(Parameter57Name string) (*CreateSiprecParams){ + params.Parameter57Name = &Parameter57Name + return params } -func (params *CreateSiprecParams) SetParameter57Value(Parameter57Value string) *CreateSiprecParams { - params.Parameter57Value = &Parameter57Value - return params +func (params *CreateSiprecParams) SetParameter57Value(Parameter57Value string) (*CreateSiprecParams){ + params.Parameter57Value = &Parameter57Value + return params } -func (params *CreateSiprecParams) SetParameter58Name(Parameter58Name string) *CreateSiprecParams { - params.Parameter58Name = &Parameter58Name - return params +func (params *CreateSiprecParams) SetParameter58Name(Parameter58Name string) (*CreateSiprecParams){ + params.Parameter58Name = &Parameter58Name + return params } -func (params *CreateSiprecParams) SetParameter58Value(Parameter58Value string) *CreateSiprecParams { - params.Parameter58Value = &Parameter58Value - return params +func (params *CreateSiprecParams) SetParameter58Value(Parameter58Value string) (*CreateSiprecParams){ + params.Parameter58Value = &Parameter58Value + return params } -func (params *CreateSiprecParams) SetParameter59Name(Parameter59Name string) *CreateSiprecParams { - params.Parameter59Name = &Parameter59Name - return params +func (params *CreateSiprecParams) SetParameter59Name(Parameter59Name string) (*CreateSiprecParams){ + params.Parameter59Name = &Parameter59Name + return params } -func (params *CreateSiprecParams) SetParameter59Value(Parameter59Value string) *CreateSiprecParams { - params.Parameter59Value = &Parameter59Value - return params +func (params *CreateSiprecParams) SetParameter59Value(Parameter59Value string) (*CreateSiprecParams){ + params.Parameter59Value = &Parameter59Value + return params } -func (params *CreateSiprecParams) SetParameter60Name(Parameter60Name string) *CreateSiprecParams { - params.Parameter60Name = &Parameter60Name - return params +func (params *CreateSiprecParams) SetParameter60Name(Parameter60Name string) (*CreateSiprecParams){ + params.Parameter60Name = &Parameter60Name + return params } -func (params *CreateSiprecParams) SetParameter60Value(Parameter60Value string) *CreateSiprecParams { - params.Parameter60Value = &Parameter60Value - return params +func (params *CreateSiprecParams) SetParameter60Value(Parameter60Value string) (*CreateSiprecParams){ + params.Parameter60Value = &Parameter60Value + return params } -func (params *CreateSiprecParams) SetParameter61Name(Parameter61Name string) *CreateSiprecParams { - params.Parameter61Name = &Parameter61Name - return params +func (params *CreateSiprecParams) SetParameter61Name(Parameter61Name string) (*CreateSiprecParams){ + params.Parameter61Name = &Parameter61Name + return params } -func (params *CreateSiprecParams) SetParameter61Value(Parameter61Value string) *CreateSiprecParams { - params.Parameter61Value = &Parameter61Value - return params +func (params *CreateSiprecParams) SetParameter61Value(Parameter61Value string) (*CreateSiprecParams){ + params.Parameter61Value = &Parameter61Value + return params } -func (params *CreateSiprecParams) SetParameter62Name(Parameter62Name string) *CreateSiprecParams { - params.Parameter62Name = &Parameter62Name - return params +func (params *CreateSiprecParams) SetParameter62Name(Parameter62Name string) (*CreateSiprecParams){ + params.Parameter62Name = &Parameter62Name + return params } -func (params *CreateSiprecParams) SetParameter62Value(Parameter62Value string) *CreateSiprecParams { - params.Parameter62Value = &Parameter62Value - return params +func (params *CreateSiprecParams) SetParameter62Value(Parameter62Value string) (*CreateSiprecParams){ + params.Parameter62Value = &Parameter62Value + return params } -func (params *CreateSiprecParams) SetParameter63Name(Parameter63Name string) *CreateSiprecParams { - params.Parameter63Name = &Parameter63Name - return params +func (params *CreateSiprecParams) SetParameter63Name(Parameter63Name string) (*CreateSiprecParams){ + params.Parameter63Name = &Parameter63Name + return params } -func (params *CreateSiprecParams) SetParameter63Value(Parameter63Value string) *CreateSiprecParams { - params.Parameter63Value = &Parameter63Value - return params +func (params *CreateSiprecParams) SetParameter63Value(Parameter63Value string) (*CreateSiprecParams){ + params.Parameter63Value = &Parameter63Value + return params } -func (params *CreateSiprecParams) SetParameter64Name(Parameter64Name string) *CreateSiprecParams { - params.Parameter64Name = &Parameter64Name - return params +func (params *CreateSiprecParams) SetParameter64Name(Parameter64Name string) (*CreateSiprecParams){ + params.Parameter64Name = &Parameter64Name + return params } -func (params *CreateSiprecParams) SetParameter64Value(Parameter64Value string) *CreateSiprecParams { - params.Parameter64Value = &Parameter64Value - return params +func (params *CreateSiprecParams) SetParameter64Value(Parameter64Value string) (*CreateSiprecParams){ + params.Parameter64Value = &Parameter64Value + return params } -func (params *CreateSiprecParams) SetParameter65Name(Parameter65Name string) *CreateSiprecParams { - params.Parameter65Name = &Parameter65Name - return params +func (params *CreateSiprecParams) SetParameter65Name(Parameter65Name string) (*CreateSiprecParams){ + params.Parameter65Name = &Parameter65Name + return params } -func (params *CreateSiprecParams) SetParameter65Value(Parameter65Value string) *CreateSiprecParams { - params.Parameter65Value = &Parameter65Value - return params +func (params *CreateSiprecParams) SetParameter65Value(Parameter65Value string) (*CreateSiprecParams){ + params.Parameter65Value = &Parameter65Value + return params } -func (params *CreateSiprecParams) SetParameter66Name(Parameter66Name string) *CreateSiprecParams { - params.Parameter66Name = &Parameter66Name - return params +func (params *CreateSiprecParams) SetParameter66Name(Parameter66Name string) (*CreateSiprecParams){ + params.Parameter66Name = &Parameter66Name + return params } -func (params *CreateSiprecParams) SetParameter66Value(Parameter66Value string) *CreateSiprecParams { - params.Parameter66Value = &Parameter66Value - return params +func (params *CreateSiprecParams) SetParameter66Value(Parameter66Value string) (*CreateSiprecParams){ + params.Parameter66Value = &Parameter66Value + return params } -func (params *CreateSiprecParams) SetParameter67Name(Parameter67Name string) *CreateSiprecParams { - params.Parameter67Name = &Parameter67Name - return params +func (params *CreateSiprecParams) SetParameter67Name(Parameter67Name string) (*CreateSiprecParams){ + params.Parameter67Name = &Parameter67Name + return params } -func (params *CreateSiprecParams) SetParameter67Value(Parameter67Value string) *CreateSiprecParams { - params.Parameter67Value = &Parameter67Value - return params +func (params *CreateSiprecParams) SetParameter67Value(Parameter67Value string) (*CreateSiprecParams){ + params.Parameter67Value = &Parameter67Value + return params } -func (params *CreateSiprecParams) SetParameter68Name(Parameter68Name string) *CreateSiprecParams { - params.Parameter68Name = &Parameter68Name - return params +func (params *CreateSiprecParams) SetParameter68Name(Parameter68Name string) (*CreateSiprecParams){ + params.Parameter68Name = &Parameter68Name + return params } -func (params *CreateSiprecParams) SetParameter68Value(Parameter68Value string) *CreateSiprecParams { - params.Parameter68Value = &Parameter68Value - return params +func (params *CreateSiprecParams) SetParameter68Value(Parameter68Value string) (*CreateSiprecParams){ + params.Parameter68Value = &Parameter68Value + return params } -func (params *CreateSiprecParams) SetParameter69Name(Parameter69Name string) *CreateSiprecParams { - params.Parameter69Name = &Parameter69Name - return params +func (params *CreateSiprecParams) SetParameter69Name(Parameter69Name string) (*CreateSiprecParams){ + params.Parameter69Name = &Parameter69Name + return params } -func (params *CreateSiprecParams) SetParameter69Value(Parameter69Value string) *CreateSiprecParams { - params.Parameter69Value = &Parameter69Value - return params +func (params *CreateSiprecParams) SetParameter69Value(Parameter69Value string) (*CreateSiprecParams){ + params.Parameter69Value = &Parameter69Value + return params } -func (params *CreateSiprecParams) SetParameter70Name(Parameter70Name string) *CreateSiprecParams { - params.Parameter70Name = &Parameter70Name - return params +func (params *CreateSiprecParams) SetParameter70Name(Parameter70Name string) (*CreateSiprecParams){ + params.Parameter70Name = &Parameter70Name + return params } -func (params *CreateSiprecParams) SetParameter70Value(Parameter70Value string) *CreateSiprecParams { - params.Parameter70Value = &Parameter70Value - return params +func (params *CreateSiprecParams) SetParameter70Value(Parameter70Value string) (*CreateSiprecParams){ + params.Parameter70Value = &Parameter70Value + return params } -func (params *CreateSiprecParams) SetParameter71Name(Parameter71Name string) *CreateSiprecParams { - params.Parameter71Name = &Parameter71Name - return params +func (params *CreateSiprecParams) SetParameter71Name(Parameter71Name string) (*CreateSiprecParams){ + params.Parameter71Name = &Parameter71Name + return params } -func (params *CreateSiprecParams) SetParameter71Value(Parameter71Value string) *CreateSiprecParams { - params.Parameter71Value = &Parameter71Value - return params +func (params *CreateSiprecParams) SetParameter71Value(Parameter71Value string) (*CreateSiprecParams){ + params.Parameter71Value = &Parameter71Value + return params } -func (params *CreateSiprecParams) SetParameter72Name(Parameter72Name string) *CreateSiprecParams { - params.Parameter72Name = &Parameter72Name - return params +func (params *CreateSiprecParams) SetParameter72Name(Parameter72Name string) (*CreateSiprecParams){ + params.Parameter72Name = &Parameter72Name + return params } -func (params *CreateSiprecParams) SetParameter72Value(Parameter72Value string) *CreateSiprecParams { - params.Parameter72Value = &Parameter72Value - return params +func (params *CreateSiprecParams) SetParameter72Value(Parameter72Value string) (*CreateSiprecParams){ + params.Parameter72Value = &Parameter72Value + return params } -func (params *CreateSiprecParams) SetParameter73Name(Parameter73Name string) *CreateSiprecParams { - params.Parameter73Name = &Parameter73Name - return params +func (params *CreateSiprecParams) SetParameter73Name(Parameter73Name string) (*CreateSiprecParams){ + params.Parameter73Name = &Parameter73Name + return params } -func (params *CreateSiprecParams) SetParameter73Value(Parameter73Value string) *CreateSiprecParams { - params.Parameter73Value = &Parameter73Value - return params +func (params *CreateSiprecParams) SetParameter73Value(Parameter73Value string) (*CreateSiprecParams){ + params.Parameter73Value = &Parameter73Value + return params } -func (params *CreateSiprecParams) SetParameter74Name(Parameter74Name string) *CreateSiprecParams { - params.Parameter74Name = &Parameter74Name - return params +func (params *CreateSiprecParams) SetParameter74Name(Parameter74Name string) (*CreateSiprecParams){ + params.Parameter74Name = &Parameter74Name + return params } -func (params *CreateSiprecParams) SetParameter74Value(Parameter74Value string) *CreateSiprecParams { - params.Parameter74Value = &Parameter74Value - return params +func (params *CreateSiprecParams) SetParameter74Value(Parameter74Value string) (*CreateSiprecParams){ + params.Parameter74Value = &Parameter74Value + return params } -func (params *CreateSiprecParams) SetParameter75Name(Parameter75Name string) *CreateSiprecParams { - params.Parameter75Name = &Parameter75Name - return params +func (params *CreateSiprecParams) SetParameter75Name(Parameter75Name string) (*CreateSiprecParams){ + params.Parameter75Name = &Parameter75Name + return params } -func (params *CreateSiprecParams) SetParameter75Value(Parameter75Value string) *CreateSiprecParams { - params.Parameter75Value = &Parameter75Value - return params +func (params *CreateSiprecParams) SetParameter75Value(Parameter75Value string) (*CreateSiprecParams){ + params.Parameter75Value = &Parameter75Value + return params } -func (params *CreateSiprecParams) SetParameter76Name(Parameter76Name string) *CreateSiprecParams { - params.Parameter76Name = &Parameter76Name - return params +func (params *CreateSiprecParams) SetParameter76Name(Parameter76Name string) (*CreateSiprecParams){ + params.Parameter76Name = &Parameter76Name + return params } -func (params *CreateSiprecParams) SetParameter76Value(Parameter76Value string) *CreateSiprecParams { - params.Parameter76Value = &Parameter76Value - return params +func (params *CreateSiprecParams) SetParameter76Value(Parameter76Value string) (*CreateSiprecParams){ + params.Parameter76Value = &Parameter76Value + return params } -func (params *CreateSiprecParams) SetParameter77Name(Parameter77Name string) *CreateSiprecParams { - params.Parameter77Name = &Parameter77Name - return params +func (params *CreateSiprecParams) SetParameter77Name(Parameter77Name string) (*CreateSiprecParams){ + params.Parameter77Name = &Parameter77Name + return params } -func (params *CreateSiprecParams) SetParameter77Value(Parameter77Value string) *CreateSiprecParams { - params.Parameter77Value = &Parameter77Value - return params +func (params *CreateSiprecParams) SetParameter77Value(Parameter77Value string) (*CreateSiprecParams){ + params.Parameter77Value = &Parameter77Value + return params } -func (params *CreateSiprecParams) SetParameter78Name(Parameter78Name string) *CreateSiprecParams { - params.Parameter78Name = &Parameter78Name - return params +func (params *CreateSiprecParams) SetParameter78Name(Parameter78Name string) (*CreateSiprecParams){ + params.Parameter78Name = &Parameter78Name + return params } -func (params *CreateSiprecParams) SetParameter78Value(Parameter78Value string) *CreateSiprecParams { - params.Parameter78Value = &Parameter78Value - return params +func (params *CreateSiprecParams) SetParameter78Value(Parameter78Value string) (*CreateSiprecParams){ + params.Parameter78Value = &Parameter78Value + return params } -func (params *CreateSiprecParams) SetParameter79Name(Parameter79Name string) *CreateSiprecParams { - params.Parameter79Name = &Parameter79Name - return params +func (params *CreateSiprecParams) SetParameter79Name(Parameter79Name string) (*CreateSiprecParams){ + params.Parameter79Name = &Parameter79Name + return params } -func (params *CreateSiprecParams) SetParameter79Value(Parameter79Value string) *CreateSiprecParams { - params.Parameter79Value = &Parameter79Value - return params +func (params *CreateSiprecParams) SetParameter79Value(Parameter79Value string) (*CreateSiprecParams){ + params.Parameter79Value = &Parameter79Value + return params } -func (params *CreateSiprecParams) SetParameter80Name(Parameter80Name string) *CreateSiprecParams { - params.Parameter80Name = &Parameter80Name - return params +func (params *CreateSiprecParams) SetParameter80Name(Parameter80Name string) (*CreateSiprecParams){ + params.Parameter80Name = &Parameter80Name + return params } -func (params *CreateSiprecParams) SetParameter80Value(Parameter80Value string) *CreateSiprecParams { - params.Parameter80Value = &Parameter80Value - return params +func (params *CreateSiprecParams) SetParameter80Value(Parameter80Value string) (*CreateSiprecParams){ + params.Parameter80Value = &Parameter80Value + return params } -func (params *CreateSiprecParams) SetParameter81Name(Parameter81Name string) *CreateSiprecParams { - params.Parameter81Name = &Parameter81Name - return params +func (params *CreateSiprecParams) SetParameter81Name(Parameter81Name string) (*CreateSiprecParams){ + params.Parameter81Name = &Parameter81Name + return params } -func (params *CreateSiprecParams) SetParameter81Value(Parameter81Value string) *CreateSiprecParams { - params.Parameter81Value = &Parameter81Value - return params +func (params *CreateSiprecParams) SetParameter81Value(Parameter81Value string) (*CreateSiprecParams){ + params.Parameter81Value = &Parameter81Value + return params } -func (params *CreateSiprecParams) SetParameter82Name(Parameter82Name string) *CreateSiprecParams { - params.Parameter82Name = &Parameter82Name - return params +func (params *CreateSiprecParams) SetParameter82Name(Parameter82Name string) (*CreateSiprecParams){ + params.Parameter82Name = &Parameter82Name + return params } -func (params *CreateSiprecParams) SetParameter82Value(Parameter82Value string) *CreateSiprecParams { - params.Parameter82Value = &Parameter82Value - return params +func (params *CreateSiprecParams) SetParameter82Value(Parameter82Value string) (*CreateSiprecParams){ + params.Parameter82Value = &Parameter82Value + return params } -func (params *CreateSiprecParams) SetParameter83Name(Parameter83Name string) *CreateSiprecParams { - params.Parameter83Name = &Parameter83Name - return params +func (params *CreateSiprecParams) SetParameter83Name(Parameter83Name string) (*CreateSiprecParams){ + params.Parameter83Name = &Parameter83Name + return params } -func (params *CreateSiprecParams) SetParameter83Value(Parameter83Value string) *CreateSiprecParams { - params.Parameter83Value = &Parameter83Value - return params +func (params *CreateSiprecParams) SetParameter83Value(Parameter83Value string) (*CreateSiprecParams){ + params.Parameter83Value = &Parameter83Value + return params } -func (params *CreateSiprecParams) SetParameter84Name(Parameter84Name string) *CreateSiprecParams { - params.Parameter84Name = &Parameter84Name - return params +func (params *CreateSiprecParams) SetParameter84Name(Parameter84Name string) (*CreateSiprecParams){ + params.Parameter84Name = &Parameter84Name + return params } -func (params *CreateSiprecParams) SetParameter84Value(Parameter84Value string) *CreateSiprecParams { - params.Parameter84Value = &Parameter84Value - return params +func (params *CreateSiprecParams) SetParameter84Value(Parameter84Value string) (*CreateSiprecParams){ + params.Parameter84Value = &Parameter84Value + return params } -func (params *CreateSiprecParams) SetParameter85Name(Parameter85Name string) *CreateSiprecParams { - params.Parameter85Name = &Parameter85Name - return params +func (params *CreateSiprecParams) SetParameter85Name(Parameter85Name string) (*CreateSiprecParams){ + params.Parameter85Name = &Parameter85Name + return params } -func (params *CreateSiprecParams) SetParameter85Value(Parameter85Value string) *CreateSiprecParams { - params.Parameter85Value = &Parameter85Value - return params +func (params *CreateSiprecParams) SetParameter85Value(Parameter85Value string) (*CreateSiprecParams){ + params.Parameter85Value = &Parameter85Value + return params } -func (params *CreateSiprecParams) SetParameter86Name(Parameter86Name string) *CreateSiprecParams { - params.Parameter86Name = &Parameter86Name - return params +func (params *CreateSiprecParams) SetParameter86Name(Parameter86Name string) (*CreateSiprecParams){ + params.Parameter86Name = &Parameter86Name + return params } -func (params *CreateSiprecParams) SetParameter86Value(Parameter86Value string) *CreateSiprecParams { - params.Parameter86Value = &Parameter86Value - return params +func (params *CreateSiprecParams) SetParameter86Value(Parameter86Value string) (*CreateSiprecParams){ + params.Parameter86Value = &Parameter86Value + return params } -func (params *CreateSiprecParams) SetParameter87Name(Parameter87Name string) *CreateSiprecParams { - params.Parameter87Name = &Parameter87Name - return params +func (params *CreateSiprecParams) SetParameter87Name(Parameter87Name string) (*CreateSiprecParams){ + params.Parameter87Name = &Parameter87Name + return params } -func (params *CreateSiprecParams) SetParameter87Value(Parameter87Value string) *CreateSiprecParams { - params.Parameter87Value = &Parameter87Value - return params +func (params *CreateSiprecParams) SetParameter87Value(Parameter87Value string) (*CreateSiprecParams){ + params.Parameter87Value = &Parameter87Value + return params } -func (params *CreateSiprecParams) SetParameter88Name(Parameter88Name string) *CreateSiprecParams { - params.Parameter88Name = &Parameter88Name - return params +func (params *CreateSiprecParams) SetParameter88Name(Parameter88Name string) (*CreateSiprecParams){ + params.Parameter88Name = &Parameter88Name + return params } -func (params *CreateSiprecParams) SetParameter88Value(Parameter88Value string) *CreateSiprecParams { - params.Parameter88Value = &Parameter88Value - return params +func (params *CreateSiprecParams) SetParameter88Value(Parameter88Value string) (*CreateSiprecParams){ + params.Parameter88Value = &Parameter88Value + return params } -func (params *CreateSiprecParams) SetParameter89Name(Parameter89Name string) *CreateSiprecParams { - params.Parameter89Name = &Parameter89Name - return params +func (params *CreateSiprecParams) SetParameter89Name(Parameter89Name string) (*CreateSiprecParams){ + params.Parameter89Name = &Parameter89Name + return params } -func (params *CreateSiprecParams) SetParameter89Value(Parameter89Value string) *CreateSiprecParams { - params.Parameter89Value = &Parameter89Value - return params +func (params *CreateSiprecParams) SetParameter89Value(Parameter89Value string) (*CreateSiprecParams){ + params.Parameter89Value = &Parameter89Value + return params } -func (params *CreateSiprecParams) SetParameter90Name(Parameter90Name string) *CreateSiprecParams { - params.Parameter90Name = &Parameter90Name - return params +func (params *CreateSiprecParams) SetParameter90Name(Parameter90Name string) (*CreateSiprecParams){ + params.Parameter90Name = &Parameter90Name + return params } -func (params *CreateSiprecParams) SetParameter90Value(Parameter90Value string) *CreateSiprecParams { - params.Parameter90Value = &Parameter90Value - return params +func (params *CreateSiprecParams) SetParameter90Value(Parameter90Value string) (*CreateSiprecParams){ + params.Parameter90Value = &Parameter90Value + return params } -func (params *CreateSiprecParams) SetParameter91Name(Parameter91Name string) *CreateSiprecParams { - params.Parameter91Name = &Parameter91Name - return params +func (params *CreateSiprecParams) SetParameter91Name(Parameter91Name string) (*CreateSiprecParams){ + params.Parameter91Name = &Parameter91Name + return params } -func (params *CreateSiprecParams) SetParameter91Value(Parameter91Value string) *CreateSiprecParams { - params.Parameter91Value = &Parameter91Value - return params +func (params *CreateSiprecParams) SetParameter91Value(Parameter91Value string) (*CreateSiprecParams){ + params.Parameter91Value = &Parameter91Value + return params } -func (params *CreateSiprecParams) SetParameter92Name(Parameter92Name string) *CreateSiprecParams { - params.Parameter92Name = &Parameter92Name - return params +func (params *CreateSiprecParams) SetParameter92Name(Parameter92Name string) (*CreateSiprecParams){ + params.Parameter92Name = &Parameter92Name + return params } -func (params *CreateSiprecParams) SetParameter92Value(Parameter92Value string) *CreateSiprecParams { - params.Parameter92Value = &Parameter92Value - return params +func (params *CreateSiprecParams) SetParameter92Value(Parameter92Value string) (*CreateSiprecParams){ + params.Parameter92Value = &Parameter92Value + return params } -func (params *CreateSiprecParams) SetParameter93Name(Parameter93Name string) *CreateSiprecParams { - params.Parameter93Name = &Parameter93Name - return params +func (params *CreateSiprecParams) SetParameter93Name(Parameter93Name string) (*CreateSiprecParams){ + params.Parameter93Name = &Parameter93Name + return params } -func (params *CreateSiprecParams) SetParameter93Value(Parameter93Value string) *CreateSiprecParams { - params.Parameter93Value = &Parameter93Value - return params +func (params *CreateSiprecParams) SetParameter93Value(Parameter93Value string) (*CreateSiprecParams){ + params.Parameter93Value = &Parameter93Value + return params } -func (params *CreateSiprecParams) SetParameter94Name(Parameter94Name string) *CreateSiprecParams { - params.Parameter94Name = &Parameter94Name - return params +func (params *CreateSiprecParams) SetParameter94Name(Parameter94Name string) (*CreateSiprecParams){ + params.Parameter94Name = &Parameter94Name + return params } -func (params *CreateSiprecParams) SetParameter94Value(Parameter94Value string) *CreateSiprecParams { - params.Parameter94Value = &Parameter94Value - return params +func (params *CreateSiprecParams) SetParameter94Value(Parameter94Value string) (*CreateSiprecParams){ + params.Parameter94Value = &Parameter94Value + return params } -func (params *CreateSiprecParams) SetParameter95Name(Parameter95Name string) *CreateSiprecParams { - params.Parameter95Name = &Parameter95Name - return params +func (params *CreateSiprecParams) SetParameter95Name(Parameter95Name string) (*CreateSiprecParams){ + params.Parameter95Name = &Parameter95Name + return params } -func (params *CreateSiprecParams) SetParameter95Value(Parameter95Value string) *CreateSiprecParams { - params.Parameter95Value = &Parameter95Value - return params +func (params *CreateSiprecParams) SetParameter95Value(Parameter95Value string) (*CreateSiprecParams){ + params.Parameter95Value = &Parameter95Value + return params } -func (params *CreateSiprecParams) SetParameter96Name(Parameter96Name string) *CreateSiprecParams { - params.Parameter96Name = &Parameter96Name - return params +func (params *CreateSiprecParams) SetParameter96Name(Parameter96Name string) (*CreateSiprecParams){ + params.Parameter96Name = &Parameter96Name + return params } -func (params *CreateSiprecParams) SetParameter96Value(Parameter96Value string) *CreateSiprecParams { - params.Parameter96Value = &Parameter96Value - return params +func (params *CreateSiprecParams) SetParameter96Value(Parameter96Value string) (*CreateSiprecParams){ + params.Parameter96Value = &Parameter96Value + return params } -func (params *CreateSiprecParams) SetParameter97Name(Parameter97Name string) *CreateSiprecParams { - params.Parameter97Name = &Parameter97Name - return params +func (params *CreateSiprecParams) SetParameter97Name(Parameter97Name string) (*CreateSiprecParams){ + params.Parameter97Name = &Parameter97Name + return params } -func (params *CreateSiprecParams) SetParameter97Value(Parameter97Value string) *CreateSiprecParams { - params.Parameter97Value = &Parameter97Value - return params +func (params *CreateSiprecParams) SetParameter97Value(Parameter97Value string) (*CreateSiprecParams){ + params.Parameter97Value = &Parameter97Value + return params } -func (params *CreateSiprecParams) SetParameter98Name(Parameter98Name string) *CreateSiprecParams { - params.Parameter98Name = &Parameter98Name - return params +func (params *CreateSiprecParams) SetParameter98Name(Parameter98Name string) (*CreateSiprecParams){ + params.Parameter98Name = &Parameter98Name + return params } -func (params *CreateSiprecParams) SetParameter98Value(Parameter98Value string) *CreateSiprecParams { - params.Parameter98Value = &Parameter98Value - return params +func (params *CreateSiprecParams) SetParameter98Value(Parameter98Value string) (*CreateSiprecParams){ + params.Parameter98Value = &Parameter98Value + return params } -func (params *CreateSiprecParams) SetParameter99Name(Parameter99Name string) *CreateSiprecParams { - params.Parameter99Name = &Parameter99Name - return params +func (params *CreateSiprecParams) SetParameter99Name(Parameter99Name string) (*CreateSiprecParams){ + params.Parameter99Name = &Parameter99Name + return params } -func (params *CreateSiprecParams) SetParameter99Value(Parameter99Value string) *CreateSiprecParams { - params.Parameter99Value = &Parameter99Value - return params +func (params *CreateSiprecParams) SetParameter99Value(Parameter99Value string) (*CreateSiprecParams){ + params.Parameter99Value = &Parameter99Value + return params } // Create a Siprec func (c *ApiService) CreateSiprec(CallSid string, params *CreateSiprecParams) (*ApiV2010Siprec, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Name != nil { - data.Set("Name", *params.Name) - } - if params != nil && params.ConnectorName != nil { - data.Set("ConnectorName", *params.ConnectorName) - } - if params != nil && params.Track != nil { - data.Set("Track", *params.Track) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.Parameter1Name != nil { - data.Set("Parameter1.Name", *params.Parameter1Name) - } - if params != nil && params.Parameter1Value != nil { - data.Set("Parameter1.Value", *params.Parameter1Value) - } - if params != nil && params.Parameter2Name != nil { - data.Set("Parameter2.Name", *params.Parameter2Name) - } - if params != nil && params.Parameter2Value != nil { - data.Set("Parameter2.Value", *params.Parameter2Value) - } - if params != nil && params.Parameter3Name != nil { - data.Set("Parameter3.Name", *params.Parameter3Name) - } - if params != nil && params.Parameter3Value != nil { - data.Set("Parameter3.Value", *params.Parameter3Value) - } - if params != nil && params.Parameter4Name != nil { - data.Set("Parameter4.Name", *params.Parameter4Name) - } - if params != nil && params.Parameter4Value != nil { - data.Set("Parameter4.Value", *params.Parameter4Value) - } - if params != nil && params.Parameter5Name != nil { - data.Set("Parameter5.Name", *params.Parameter5Name) - } - if params != nil && params.Parameter5Value != nil { - data.Set("Parameter5.Value", *params.Parameter5Value) - } - if params != nil && params.Parameter6Name != nil { - data.Set("Parameter6.Name", *params.Parameter6Name) - } - if params != nil && params.Parameter6Value != nil { - data.Set("Parameter6.Value", *params.Parameter6Value) - } - if params != nil && params.Parameter7Name != nil { - data.Set("Parameter7.Name", *params.Parameter7Name) - } - if params != nil && params.Parameter7Value != nil { - data.Set("Parameter7.Value", *params.Parameter7Value) - } - if params != nil && params.Parameter8Name != nil { - data.Set("Parameter8.Name", *params.Parameter8Name) - } - if params != nil && params.Parameter8Value != nil { - data.Set("Parameter8.Value", *params.Parameter8Value) - } - if params != nil && params.Parameter9Name != nil { - data.Set("Parameter9.Name", *params.Parameter9Name) - } - if params != nil && params.Parameter9Value != nil { - data.Set("Parameter9.Value", *params.Parameter9Value) - } - if params != nil && params.Parameter10Name != nil { - data.Set("Parameter10.Name", *params.Parameter10Name) - } - if params != nil && params.Parameter10Value != nil { - data.Set("Parameter10.Value", *params.Parameter10Value) - } - if params != nil && params.Parameter11Name != nil { - data.Set("Parameter11.Name", *params.Parameter11Name) - } - if params != nil && params.Parameter11Value != nil { - data.Set("Parameter11.Value", *params.Parameter11Value) - } - if params != nil && params.Parameter12Name != nil { - data.Set("Parameter12.Name", *params.Parameter12Name) - } - if params != nil && params.Parameter12Value != nil { - data.Set("Parameter12.Value", *params.Parameter12Value) - } - if params != nil && params.Parameter13Name != nil { - data.Set("Parameter13.Name", *params.Parameter13Name) - } - if params != nil && params.Parameter13Value != nil { - data.Set("Parameter13.Value", *params.Parameter13Value) - } - if params != nil && params.Parameter14Name != nil { - data.Set("Parameter14.Name", *params.Parameter14Name) - } - if params != nil && params.Parameter14Value != nil { - data.Set("Parameter14.Value", *params.Parameter14Value) - } - if params != nil && params.Parameter15Name != nil { - data.Set("Parameter15.Name", *params.Parameter15Name) - } - if params != nil && params.Parameter15Value != nil { - data.Set("Parameter15.Value", *params.Parameter15Value) - } - if params != nil && params.Parameter16Name != nil { - data.Set("Parameter16.Name", *params.Parameter16Name) - } - if params != nil && params.Parameter16Value != nil { - data.Set("Parameter16.Value", *params.Parameter16Value) - } - if params != nil && params.Parameter17Name != nil { - data.Set("Parameter17.Name", *params.Parameter17Name) - } - if params != nil && params.Parameter17Value != nil { - data.Set("Parameter17.Value", *params.Parameter17Value) - } - if params != nil && params.Parameter18Name != nil { - data.Set("Parameter18.Name", *params.Parameter18Name) - } - if params != nil && params.Parameter18Value != nil { - data.Set("Parameter18.Value", *params.Parameter18Value) - } - if params != nil && params.Parameter19Name != nil { - data.Set("Parameter19.Name", *params.Parameter19Name) - } - if params != nil && params.Parameter19Value != nil { - data.Set("Parameter19.Value", *params.Parameter19Value) - } - if params != nil && params.Parameter20Name != nil { - data.Set("Parameter20.Name", *params.Parameter20Name) - } - if params != nil && params.Parameter20Value != nil { - data.Set("Parameter20.Value", *params.Parameter20Value) - } - if params != nil && params.Parameter21Name != nil { - data.Set("Parameter21.Name", *params.Parameter21Name) - } - if params != nil && params.Parameter21Value != nil { - data.Set("Parameter21.Value", *params.Parameter21Value) - } - if params != nil && params.Parameter22Name != nil { - data.Set("Parameter22.Name", *params.Parameter22Name) - } - if params != nil && params.Parameter22Value != nil { - data.Set("Parameter22.Value", *params.Parameter22Value) - } - if params != nil && params.Parameter23Name != nil { - data.Set("Parameter23.Name", *params.Parameter23Name) - } - if params != nil && params.Parameter23Value != nil { - data.Set("Parameter23.Value", *params.Parameter23Value) - } - if params != nil && params.Parameter24Name != nil { - data.Set("Parameter24.Name", *params.Parameter24Name) - } - if params != nil && params.Parameter24Value != nil { - data.Set("Parameter24.Value", *params.Parameter24Value) - } - if params != nil && params.Parameter25Name != nil { - data.Set("Parameter25.Name", *params.Parameter25Name) - } - if params != nil && params.Parameter25Value != nil { - data.Set("Parameter25.Value", *params.Parameter25Value) - } - if params != nil && params.Parameter26Name != nil { - data.Set("Parameter26.Name", *params.Parameter26Name) - } - if params != nil && params.Parameter26Value != nil { - data.Set("Parameter26.Value", *params.Parameter26Value) - } - if params != nil && params.Parameter27Name != nil { - data.Set("Parameter27.Name", *params.Parameter27Name) - } - if params != nil && params.Parameter27Value != nil { - data.Set("Parameter27.Value", *params.Parameter27Value) - } - if params != nil && params.Parameter28Name != nil { - data.Set("Parameter28.Name", *params.Parameter28Name) - } - if params != nil && params.Parameter28Value != nil { - data.Set("Parameter28.Value", *params.Parameter28Value) - } - if params != nil && params.Parameter29Name != nil { - data.Set("Parameter29.Name", *params.Parameter29Name) - } - if params != nil && params.Parameter29Value != nil { - data.Set("Parameter29.Value", *params.Parameter29Value) - } - if params != nil && params.Parameter30Name != nil { - data.Set("Parameter30.Name", *params.Parameter30Name) - } - if params != nil && params.Parameter30Value != nil { - data.Set("Parameter30.Value", *params.Parameter30Value) - } - if params != nil && params.Parameter31Name != nil { - data.Set("Parameter31.Name", *params.Parameter31Name) - } - if params != nil && params.Parameter31Value != nil { - data.Set("Parameter31.Value", *params.Parameter31Value) - } - if params != nil && params.Parameter32Name != nil { - data.Set("Parameter32.Name", *params.Parameter32Name) - } - if params != nil && params.Parameter32Value != nil { - data.Set("Parameter32.Value", *params.Parameter32Value) - } - if params != nil && params.Parameter33Name != nil { - data.Set("Parameter33.Name", *params.Parameter33Name) - } - if params != nil && params.Parameter33Value != nil { - data.Set("Parameter33.Value", *params.Parameter33Value) - } - if params != nil && params.Parameter34Name != nil { - data.Set("Parameter34.Name", *params.Parameter34Name) - } - if params != nil && params.Parameter34Value != nil { - data.Set("Parameter34.Value", *params.Parameter34Value) - } - if params != nil && params.Parameter35Name != nil { - data.Set("Parameter35.Name", *params.Parameter35Name) - } - if params != nil && params.Parameter35Value != nil { - data.Set("Parameter35.Value", *params.Parameter35Value) - } - if params != nil && params.Parameter36Name != nil { - data.Set("Parameter36.Name", *params.Parameter36Name) - } - if params != nil && params.Parameter36Value != nil { - data.Set("Parameter36.Value", *params.Parameter36Value) - } - if params != nil && params.Parameter37Name != nil { - data.Set("Parameter37.Name", *params.Parameter37Name) - } - if params != nil && params.Parameter37Value != nil { - data.Set("Parameter37.Value", *params.Parameter37Value) - } - if params != nil && params.Parameter38Name != nil { - data.Set("Parameter38.Name", *params.Parameter38Name) - } - if params != nil && params.Parameter38Value != nil { - data.Set("Parameter38.Value", *params.Parameter38Value) - } - if params != nil && params.Parameter39Name != nil { - data.Set("Parameter39.Name", *params.Parameter39Name) - } - if params != nil && params.Parameter39Value != nil { - data.Set("Parameter39.Value", *params.Parameter39Value) - } - if params != nil && params.Parameter40Name != nil { - data.Set("Parameter40.Name", *params.Parameter40Name) - } - if params != nil && params.Parameter40Value != nil { - data.Set("Parameter40.Value", *params.Parameter40Value) - } - if params != nil && params.Parameter41Name != nil { - data.Set("Parameter41.Name", *params.Parameter41Name) - } - if params != nil && params.Parameter41Value != nil { - data.Set("Parameter41.Value", *params.Parameter41Value) - } - if params != nil && params.Parameter42Name != nil { - data.Set("Parameter42.Name", *params.Parameter42Name) - } - if params != nil && params.Parameter42Value != nil { - data.Set("Parameter42.Value", *params.Parameter42Value) - } - if params != nil && params.Parameter43Name != nil { - data.Set("Parameter43.Name", *params.Parameter43Name) - } - if params != nil && params.Parameter43Value != nil { - data.Set("Parameter43.Value", *params.Parameter43Value) - } - if params != nil && params.Parameter44Name != nil { - data.Set("Parameter44.Name", *params.Parameter44Name) - } - if params != nil && params.Parameter44Value != nil { - data.Set("Parameter44.Value", *params.Parameter44Value) - } - if params != nil && params.Parameter45Name != nil { - data.Set("Parameter45.Name", *params.Parameter45Name) - } - if params != nil && params.Parameter45Value != nil { - data.Set("Parameter45.Value", *params.Parameter45Value) - } - if params != nil && params.Parameter46Name != nil { - data.Set("Parameter46.Name", *params.Parameter46Name) - } - if params != nil && params.Parameter46Value != nil { - data.Set("Parameter46.Value", *params.Parameter46Value) - } - if params != nil && params.Parameter47Name != nil { - data.Set("Parameter47.Name", *params.Parameter47Name) - } - if params != nil && params.Parameter47Value != nil { - data.Set("Parameter47.Value", *params.Parameter47Value) - } - if params != nil && params.Parameter48Name != nil { - data.Set("Parameter48.Name", *params.Parameter48Name) - } - if params != nil && params.Parameter48Value != nil { - data.Set("Parameter48.Value", *params.Parameter48Value) - } - if params != nil && params.Parameter49Name != nil { - data.Set("Parameter49.Name", *params.Parameter49Name) - } - if params != nil && params.Parameter49Value != nil { - data.Set("Parameter49.Value", *params.Parameter49Value) - } - if params != nil && params.Parameter50Name != nil { - data.Set("Parameter50.Name", *params.Parameter50Name) - } - if params != nil && params.Parameter50Value != nil { - data.Set("Parameter50.Value", *params.Parameter50Value) - } - if params != nil && params.Parameter51Name != nil { - data.Set("Parameter51.Name", *params.Parameter51Name) - } - if params != nil && params.Parameter51Value != nil { - data.Set("Parameter51.Value", *params.Parameter51Value) - } - if params != nil && params.Parameter52Name != nil { - data.Set("Parameter52.Name", *params.Parameter52Name) - } - if params != nil && params.Parameter52Value != nil { - data.Set("Parameter52.Value", *params.Parameter52Value) - } - if params != nil && params.Parameter53Name != nil { - data.Set("Parameter53.Name", *params.Parameter53Name) - } - if params != nil && params.Parameter53Value != nil { - data.Set("Parameter53.Value", *params.Parameter53Value) - } - if params != nil && params.Parameter54Name != nil { - data.Set("Parameter54.Name", *params.Parameter54Name) - } - if params != nil && params.Parameter54Value != nil { - data.Set("Parameter54.Value", *params.Parameter54Value) - } - if params != nil && params.Parameter55Name != nil { - data.Set("Parameter55.Name", *params.Parameter55Name) - } - if params != nil && params.Parameter55Value != nil { - data.Set("Parameter55.Value", *params.Parameter55Value) - } - if params != nil && params.Parameter56Name != nil { - data.Set("Parameter56.Name", *params.Parameter56Name) - } - if params != nil && params.Parameter56Value != nil { - data.Set("Parameter56.Value", *params.Parameter56Value) - } - if params != nil && params.Parameter57Name != nil { - data.Set("Parameter57.Name", *params.Parameter57Name) - } - if params != nil && params.Parameter57Value != nil { - data.Set("Parameter57.Value", *params.Parameter57Value) - } - if params != nil && params.Parameter58Name != nil { - data.Set("Parameter58.Name", *params.Parameter58Name) - } - if params != nil && params.Parameter58Value != nil { - data.Set("Parameter58.Value", *params.Parameter58Value) - } - if params != nil && params.Parameter59Name != nil { - data.Set("Parameter59.Name", *params.Parameter59Name) - } - if params != nil && params.Parameter59Value != nil { - data.Set("Parameter59.Value", *params.Parameter59Value) - } - if params != nil && params.Parameter60Name != nil { - data.Set("Parameter60.Name", *params.Parameter60Name) - } - if params != nil && params.Parameter60Value != nil { - data.Set("Parameter60.Value", *params.Parameter60Value) - } - if params != nil && params.Parameter61Name != nil { - data.Set("Parameter61.Name", *params.Parameter61Name) - } - if params != nil && params.Parameter61Value != nil { - data.Set("Parameter61.Value", *params.Parameter61Value) - } - if params != nil && params.Parameter62Name != nil { - data.Set("Parameter62.Name", *params.Parameter62Name) - } - if params != nil && params.Parameter62Value != nil { - data.Set("Parameter62.Value", *params.Parameter62Value) - } - if params != nil && params.Parameter63Name != nil { - data.Set("Parameter63.Name", *params.Parameter63Name) - } - if params != nil && params.Parameter63Value != nil { - data.Set("Parameter63.Value", *params.Parameter63Value) - } - if params != nil && params.Parameter64Name != nil { - data.Set("Parameter64.Name", *params.Parameter64Name) - } - if params != nil && params.Parameter64Value != nil { - data.Set("Parameter64.Value", *params.Parameter64Value) - } - if params != nil && params.Parameter65Name != nil { - data.Set("Parameter65.Name", *params.Parameter65Name) - } - if params != nil && params.Parameter65Value != nil { - data.Set("Parameter65.Value", *params.Parameter65Value) - } - if params != nil && params.Parameter66Name != nil { - data.Set("Parameter66.Name", *params.Parameter66Name) - } - if params != nil && params.Parameter66Value != nil { - data.Set("Parameter66.Value", *params.Parameter66Value) - } - if params != nil && params.Parameter67Name != nil { - data.Set("Parameter67.Name", *params.Parameter67Name) - } - if params != nil && params.Parameter67Value != nil { - data.Set("Parameter67.Value", *params.Parameter67Value) - } - if params != nil && params.Parameter68Name != nil { - data.Set("Parameter68.Name", *params.Parameter68Name) - } - if params != nil && params.Parameter68Value != nil { - data.Set("Parameter68.Value", *params.Parameter68Value) - } - if params != nil && params.Parameter69Name != nil { - data.Set("Parameter69.Name", *params.Parameter69Name) - } - if params != nil && params.Parameter69Value != nil { - data.Set("Parameter69.Value", *params.Parameter69Value) - } - if params != nil && params.Parameter70Name != nil { - data.Set("Parameter70.Name", *params.Parameter70Name) - } - if params != nil && params.Parameter70Value != nil { - data.Set("Parameter70.Value", *params.Parameter70Value) - } - if params != nil && params.Parameter71Name != nil { - data.Set("Parameter71.Name", *params.Parameter71Name) - } - if params != nil && params.Parameter71Value != nil { - data.Set("Parameter71.Value", *params.Parameter71Value) - } - if params != nil && params.Parameter72Name != nil { - data.Set("Parameter72.Name", *params.Parameter72Name) - } - if params != nil && params.Parameter72Value != nil { - data.Set("Parameter72.Value", *params.Parameter72Value) - } - if params != nil && params.Parameter73Name != nil { - data.Set("Parameter73.Name", *params.Parameter73Name) - } - if params != nil && params.Parameter73Value != nil { - data.Set("Parameter73.Value", *params.Parameter73Value) - } - if params != nil && params.Parameter74Name != nil { - data.Set("Parameter74.Name", *params.Parameter74Name) - } - if params != nil && params.Parameter74Value != nil { - data.Set("Parameter74.Value", *params.Parameter74Value) - } - if params != nil && params.Parameter75Name != nil { - data.Set("Parameter75.Name", *params.Parameter75Name) - } - if params != nil && params.Parameter75Value != nil { - data.Set("Parameter75.Value", *params.Parameter75Value) - } - if params != nil && params.Parameter76Name != nil { - data.Set("Parameter76.Name", *params.Parameter76Name) - } - if params != nil && params.Parameter76Value != nil { - data.Set("Parameter76.Value", *params.Parameter76Value) - } - if params != nil && params.Parameter77Name != nil { - data.Set("Parameter77.Name", *params.Parameter77Name) - } - if params != nil && params.Parameter77Value != nil { - data.Set("Parameter77.Value", *params.Parameter77Value) - } - if params != nil && params.Parameter78Name != nil { - data.Set("Parameter78.Name", *params.Parameter78Name) - } - if params != nil && params.Parameter78Value != nil { - data.Set("Parameter78.Value", *params.Parameter78Value) - } - if params != nil && params.Parameter79Name != nil { - data.Set("Parameter79.Name", *params.Parameter79Name) - } - if params != nil && params.Parameter79Value != nil { - data.Set("Parameter79.Value", *params.Parameter79Value) - } - if params != nil && params.Parameter80Name != nil { - data.Set("Parameter80.Name", *params.Parameter80Name) - } - if params != nil && params.Parameter80Value != nil { - data.Set("Parameter80.Value", *params.Parameter80Value) - } - if params != nil && params.Parameter81Name != nil { - data.Set("Parameter81.Name", *params.Parameter81Name) - } - if params != nil && params.Parameter81Value != nil { - data.Set("Parameter81.Value", *params.Parameter81Value) - } - if params != nil && params.Parameter82Name != nil { - data.Set("Parameter82.Name", *params.Parameter82Name) - } - if params != nil && params.Parameter82Value != nil { - data.Set("Parameter82.Value", *params.Parameter82Value) - } - if params != nil && params.Parameter83Name != nil { - data.Set("Parameter83.Name", *params.Parameter83Name) - } - if params != nil && params.Parameter83Value != nil { - data.Set("Parameter83.Value", *params.Parameter83Value) - } - if params != nil && params.Parameter84Name != nil { - data.Set("Parameter84.Name", *params.Parameter84Name) - } - if params != nil && params.Parameter84Value != nil { - data.Set("Parameter84.Value", *params.Parameter84Value) - } - if params != nil && params.Parameter85Name != nil { - data.Set("Parameter85.Name", *params.Parameter85Name) - } - if params != nil && params.Parameter85Value != nil { - data.Set("Parameter85.Value", *params.Parameter85Value) - } - if params != nil && params.Parameter86Name != nil { - data.Set("Parameter86.Name", *params.Parameter86Name) - } - if params != nil && params.Parameter86Value != nil { - data.Set("Parameter86.Value", *params.Parameter86Value) - } - if params != nil && params.Parameter87Name != nil { - data.Set("Parameter87.Name", *params.Parameter87Name) - } - if params != nil && params.Parameter87Value != nil { - data.Set("Parameter87.Value", *params.Parameter87Value) - } - if params != nil && params.Parameter88Name != nil { - data.Set("Parameter88.Name", *params.Parameter88Name) - } - if params != nil && params.Parameter88Value != nil { - data.Set("Parameter88.Value", *params.Parameter88Value) - } - if params != nil && params.Parameter89Name != nil { - data.Set("Parameter89.Name", *params.Parameter89Name) - } - if params != nil && params.Parameter89Value != nil { - data.Set("Parameter89.Value", *params.Parameter89Value) - } - if params != nil && params.Parameter90Name != nil { - data.Set("Parameter90.Name", *params.Parameter90Name) - } - if params != nil && params.Parameter90Value != nil { - data.Set("Parameter90.Value", *params.Parameter90Value) - } - if params != nil && params.Parameter91Name != nil { - data.Set("Parameter91.Name", *params.Parameter91Name) - } - if params != nil && params.Parameter91Value != nil { - data.Set("Parameter91.Value", *params.Parameter91Value) - } - if params != nil && params.Parameter92Name != nil { - data.Set("Parameter92.Name", *params.Parameter92Name) - } - if params != nil && params.Parameter92Value != nil { - data.Set("Parameter92.Value", *params.Parameter92Value) - } - if params != nil && params.Parameter93Name != nil { - data.Set("Parameter93.Name", *params.Parameter93Name) - } - if params != nil && params.Parameter93Value != nil { - data.Set("Parameter93.Value", *params.Parameter93Value) - } - if params != nil && params.Parameter94Name != nil { - data.Set("Parameter94.Name", *params.Parameter94Name) - } - if params != nil && params.Parameter94Value != nil { - data.Set("Parameter94.Value", *params.Parameter94Value) - } - if params != nil && params.Parameter95Name != nil { - data.Set("Parameter95.Name", *params.Parameter95Name) - } - if params != nil && params.Parameter95Value != nil { - data.Set("Parameter95.Value", *params.Parameter95Value) - } - if params != nil && params.Parameter96Name != nil { - data.Set("Parameter96.Name", *params.Parameter96Name) - } - if params != nil && params.Parameter96Value != nil { - data.Set("Parameter96.Value", *params.Parameter96Value) - } - if params != nil && params.Parameter97Name != nil { - data.Set("Parameter97.Name", *params.Parameter97Name) - } - if params != nil && params.Parameter97Value != nil { - data.Set("Parameter97.Value", *params.Parameter97Value) - } - if params != nil && params.Parameter98Name != nil { - data.Set("Parameter98.Name", *params.Parameter98Name) - } - if params != nil && params.Parameter98Value != nil { - data.Set("Parameter98.Value", *params.Parameter98Value) - } - if params != nil && params.Parameter99Name != nil { - data.Set("Parameter99.Name", *params.Parameter99Name) - } - if params != nil && params.Parameter99Value != nil { - data.Set("Parameter99.Value", *params.Parameter99Value) - } + if params != nil && params.Name != nil { + data.Set("Name", *params.Name) + } + if params != nil && params.ConnectorName != nil { + data.Set("ConnectorName", *params.ConnectorName) + } + if params != nil && params.Track != nil { + data.Set("Track", *params.Track) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.Parameter1Name != nil { + data.Set("Parameter1.Name", *params.Parameter1Name) + } + if params != nil && params.Parameter1Value != nil { + data.Set("Parameter1.Value", *params.Parameter1Value) + } + if params != nil && params.Parameter2Name != nil { + data.Set("Parameter2.Name", *params.Parameter2Name) + } + if params != nil && params.Parameter2Value != nil { + data.Set("Parameter2.Value", *params.Parameter2Value) + } + if params != nil && params.Parameter3Name != nil { + data.Set("Parameter3.Name", *params.Parameter3Name) + } + if params != nil && params.Parameter3Value != nil { + data.Set("Parameter3.Value", *params.Parameter3Value) + } + if params != nil && params.Parameter4Name != nil { + data.Set("Parameter4.Name", *params.Parameter4Name) + } + if params != nil && params.Parameter4Value != nil { + data.Set("Parameter4.Value", *params.Parameter4Value) + } + if params != nil && params.Parameter5Name != nil { + data.Set("Parameter5.Name", *params.Parameter5Name) + } + if params != nil && params.Parameter5Value != nil { + data.Set("Parameter5.Value", *params.Parameter5Value) + } + if params != nil && params.Parameter6Name != nil { + data.Set("Parameter6.Name", *params.Parameter6Name) + } + if params != nil && params.Parameter6Value != nil { + data.Set("Parameter6.Value", *params.Parameter6Value) + } + if params != nil && params.Parameter7Name != nil { + data.Set("Parameter7.Name", *params.Parameter7Name) + } + if params != nil && params.Parameter7Value != nil { + data.Set("Parameter7.Value", *params.Parameter7Value) + } + if params != nil && params.Parameter8Name != nil { + data.Set("Parameter8.Name", *params.Parameter8Name) + } + if params != nil && params.Parameter8Value != nil { + data.Set("Parameter8.Value", *params.Parameter8Value) + } + if params != nil && params.Parameter9Name != nil { + data.Set("Parameter9.Name", *params.Parameter9Name) + } + if params != nil && params.Parameter9Value != nil { + data.Set("Parameter9.Value", *params.Parameter9Value) + } + if params != nil && params.Parameter10Name != nil { + data.Set("Parameter10.Name", *params.Parameter10Name) + } + if params != nil && params.Parameter10Value != nil { + data.Set("Parameter10.Value", *params.Parameter10Value) + } + if params != nil && params.Parameter11Name != nil { + data.Set("Parameter11.Name", *params.Parameter11Name) + } + if params != nil && params.Parameter11Value != nil { + data.Set("Parameter11.Value", *params.Parameter11Value) + } + if params != nil && params.Parameter12Name != nil { + data.Set("Parameter12.Name", *params.Parameter12Name) + } + if params != nil && params.Parameter12Value != nil { + data.Set("Parameter12.Value", *params.Parameter12Value) + } + if params != nil && params.Parameter13Name != nil { + data.Set("Parameter13.Name", *params.Parameter13Name) + } + if params != nil && params.Parameter13Value != nil { + data.Set("Parameter13.Value", *params.Parameter13Value) + } + if params != nil && params.Parameter14Name != nil { + data.Set("Parameter14.Name", *params.Parameter14Name) + } + if params != nil && params.Parameter14Value != nil { + data.Set("Parameter14.Value", *params.Parameter14Value) + } + if params != nil && params.Parameter15Name != nil { + data.Set("Parameter15.Name", *params.Parameter15Name) + } + if params != nil && params.Parameter15Value != nil { + data.Set("Parameter15.Value", *params.Parameter15Value) + } + if params != nil && params.Parameter16Name != nil { + data.Set("Parameter16.Name", *params.Parameter16Name) + } + if params != nil && params.Parameter16Value != nil { + data.Set("Parameter16.Value", *params.Parameter16Value) + } + if params != nil && params.Parameter17Name != nil { + data.Set("Parameter17.Name", *params.Parameter17Name) + } + if params != nil && params.Parameter17Value != nil { + data.Set("Parameter17.Value", *params.Parameter17Value) + } + if params != nil && params.Parameter18Name != nil { + data.Set("Parameter18.Name", *params.Parameter18Name) + } + if params != nil && params.Parameter18Value != nil { + data.Set("Parameter18.Value", *params.Parameter18Value) + } + if params != nil && params.Parameter19Name != nil { + data.Set("Parameter19.Name", *params.Parameter19Name) + } + if params != nil && params.Parameter19Value != nil { + data.Set("Parameter19.Value", *params.Parameter19Value) + } + if params != nil && params.Parameter20Name != nil { + data.Set("Parameter20.Name", *params.Parameter20Name) + } + if params != nil && params.Parameter20Value != nil { + data.Set("Parameter20.Value", *params.Parameter20Value) + } + if params != nil && params.Parameter21Name != nil { + data.Set("Parameter21.Name", *params.Parameter21Name) + } + if params != nil && params.Parameter21Value != nil { + data.Set("Parameter21.Value", *params.Parameter21Value) + } + if params != nil && params.Parameter22Name != nil { + data.Set("Parameter22.Name", *params.Parameter22Name) + } + if params != nil && params.Parameter22Value != nil { + data.Set("Parameter22.Value", *params.Parameter22Value) + } + if params != nil && params.Parameter23Name != nil { + data.Set("Parameter23.Name", *params.Parameter23Name) + } + if params != nil && params.Parameter23Value != nil { + data.Set("Parameter23.Value", *params.Parameter23Value) + } + if params != nil && params.Parameter24Name != nil { + data.Set("Parameter24.Name", *params.Parameter24Name) + } + if params != nil && params.Parameter24Value != nil { + data.Set("Parameter24.Value", *params.Parameter24Value) + } + if params != nil && params.Parameter25Name != nil { + data.Set("Parameter25.Name", *params.Parameter25Name) + } + if params != nil && params.Parameter25Value != nil { + data.Set("Parameter25.Value", *params.Parameter25Value) + } + if params != nil && params.Parameter26Name != nil { + data.Set("Parameter26.Name", *params.Parameter26Name) + } + if params != nil && params.Parameter26Value != nil { + data.Set("Parameter26.Value", *params.Parameter26Value) + } + if params != nil && params.Parameter27Name != nil { + data.Set("Parameter27.Name", *params.Parameter27Name) + } + if params != nil && params.Parameter27Value != nil { + data.Set("Parameter27.Value", *params.Parameter27Value) + } + if params != nil && params.Parameter28Name != nil { + data.Set("Parameter28.Name", *params.Parameter28Name) + } + if params != nil && params.Parameter28Value != nil { + data.Set("Parameter28.Value", *params.Parameter28Value) + } + if params != nil && params.Parameter29Name != nil { + data.Set("Parameter29.Name", *params.Parameter29Name) + } + if params != nil && params.Parameter29Value != nil { + data.Set("Parameter29.Value", *params.Parameter29Value) + } + if params != nil && params.Parameter30Name != nil { + data.Set("Parameter30.Name", *params.Parameter30Name) + } + if params != nil && params.Parameter30Value != nil { + data.Set("Parameter30.Value", *params.Parameter30Value) + } + if params != nil && params.Parameter31Name != nil { + data.Set("Parameter31.Name", *params.Parameter31Name) + } + if params != nil && params.Parameter31Value != nil { + data.Set("Parameter31.Value", *params.Parameter31Value) + } + if params != nil && params.Parameter32Name != nil { + data.Set("Parameter32.Name", *params.Parameter32Name) + } + if params != nil && params.Parameter32Value != nil { + data.Set("Parameter32.Value", *params.Parameter32Value) + } + if params != nil && params.Parameter33Name != nil { + data.Set("Parameter33.Name", *params.Parameter33Name) + } + if params != nil && params.Parameter33Value != nil { + data.Set("Parameter33.Value", *params.Parameter33Value) + } + if params != nil && params.Parameter34Name != nil { + data.Set("Parameter34.Name", *params.Parameter34Name) + } + if params != nil && params.Parameter34Value != nil { + data.Set("Parameter34.Value", *params.Parameter34Value) + } + if params != nil && params.Parameter35Name != nil { + data.Set("Parameter35.Name", *params.Parameter35Name) + } + if params != nil && params.Parameter35Value != nil { + data.Set("Parameter35.Value", *params.Parameter35Value) + } + if params != nil && params.Parameter36Name != nil { + data.Set("Parameter36.Name", *params.Parameter36Name) + } + if params != nil && params.Parameter36Value != nil { + data.Set("Parameter36.Value", *params.Parameter36Value) + } + if params != nil && params.Parameter37Name != nil { + data.Set("Parameter37.Name", *params.Parameter37Name) + } + if params != nil && params.Parameter37Value != nil { + data.Set("Parameter37.Value", *params.Parameter37Value) + } + if params != nil && params.Parameter38Name != nil { + data.Set("Parameter38.Name", *params.Parameter38Name) + } + if params != nil && params.Parameter38Value != nil { + data.Set("Parameter38.Value", *params.Parameter38Value) + } + if params != nil && params.Parameter39Name != nil { + data.Set("Parameter39.Name", *params.Parameter39Name) + } + if params != nil && params.Parameter39Value != nil { + data.Set("Parameter39.Value", *params.Parameter39Value) + } + if params != nil && params.Parameter40Name != nil { + data.Set("Parameter40.Name", *params.Parameter40Name) + } + if params != nil && params.Parameter40Value != nil { + data.Set("Parameter40.Value", *params.Parameter40Value) + } + if params != nil && params.Parameter41Name != nil { + data.Set("Parameter41.Name", *params.Parameter41Name) + } + if params != nil && params.Parameter41Value != nil { + data.Set("Parameter41.Value", *params.Parameter41Value) + } + if params != nil && params.Parameter42Name != nil { + data.Set("Parameter42.Name", *params.Parameter42Name) + } + if params != nil && params.Parameter42Value != nil { + data.Set("Parameter42.Value", *params.Parameter42Value) + } + if params != nil && params.Parameter43Name != nil { + data.Set("Parameter43.Name", *params.Parameter43Name) + } + if params != nil && params.Parameter43Value != nil { + data.Set("Parameter43.Value", *params.Parameter43Value) + } + if params != nil && params.Parameter44Name != nil { + data.Set("Parameter44.Name", *params.Parameter44Name) + } + if params != nil && params.Parameter44Value != nil { + data.Set("Parameter44.Value", *params.Parameter44Value) + } + if params != nil && params.Parameter45Name != nil { + data.Set("Parameter45.Name", *params.Parameter45Name) + } + if params != nil && params.Parameter45Value != nil { + data.Set("Parameter45.Value", *params.Parameter45Value) + } + if params != nil && params.Parameter46Name != nil { + data.Set("Parameter46.Name", *params.Parameter46Name) + } + if params != nil && params.Parameter46Value != nil { + data.Set("Parameter46.Value", *params.Parameter46Value) + } + if params != nil && params.Parameter47Name != nil { + data.Set("Parameter47.Name", *params.Parameter47Name) + } + if params != nil && params.Parameter47Value != nil { + data.Set("Parameter47.Value", *params.Parameter47Value) + } + if params != nil && params.Parameter48Name != nil { + data.Set("Parameter48.Name", *params.Parameter48Name) + } + if params != nil && params.Parameter48Value != nil { + data.Set("Parameter48.Value", *params.Parameter48Value) + } + if params != nil && params.Parameter49Name != nil { + data.Set("Parameter49.Name", *params.Parameter49Name) + } + if params != nil && params.Parameter49Value != nil { + data.Set("Parameter49.Value", *params.Parameter49Value) + } + if params != nil && params.Parameter50Name != nil { + data.Set("Parameter50.Name", *params.Parameter50Name) + } + if params != nil && params.Parameter50Value != nil { + data.Set("Parameter50.Value", *params.Parameter50Value) + } + if params != nil && params.Parameter51Name != nil { + data.Set("Parameter51.Name", *params.Parameter51Name) + } + if params != nil && params.Parameter51Value != nil { + data.Set("Parameter51.Value", *params.Parameter51Value) + } + if params != nil && params.Parameter52Name != nil { + data.Set("Parameter52.Name", *params.Parameter52Name) + } + if params != nil && params.Parameter52Value != nil { + data.Set("Parameter52.Value", *params.Parameter52Value) + } + if params != nil && params.Parameter53Name != nil { + data.Set("Parameter53.Name", *params.Parameter53Name) + } + if params != nil && params.Parameter53Value != nil { + data.Set("Parameter53.Value", *params.Parameter53Value) + } + if params != nil && params.Parameter54Name != nil { + data.Set("Parameter54.Name", *params.Parameter54Name) + } + if params != nil && params.Parameter54Value != nil { + data.Set("Parameter54.Value", *params.Parameter54Value) + } + if params != nil && params.Parameter55Name != nil { + data.Set("Parameter55.Name", *params.Parameter55Name) + } + if params != nil && params.Parameter55Value != nil { + data.Set("Parameter55.Value", *params.Parameter55Value) + } + if params != nil && params.Parameter56Name != nil { + data.Set("Parameter56.Name", *params.Parameter56Name) + } + if params != nil && params.Parameter56Value != nil { + data.Set("Parameter56.Value", *params.Parameter56Value) + } + if params != nil && params.Parameter57Name != nil { + data.Set("Parameter57.Name", *params.Parameter57Name) + } + if params != nil && params.Parameter57Value != nil { + data.Set("Parameter57.Value", *params.Parameter57Value) + } + if params != nil && params.Parameter58Name != nil { + data.Set("Parameter58.Name", *params.Parameter58Name) + } + if params != nil && params.Parameter58Value != nil { + data.Set("Parameter58.Value", *params.Parameter58Value) + } + if params != nil && params.Parameter59Name != nil { + data.Set("Parameter59.Name", *params.Parameter59Name) + } + if params != nil && params.Parameter59Value != nil { + data.Set("Parameter59.Value", *params.Parameter59Value) + } + if params != nil && params.Parameter60Name != nil { + data.Set("Parameter60.Name", *params.Parameter60Name) + } + if params != nil && params.Parameter60Value != nil { + data.Set("Parameter60.Value", *params.Parameter60Value) + } + if params != nil && params.Parameter61Name != nil { + data.Set("Parameter61.Name", *params.Parameter61Name) + } + if params != nil && params.Parameter61Value != nil { + data.Set("Parameter61.Value", *params.Parameter61Value) + } + if params != nil && params.Parameter62Name != nil { + data.Set("Parameter62.Name", *params.Parameter62Name) + } + if params != nil && params.Parameter62Value != nil { + data.Set("Parameter62.Value", *params.Parameter62Value) + } + if params != nil && params.Parameter63Name != nil { + data.Set("Parameter63.Name", *params.Parameter63Name) + } + if params != nil && params.Parameter63Value != nil { + data.Set("Parameter63.Value", *params.Parameter63Value) + } + if params != nil && params.Parameter64Name != nil { + data.Set("Parameter64.Name", *params.Parameter64Name) + } + if params != nil && params.Parameter64Value != nil { + data.Set("Parameter64.Value", *params.Parameter64Value) + } + if params != nil && params.Parameter65Name != nil { + data.Set("Parameter65.Name", *params.Parameter65Name) + } + if params != nil && params.Parameter65Value != nil { + data.Set("Parameter65.Value", *params.Parameter65Value) + } + if params != nil && params.Parameter66Name != nil { + data.Set("Parameter66.Name", *params.Parameter66Name) + } + if params != nil && params.Parameter66Value != nil { + data.Set("Parameter66.Value", *params.Parameter66Value) + } + if params != nil && params.Parameter67Name != nil { + data.Set("Parameter67.Name", *params.Parameter67Name) + } + if params != nil && params.Parameter67Value != nil { + data.Set("Parameter67.Value", *params.Parameter67Value) + } + if params != nil && params.Parameter68Name != nil { + data.Set("Parameter68.Name", *params.Parameter68Name) + } + if params != nil && params.Parameter68Value != nil { + data.Set("Parameter68.Value", *params.Parameter68Value) + } + if params != nil && params.Parameter69Name != nil { + data.Set("Parameter69.Name", *params.Parameter69Name) + } + if params != nil && params.Parameter69Value != nil { + data.Set("Parameter69.Value", *params.Parameter69Value) + } + if params != nil && params.Parameter70Name != nil { + data.Set("Parameter70.Name", *params.Parameter70Name) + } + if params != nil && params.Parameter70Value != nil { + data.Set("Parameter70.Value", *params.Parameter70Value) + } + if params != nil && params.Parameter71Name != nil { + data.Set("Parameter71.Name", *params.Parameter71Name) + } + if params != nil && params.Parameter71Value != nil { + data.Set("Parameter71.Value", *params.Parameter71Value) + } + if params != nil && params.Parameter72Name != nil { + data.Set("Parameter72.Name", *params.Parameter72Name) + } + if params != nil && params.Parameter72Value != nil { + data.Set("Parameter72.Value", *params.Parameter72Value) + } + if params != nil && params.Parameter73Name != nil { + data.Set("Parameter73.Name", *params.Parameter73Name) + } + if params != nil && params.Parameter73Value != nil { + data.Set("Parameter73.Value", *params.Parameter73Value) + } + if params != nil && params.Parameter74Name != nil { + data.Set("Parameter74.Name", *params.Parameter74Name) + } + if params != nil && params.Parameter74Value != nil { + data.Set("Parameter74.Value", *params.Parameter74Value) + } + if params != nil && params.Parameter75Name != nil { + data.Set("Parameter75.Name", *params.Parameter75Name) + } + if params != nil && params.Parameter75Value != nil { + data.Set("Parameter75.Value", *params.Parameter75Value) + } + if params != nil && params.Parameter76Name != nil { + data.Set("Parameter76.Name", *params.Parameter76Name) + } + if params != nil && params.Parameter76Value != nil { + data.Set("Parameter76.Value", *params.Parameter76Value) + } + if params != nil && params.Parameter77Name != nil { + data.Set("Parameter77.Name", *params.Parameter77Name) + } + if params != nil && params.Parameter77Value != nil { + data.Set("Parameter77.Value", *params.Parameter77Value) + } + if params != nil && params.Parameter78Name != nil { + data.Set("Parameter78.Name", *params.Parameter78Name) + } + if params != nil && params.Parameter78Value != nil { + data.Set("Parameter78.Value", *params.Parameter78Value) + } + if params != nil && params.Parameter79Name != nil { + data.Set("Parameter79.Name", *params.Parameter79Name) + } + if params != nil && params.Parameter79Value != nil { + data.Set("Parameter79.Value", *params.Parameter79Value) + } + if params != nil && params.Parameter80Name != nil { + data.Set("Parameter80.Name", *params.Parameter80Name) + } + if params != nil && params.Parameter80Value != nil { + data.Set("Parameter80.Value", *params.Parameter80Value) + } + if params != nil && params.Parameter81Name != nil { + data.Set("Parameter81.Name", *params.Parameter81Name) + } + if params != nil && params.Parameter81Value != nil { + data.Set("Parameter81.Value", *params.Parameter81Value) + } + if params != nil && params.Parameter82Name != nil { + data.Set("Parameter82.Name", *params.Parameter82Name) + } + if params != nil && params.Parameter82Value != nil { + data.Set("Parameter82.Value", *params.Parameter82Value) + } + if params != nil && params.Parameter83Name != nil { + data.Set("Parameter83.Name", *params.Parameter83Name) + } + if params != nil && params.Parameter83Value != nil { + data.Set("Parameter83.Value", *params.Parameter83Value) + } + if params != nil && params.Parameter84Name != nil { + data.Set("Parameter84.Name", *params.Parameter84Name) + } + if params != nil && params.Parameter84Value != nil { + data.Set("Parameter84.Value", *params.Parameter84Value) + } + if params != nil && params.Parameter85Name != nil { + data.Set("Parameter85.Name", *params.Parameter85Name) + } + if params != nil && params.Parameter85Value != nil { + data.Set("Parameter85.Value", *params.Parameter85Value) + } + if params != nil && params.Parameter86Name != nil { + data.Set("Parameter86.Name", *params.Parameter86Name) + } + if params != nil && params.Parameter86Value != nil { + data.Set("Parameter86.Value", *params.Parameter86Value) + } + if params != nil && params.Parameter87Name != nil { + data.Set("Parameter87.Name", *params.Parameter87Name) + } + if params != nil && params.Parameter87Value != nil { + data.Set("Parameter87.Value", *params.Parameter87Value) + } + if params != nil && params.Parameter88Name != nil { + data.Set("Parameter88.Name", *params.Parameter88Name) + } + if params != nil && params.Parameter88Value != nil { + data.Set("Parameter88.Value", *params.Parameter88Value) + } + if params != nil && params.Parameter89Name != nil { + data.Set("Parameter89.Name", *params.Parameter89Name) + } + if params != nil && params.Parameter89Value != nil { + data.Set("Parameter89.Value", *params.Parameter89Value) + } + if params != nil && params.Parameter90Name != nil { + data.Set("Parameter90.Name", *params.Parameter90Name) + } + if params != nil && params.Parameter90Value != nil { + data.Set("Parameter90.Value", *params.Parameter90Value) + } + if params != nil && params.Parameter91Name != nil { + data.Set("Parameter91.Name", *params.Parameter91Name) + } + if params != nil && params.Parameter91Value != nil { + data.Set("Parameter91.Value", *params.Parameter91Value) + } + if params != nil && params.Parameter92Name != nil { + data.Set("Parameter92.Name", *params.Parameter92Name) + } + if params != nil && params.Parameter92Value != nil { + data.Set("Parameter92.Value", *params.Parameter92Value) + } + if params != nil && params.Parameter93Name != nil { + data.Set("Parameter93.Name", *params.Parameter93Name) + } + if params != nil && params.Parameter93Value != nil { + data.Set("Parameter93.Value", *params.Parameter93Value) + } + if params != nil && params.Parameter94Name != nil { + data.Set("Parameter94.Name", *params.Parameter94Name) + } + if params != nil && params.Parameter94Value != nil { + data.Set("Parameter94.Value", *params.Parameter94Value) + } + if params != nil && params.Parameter95Name != nil { + data.Set("Parameter95.Name", *params.Parameter95Name) + } + if params != nil && params.Parameter95Value != nil { + data.Set("Parameter95.Value", *params.Parameter95Value) + } + if params != nil && params.Parameter96Name != nil { + data.Set("Parameter96.Name", *params.Parameter96Name) + } + if params != nil && params.Parameter96Value != nil { + data.Set("Parameter96.Value", *params.Parameter96Value) + } + if params != nil && params.Parameter97Name != nil { + data.Set("Parameter97.Name", *params.Parameter97Name) + } + if params != nil && params.Parameter97Value != nil { + data.Set("Parameter97.Value", *params.Parameter97Value) + } + if params != nil && params.Parameter98Name != nil { + data.Set("Parameter98.Name", *params.Parameter98Name) + } + if params != nil && params.Parameter98Value != nil { + data.Set("Parameter98.Value", *params.Parameter98Value) + } + if params != nil && params.Parameter99Name != nil { + data.Set("Parameter99.Name", *params.Parameter99Name) + } + if params != nil && params.Parameter99Value != nil { + data.Set("Parameter99.Value", *params.Parameter99Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Siprec{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Siprec{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateSiprec' type UpdateSiprecParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - Status *string `json:"Status,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateSiprecParams) SetPathAccountSid(PathAccountSid string) *UpdateSiprecParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateSiprecParams) SetPathAccountSid(PathAccountSid string) (*UpdateSiprecParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateSiprecParams) SetStatus(Status string) *UpdateSiprecParams { - params.Status = &Status - return params +func (params *UpdateSiprecParams) SetStatus(Status string) (*UpdateSiprecParams){ + params.Status = &Status + return params } // Stop a Siprec using either the SID of the Siprec resource or the `name` used when creating the resource func (c *ApiService) UpdateSiprec(CallSid string, Sid string, params *UpdateSiprecParams) (*ApiV2010Siprec, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Siprec/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010Siprec{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010Siprec{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_calls_streams.go b/rest/api/v2010/accounts_calls_streams.go index 4e85fe8bc..10f3d1c80 100644 --- a/rest/api/v2010/accounts_calls_streams.go +++ b/rest/api/v2010/accounts_calls_streams.go @@ -16,1923 +16,1928 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateStream' type CreateStreamParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Relative or absolute url where WebSocket connection will be established. - Url *string `json:"Url,omitempty"` - // The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. - Name *string `json:"Name,omitempty"` - // - Track *string `json:"Track,omitempty"` - // Absolute URL of the status callback. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The http method for the status_callback (one of GET, POST). - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Parameter name - Parameter1Name *string `json:"Parameter1.Name,omitempty"` - // Parameter value - Parameter1Value *string `json:"Parameter1.Value,omitempty"` - // Parameter name - Parameter2Name *string `json:"Parameter2.Name,omitempty"` - // Parameter value - Parameter2Value *string `json:"Parameter2.Value,omitempty"` - // Parameter name - Parameter3Name *string `json:"Parameter3.Name,omitempty"` - // Parameter value - Parameter3Value *string `json:"Parameter3.Value,omitempty"` - // Parameter name - Parameter4Name *string `json:"Parameter4.Name,omitempty"` - // Parameter value - Parameter4Value *string `json:"Parameter4.Value,omitempty"` - // Parameter name - Parameter5Name *string `json:"Parameter5.Name,omitempty"` - // Parameter value - Parameter5Value *string `json:"Parameter5.Value,omitempty"` - // Parameter name - Parameter6Name *string `json:"Parameter6.Name,omitempty"` - // Parameter value - Parameter6Value *string `json:"Parameter6.Value,omitempty"` - // Parameter name - Parameter7Name *string `json:"Parameter7.Name,omitempty"` - // Parameter value - Parameter7Value *string `json:"Parameter7.Value,omitempty"` - // Parameter name - Parameter8Name *string `json:"Parameter8.Name,omitempty"` - // Parameter value - Parameter8Value *string `json:"Parameter8.Value,omitempty"` - // Parameter name - Parameter9Name *string `json:"Parameter9.Name,omitempty"` - // Parameter value - Parameter9Value *string `json:"Parameter9.Value,omitempty"` - // Parameter name - Parameter10Name *string `json:"Parameter10.Name,omitempty"` - // Parameter value - Parameter10Value *string `json:"Parameter10.Value,omitempty"` - // Parameter name - Parameter11Name *string `json:"Parameter11.Name,omitempty"` - // Parameter value - Parameter11Value *string `json:"Parameter11.Value,omitempty"` - // Parameter name - Parameter12Name *string `json:"Parameter12.Name,omitempty"` - // Parameter value - Parameter12Value *string `json:"Parameter12.Value,omitempty"` - // Parameter name - Parameter13Name *string `json:"Parameter13.Name,omitempty"` - // Parameter value - Parameter13Value *string `json:"Parameter13.Value,omitempty"` - // Parameter name - Parameter14Name *string `json:"Parameter14.Name,omitempty"` - // Parameter value - Parameter14Value *string `json:"Parameter14.Value,omitempty"` - // Parameter name - Parameter15Name *string `json:"Parameter15.Name,omitempty"` - // Parameter value - Parameter15Value *string `json:"Parameter15.Value,omitempty"` - // Parameter name - Parameter16Name *string `json:"Parameter16.Name,omitempty"` - // Parameter value - Parameter16Value *string `json:"Parameter16.Value,omitempty"` - // Parameter name - Parameter17Name *string `json:"Parameter17.Name,omitempty"` - // Parameter value - Parameter17Value *string `json:"Parameter17.Value,omitempty"` - // Parameter name - Parameter18Name *string `json:"Parameter18.Name,omitempty"` - // Parameter value - Parameter18Value *string `json:"Parameter18.Value,omitempty"` - // Parameter name - Parameter19Name *string `json:"Parameter19.Name,omitempty"` - // Parameter value - Parameter19Value *string `json:"Parameter19.Value,omitempty"` - // Parameter name - Parameter20Name *string `json:"Parameter20.Name,omitempty"` - // Parameter value - Parameter20Value *string `json:"Parameter20.Value,omitempty"` - // Parameter name - Parameter21Name *string `json:"Parameter21.Name,omitempty"` - // Parameter value - Parameter21Value *string `json:"Parameter21.Value,omitempty"` - // Parameter name - Parameter22Name *string `json:"Parameter22.Name,omitempty"` - // Parameter value - Parameter22Value *string `json:"Parameter22.Value,omitempty"` - // Parameter name - Parameter23Name *string `json:"Parameter23.Name,omitempty"` - // Parameter value - Parameter23Value *string `json:"Parameter23.Value,omitempty"` - // Parameter name - Parameter24Name *string `json:"Parameter24.Name,omitempty"` - // Parameter value - Parameter24Value *string `json:"Parameter24.Value,omitempty"` - // Parameter name - Parameter25Name *string `json:"Parameter25.Name,omitempty"` - // Parameter value - Parameter25Value *string `json:"Parameter25.Value,omitempty"` - // Parameter name - Parameter26Name *string `json:"Parameter26.Name,omitempty"` - // Parameter value - Parameter26Value *string `json:"Parameter26.Value,omitempty"` - // Parameter name - Parameter27Name *string `json:"Parameter27.Name,omitempty"` - // Parameter value - Parameter27Value *string `json:"Parameter27.Value,omitempty"` - // Parameter name - Parameter28Name *string `json:"Parameter28.Name,omitempty"` - // Parameter value - Parameter28Value *string `json:"Parameter28.Value,omitempty"` - // Parameter name - Parameter29Name *string `json:"Parameter29.Name,omitempty"` - // Parameter value - Parameter29Value *string `json:"Parameter29.Value,omitempty"` - // Parameter name - Parameter30Name *string `json:"Parameter30.Name,omitempty"` - // Parameter value - Parameter30Value *string `json:"Parameter30.Value,omitempty"` - // Parameter name - Parameter31Name *string `json:"Parameter31.Name,omitempty"` - // Parameter value - Parameter31Value *string `json:"Parameter31.Value,omitempty"` - // Parameter name - Parameter32Name *string `json:"Parameter32.Name,omitempty"` - // Parameter value - Parameter32Value *string `json:"Parameter32.Value,omitempty"` - // Parameter name - Parameter33Name *string `json:"Parameter33.Name,omitempty"` - // Parameter value - Parameter33Value *string `json:"Parameter33.Value,omitempty"` - // Parameter name - Parameter34Name *string `json:"Parameter34.Name,omitempty"` - // Parameter value - Parameter34Value *string `json:"Parameter34.Value,omitempty"` - // Parameter name - Parameter35Name *string `json:"Parameter35.Name,omitempty"` - // Parameter value - Parameter35Value *string `json:"Parameter35.Value,omitempty"` - // Parameter name - Parameter36Name *string `json:"Parameter36.Name,omitempty"` - // Parameter value - Parameter36Value *string `json:"Parameter36.Value,omitempty"` - // Parameter name - Parameter37Name *string `json:"Parameter37.Name,omitempty"` - // Parameter value - Parameter37Value *string `json:"Parameter37.Value,omitempty"` - // Parameter name - Parameter38Name *string `json:"Parameter38.Name,omitempty"` - // Parameter value - Parameter38Value *string `json:"Parameter38.Value,omitempty"` - // Parameter name - Parameter39Name *string `json:"Parameter39.Name,omitempty"` - // Parameter value - Parameter39Value *string `json:"Parameter39.Value,omitempty"` - // Parameter name - Parameter40Name *string `json:"Parameter40.Name,omitempty"` - // Parameter value - Parameter40Value *string `json:"Parameter40.Value,omitempty"` - // Parameter name - Parameter41Name *string `json:"Parameter41.Name,omitempty"` - // Parameter value - Parameter41Value *string `json:"Parameter41.Value,omitempty"` - // Parameter name - Parameter42Name *string `json:"Parameter42.Name,omitempty"` - // Parameter value - Parameter42Value *string `json:"Parameter42.Value,omitempty"` - // Parameter name - Parameter43Name *string `json:"Parameter43.Name,omitempty"` - // Parameter value - Parameter43Value *string `json:"Parameter43.Value,omitempty"` - // Parameter name - Parameter44Name *string `json:"Parameter44.Name,omitempty"` - // Parameter value - Parameter44Value *string `json:"Parameter44.Value,omitempty"` - // Parameter name - Parameter45Name *string `json:"Parameter45.Name,omitempty"` - // Parameter value - Parameter45Value *string `json:"Parameter45.Value,omitempty"` - // Parameter name - Parameter46Name *string `json:"Parameter46.Name,omitempty"` - // Parameter value - Parameter46Value *string `json:"Parameter46.Value,omitempty"` - // Parameter name - Parameter47Name *string `json:"Parameter47.Name,omitempty"` - // Parameter value - Parameter47Value *string `json:"Parameter47.Value,omitempty"` - // Parameter name - Parameter48Name *string `json:"Parameter48.Name,omitempty"` - // Parameter value - Parameter48Value *string `json:"Parameter48.Value,omitempty"` - // Parameter name - Parameter49Name *string `json:"Parameter49.Name,omitempty"` - // Parameter value - Parameter49Value *string `json:"Parameter49.Value,omitempty"` - // Parameter name - Parameter50Name *string `json:"Parameter50.Name,omitempty"` - // Parameter value - Parameter50Value *string `json:"Parameter50.Value,omitempty"` - // Parameter name - Parameter51Name *string `json:"Parameter51.Name,omitempty"` - // Parameter value - Parameter51Value *string `json:"Parameter51.Value,omitempty"` - // Parameter name - Parameter52Name *string `json:"Parameter52.Name,omitempty"` - // Parameter value - Parameter52Value *string `json:"Parameter52.Value,omitempty"` - // Parameter name - Parameter53Name *string `json:"Parameter53.Name,omitempty"` - // Parameter value - Parameter53Value *string `json:"Parameter53.Value,omitempty"` - // Parameter name - Parameter54Name *string `json:"Parameter54.Name,omitempty"` - // Parameter value - Parameter54Value *string `json:"Parameter54.Value,omitempty"` - // Parameter name - Parameter55Name *string `json:"Parameter55.Name,omitempty"` - // Parameter value - Parameter55Value *string `json:"Parameter55.Value,omitempty"` - // Parameter name - Parameter56Name *string `json:"Parameter56.Name,omitempty"` - // Parameter value - Parameter56Value *string `json:"Parameter56.Value,omitempty"` - // Parameter name - Parameter57Name *string `json:"Parameter57.Name,omitempty"` - // Parameter value - Parameter57Value *string `json:"Parameter57.Value,omitempty"` - // Parameter name - Parameter58Name *string `json:"Parameter58.Name,omitempty"` - // Parameter value - Parameter58Value *string `json:"Parameter58.Value,omitempty"` - // Parameter name - Parameter59Name *string `json:"Parameter59.Name,omitempty"` - // Parameter value - Parameter59Value *string `json:"Parameter59.Value,omitempty"` - // Parameter name - Parameter60Name *string `json:"Parameter60.Name,omitempty"` - // Parameter value - Parameter60Value *string `json:"Parameter60.Value,omitempty"` - // Parameter name - Parameter61Name *string `json:"Parameter61.Name,omitempty"` - // Parameter value - Parameter61Value *string `json:"Parameter61.Value,omitempty"` - // Parameter name - Parameter62Name *string `json:"Parameter62.Name,omitempty"` - // Parameter value - Parameter62Value *string `json:"Parameter62.Value,omitempty"` - // Parameter name - Parameter63Name *string `json:"Parameter63.Name,omitempty"` - // Parameter value - Parameter63Value *string `json:"Parameter63.Value,omitempty"` - // Parameter name - Parameter64Name *string `json:"Parameter64.Name,omitempty"` - // Parameter value - Parameter64Value *string `json:"Parameter64.Value,omitempty"` - // Parameter name - Parameter65Name *string `json:"Parameter65.Name,omitempty"` - // Parameter value - Parameter65Value *string `json:"Parameter65.Value,omitempty"` - // Parameter name - Parameter66Name *string `json:"Parameter66.Name,omitempty"` - // Parameter value - Parameter66Value *string `json:"Parameter66.Value,omitempty"` - // Parameter name - Parameter67Name *string `json:"Parameter67.Name,omitempty"` - // Parameter value - Parameter67Value *string `json:"Parameter67.Value,omitempty"` - // Parameter name - Parameter68Name *string `json:"Parameter68.Name,omitempty"` - // Parameter value - Parameter68Value *string `json:"Parameter68.Value,omitempty"` - // Parameter name - Parameter69Name *string `json:"Parameter69.Name,omitempty"` - // Parameter value - Parameter69Value *string `json:"Parameter69.Value,omitempty"` - // Parameter name - Parameter70Name *string `json:"Parameter70.Name,omitempty"` - // Parameter value - Parameter70Value *string `json:"Parameter70.Value,omitempty"` - // Parameter name - Parameter71Name *string `json:"Parameter71.Name,omitempty"` - // Parameter value - Parameter71Value *string `json:"Parameter71.Value,omitempty"` - // Parameter name - Parameter72Name *string `json:"Parameter72.Name,omitempty"` - // Parameter value - Parameter72Value *string `json:"Parameter72.Value,omitempty"` - // Parameter name - Parameter73Name *string `json:"Parameter73.Name,omitempty"` - // Parameter value - Parameter73Value *string `json:"Parameter73.Value,omitempty"` - // Parameter name - Parameter74Name *string `json:"Parameter74.Name,omitempty"` - // Parameter value - Parameter74Value *string `json:"Parameter74.Value,omitempty"` - // Parameter name - Parameter75Name *string `json:"Parameter75.Name,omitempty"` - // Parameter value - Parameter75Value *string `json:"Parameter75.Value,omitempty"` - // Parameter name - Parameter76Name *string `json:"Parameter76.Name,omitempty"` - // Parameter value - Parameter76Value *string `json:"Parameter76.Value,omitempty"` - // Parameter name - Parameter77Name *string `json:"Parameter77.Name,omitempty"` - // Parameter value - Parameter77Value *string `json:"Parameter77.Value,omitempty"` - // Parameter name - Parameter78Name *string `json:"Parameter78.Name,omitempty"` - // Parameter value - Parameter78Value *string `json:"Parameter78.Value,omitempty"` - // Parameter name - Parameter79Name *string `json:"Parameter79.Name,omitempty"` - // Parameter value - Parameter79Value *string `json:"Parameter79.Value,omitempty"` - // Parameter name - Parameter80Name *string `json:"Parameter80.Name,omitempty"` - // Parameter value - Parameter80Value *string `json:"Parameter80.Value,omitempty"` - // Parameter name - Parameter81Name *string `json:"Parameter81.Name,omitempty"` - // Parameter value - Parameter81Value *string `json:"Parameter81.Value,omitempty"` - // Parameter name - Parameter82Name *string `json:"Parameter82.Name,omitempty"` - // Parameter value - Parameter82Value *string `json:"Parameter82.Value,omitempty"` - // Parameter name - Parameter83Name *string `json:"Parameter83.Name,omitempty"` - // Parameter value - Parameter83Value *string `json:"Parameter83.Value,omitempty"` - // Parameter name - Parameter84Name *string `json:"Parameter84.Name,omitempty"` - // Parameter value - Parameter84Value *string `json:"Parameter84.Value,omitempty"` - // Parameter name - Parameter85Name *string `json:"Parameter85.Name,omitempty"` - // Parameter value - Parameter85Value *string `json:"Parameter85.Value,omitempty"` - // Parameter name - Parameter86Name *string `json:"Parameter86.Name,omitempty"` - // Parameter value - Parameter86Value *string `json:"Parameter86.Value,omitempty"` - // Parameter name - Parameter87Name *string `json:"Parameter87.Name,omitempty"` - // Parameter value - Parameter87Value *string `json:"Parameter87.Value,omitempty"` - // Parameter name - Parameter88Name *string `json:"Parameter88.Name,omitempty"` - // Parameter value - Parameter88Value *string `json:"Parameter88.Value,omitempty"` - // Parameter name - Parameter89Name *string `json:"Parameter89.Name,omitempty"` - // Parameter value - Parameter89Value *string `json:"Parameter89.Value,omitempty"` - // Parameter name - Parameter90Name *string `json:"Parameter90.Name,omitempty"` - // Parameter value - Parameter90Value *string `json:"Parameter90.Value,omitempty"` - // Parameter name - Parameter91Name *string `json:"Parameter91.Name,omitempty"` - // Parameter value - Parameter91Value *string `json:"Parameter91.Value,omitempty"` - // Parameter name - Parameter92Name *string `json:"Parameter92.Name,omitempty"` - // Parameter value - Parameter92Value *string `json:"Parameter92.Value,omitempty"` - // Parameter name - Parameter93Name *string `json:"Parameter93.Name,omitempty"` - // Parameter value - Parameter93Value *string `json:"Parameter93.Value,omitempty"` - // Parameter name - Parameter94Name *string `json:"Parameter94.Name,omitempty"` - // Parameter value - Parameter94Value *string `json:"Parameter94.Value,omitempty"` - // Parameter name - Parameter95Name *string `json:"Parameter95.Name,omitempty"` - // Parameter value - Parameter95Value *string `json:"Parameter95.Value,omitempty"` - // Parameter name - Parameter96Name *string `json:"Parameter96.Name,omitempty"` - // Parameter value - Parameter96Value *string `json:"Parameter96.Value,omitempty"` - // Parameter name - Parameter97Name *string `json:"Parameter97.Name,omitempty"` - // Parameter value - Parameter97Value *string `json:"Parameter97.Value,omitempty"` - // Parameter name - Parameter98Name *string `json:"Parameter98.Name,omitempty"` - // Parameter value - Parameter98Value *string `json:"Parameter98.Value,omitempty"` - // Parameter name - Parameter99Name *string `json:"Parameter99.Name,omitempty"` - // Parameter value - Parameter99Value *string `json:"Parameter99.Value,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Relative or absolute url where WebSocket connection will be established. + Url *string `json:"Url,omitempty"` + // The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. + Name *string `json:"Name,omitempty"` + // + Track *string `json:"Track,omitempty"` + // Absolute URL of the status callback. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The http method for the status_callback (one of GET, POST). + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Parameter name + Parameter1Name *string `json:"Parameter1.Name,omitempty"` + // Parameter value + Parameter1Value *string `json:"Parameter1.Value,omitempty"` + // Parameter name + Parameter2Name *string `json:"Parameter2.Name,omitempty"` + // Parameter value + Parameter2Value *string `json:"Parameter2.Value,omitempty"` + // Parameter name + Parameter3Name *string `json:"Parameter3.Name,omitempty"` + // Parameter value + Parameter3Value *string `json:"Parameter3.Value,omitempty"` + // Parameter name + Parameter4Name *string `json:"Parameter4.Name,omitempty"` + // Parameter value + Parameter4Value *string `json:"Parameter4.Value,omitempty"` + // Parameter name + Parameter5Name *string `json:"Parameter5.Name,omitempty"` + // Parameter value + Parameter5Value *string `json:"Parameter5.Value,omitempty"` + // Parameter name + Parameter6Name *string `json:"Parameter6.Name,omitempty"` + // Parameter value + Parameter6Value *string `json:"Parameter6.Value,omitempty"` + // Parameter name + Parameter7Name *string `json:"Parameter7.Name,omitempty"` + // Parameter value + Parameter7Value *string `json:"Parameter7.Value,omitempty"` + // Parameter name + Parameter8Name *string `json:"Parameter8.Name,omitempty"` + // Parameter value + Parameter8Value *string `json:"Parameter8.Value,omitempty"` + // Parameter name + Parameter9Name *string `json:"Parameter9.Name,omitempty"` + // Parameter value + Parameter9Value *string `json:"Parameter9.Value,omitempty"` + // Parameter name + Parameter10Name *string `json:"Parameter10.Name,omitempty"` + // Parameter value + Parameter10Value *string `json:"Parameter10.Value,omitempty"` + // Parameter name + Parameter11Name *string `json:"Parameter11.Name,omitempty"` + // Parameter value + Parameter11Value *string `json:"Parameter11.Value,omitempty"` + // Parameter name + Parameter12Name *string `json:"Parameter12.Name,omitempty"` + // Parameter value + Parameter12Value *string `json:"Parameter12.Value,omitempty"` + // Parameter name + Parameter13Name *string `json:"Parameter13.Name,omitempty"` + // Parameter value + Parameter13Value *string `json:"Parameter13.Value,omitempty"` + // Parameter name + Parameter14Name *string `json:"Parameter14.Name,omitempty"` + // Parameter value + Parameter14Value *string `json:"Parameter14.Value,omitempty"` + // Parameter name + Parameter15Name *string `json:"Parameter15.Name,omitempty"` + // Parameter value + Parameter15Value *string `json:"Parameter15.Value,omitempty"` + // Parameter name + Parameter16Name *string `json:"Parameter16.Name,omitempty"` + // Parameter value + Parameter16Value *string `json:"Parameter16.Value,omitempty"` + // Parameter name + Parameter17Name *string `json:"Parameter17.Name,omitempty"` + // Parameter value + Parameter17Value *string `json:"Parameter17.Value,omitempty"` + // Parameter name + Parameter18Name *string `json:"Parameter18.Name,omitempty"` + // Parameter value + Parameter18Value *string `json:"Parameter18.Value,omitempty"` + // Parameter name + Parameter19Name *string `json:"Parameter19.Name,omitempty"` + // Parameter value + Parameter19Value *string `json:"Parameter19.Value,omitempty"` + // Parameter name + Parameter20Name *string `json:"Parameter20.Name,omitempty"` + // Parameter value + Parameter20Value *string `json:"Parameter20.Value,omitempty"` + // Parameter name + Parameter21Name *string `json:"Parameter21.Name,omitempty"` + // Parameter value + Parameter21Value *string `json:"Parameter21.Value,omitempty"` + // Parameter name + Parameter22Name *string `json:"Parameter22.Name,omitempty"` + // Parameter value + Parameter22Value *string `json:"Parameter22.Value,omitempty"` + // Parameter name + Parameter23Name *string `json:"Parameter23.Name,omitempty"` + // Parameter value + Parameter23Value *string `json:"Parameter23.Value,omitempty"` + // Parameter name + Parameter24Name *string `json:"Parameter24.Name,omitempty"` + // Parameter value + Parameter24Value *string `json:"Parameter24.Value,omitempty"` + // Parameter name + Parameter25Name *string `json:"Parameter25.Name,omitempty"` + // Parameter value + Parameter25Value *string `json:"Parameter25.Value,omitempty"` + // Parameter name + Parameter26Name *string `json:"Parameter26.Name,omitempty"` + // Parameter value + Parameter26Value *string `json:"Parameter26.Value,omitempty"` + // Parameter name + Parameter27Name *string `json:"Parameter27.Name,omitempty"` + // Parameter value + Parameter27Value *string `json:"Parameter27.Value,omitempty"` + // Parameter name + Parameter28Name *string `json:"Parameter28.Name,omitempty"` + // Parameter value + Parameter28Value *string `json:"Parameter28.Value,omitempty"` + // Parameter name + Parameter29Name *string `json:"Parameter29.Name,omitempty"` + // Parameter value + Parameter29Value *string `json:"Parameter29.Value,omitempty"` + // Parameter name + Parameter30Name *string `json:"Parameter30.Name,omitempty"` + // Parameter value + Parameter30Value *string `json:"Parameter30.Value,omitempty"` + // Parameter name + Parameter31Name *string `json:"Parameter31.Name,omitempty"` + // Parameter value + Parameter31Value *string `json:"Parameter31.Value,omitempty"` + // Parameter name + Parameter32Name *string `json:"Parameter32.Name,omitempty"` + // Parameter value + Parameter32Value *string `json:"Parameter32.Value,omitempty"` + // Parameter name + Parameter33Name *string `json:"Parameter33.Name,omitempty"` + // Parameter value + Parameter33Value *string `json:"Parameter33.Value,omitempty"` + // Parameter name + Parameter34Name *string `json:"Parameter34.Name,omitempty"` + // Parameter value + Parameter34Value *string `json:"Parameter34.Value,omitempty"` + // Parameter name + Parameter35Name *string `json:"Parameter35.Name,omitempty"` + // Parameter value + Parameter35Value *string `json:"Parameter35.Value,omitempty"` + // Parameter name + Parameter36Name *string `json:"Parameter36.Name,omitempty"` + // Parameter value + Parameter36Value *string `json:"Parameter36.Value,omitempty"` + // Parameter name + Parameter37Name *string `json:"Parameter37.Name,omitempty"` + // Parameter value + Parameter37Value *string `json:"Parameter37.Value,omitempty"` + // Parameter name + Parameter38Name *string `json:"Parameter38.Name,omitempty"` + // Parameter value + Parameter38Value *string `json:"Parameter38.Value,omitempty"` + // Parameter name + Parameter39Name *string `json:"Parameter39.Name,omitempty"` + // Parameter value + Parameter39Value *string `json:"Parameter39.Value,omitempty"` + // Parameter name + Parameter40Name *string `json:"Parameter40.Name,omitempty"` + // Parameter value + Parameter40Value *string `json:"Parameter40.Value,omitempty"` + // Parameter name + Parameter41Name *string `json:"Parameter41.Name,omitempty"` + // Parameter value + Parameter41Value *string `json:"Parameter41.Value,omitempty"` + // Parameter name + Parameter42Name *string `json:"Parameter42.Name,omitempty"` + // Parameter value + Parameter42Value *string `json:"Parameter42.Value,omitempty"` + // Parameter name + Parameter43Name *string `json:"Parameter43.Name,omitempty"` + // Parameter value + Parameter43Value *string `json:"Parameter43.Value,omitempty"` + // Parameter name + Parameter44Name *string `json:"Parameter44.Name,omitempty"` + // Parameter value + Parameter44Value *string `json:"Parameter44.Value,omitempty"` + // Parameter name + Parameter45Name *string `json:"Parameter45.Name,omitempty"` + // Parameter value + Parameter45Value *string `json:"Parameter45.Value,omitempty"` + // Parameter name + Parameter46Name *string `json:"Parameter46.Name,omitempty"` + // Parameter value + Parameter46Value *string `json:"Parameter46.Value,omitempty"` + // Parameter name + Parameter47Name *string `json:"Parameter47.Name,omitempty"` + // Parameter value + Parameter47Value *string `json:"Parameter47.Value,omitempty"` + // Parameter name + Parameter48Name *string `json:"Parameter48.Name,omitempty"` + // Parameter value + Parameter48Value *string `json:"Parameter48.Value,omitempty"` + // Parameter name + Parameter49Name *string `json:"Parameter49.Name,omitempty"` + // Parameter value + Parameter49Value *string `json:"Parameter49.Value,omitempty"` + // Parameter name + Parameter50Name *string `json:"Parameter50.Name,omitempty"` + // Parameter value + Parameter50Value *string `json:"Parameter50.Value,omitempty"` + // Parameter name + Parameter51Name *string `json:"Parameter51.Name,omitempty"` + // Parameter value + Parameter51Value *string `json:"Parameter51.Value,omitempty"` + // Parameter name + Parameter52Name *string `json:"Parameter52.Name,omitempty"` + // Parameter value + Parameter52Value *string `json:"Parameter52.Value,omitempty"` + // Parameter name + Parameter53Name *string `json:"Parameter53.Name,omitempty"` + // Parameter value + Parameter53Value *string `json:"Parameter53.Value,omitempty"` + // Parameter name + Parameter54Name *string `json:"Parameter54.Name,omitempty"` + // Parameter value + Parameter54Value *string `json:"Parameter54.Value,omitempty"` + // Parameter name + Parameter55Name *string `json:"Parameter55.Name,omitempty"` + // Parameter value + Parameter55Value *string `json:"Parameter55.Value,omitempty"` + // Parameter name + Parameter56Name *string `json:"Parameter56.Name,omitempty"` + // Parameter value + Parameter56Value *string `json:"Parameter56.Value,omitempty"` + // Parameter name + Parameter57Name *string `json:"Parameter57.Name,omitempty"` + // Parameter value + Parameter57Value *string `json:"Parameter57.Value,omitempty"` + // Parameter name + Parameter58Name *string `json:"Parameter58.Name,omitempty"` + // Parameter value + Parameter58Value *string `json:"Parameter58.Value,omitempty"` + // Parameter name + Parameter59Name *string `json:"Parameter59.Name,omitempty"` + // Parameter value + Parameter59Value *string `json:"Parameter59.Value,omitempty"` + // Parameter name + Parameter60Name *string `json:"Parameter60.Name,omitempty"` + // Parameter value + Parameter60Value *string `json:"Parameter60.Value,omitempty"` + // Parameter name + Parameter61Name *string `json:"Parameter61.Name,omitempty"` + // Parameter value + Parameter61Value *string `json:"Parameter61.Value,omitempty"` + // Parameter name + Parameter62Name *string `json:"Parameter62.Name,omitempty"` + // Parameter value + Parameter62Value *string `json:"Parameter62.Value,omitempty"` + // Parameter name + Parameter63Name *string `json:"Parameter63.Name,omitempty"` + // Parameter value + Parameter63Value *string `json:"Parameter63.Value,omitempty"` + // Parameter name + Parameter64Name *string `json:"Parameter64.Name,omitempty"` + // Parameter value + Parameter64Value *string `json:"Parameter64.Value,omitempty"` + // Parameter name + Parameter65Name *string `json:"Parameter65.Name,omitempty"` + // Parameter value + Parameter65Value *string `json:"Parameter65.Value,omitempty"` + // Parameter name + Parameter66Name *string `json:"Parameter66.Name,omitempty"` + // Parameter value + Parameter66Value *string `json:"Parameter66.Value,omitempty"` + // Parameter name + Parameter67Name *string `json:"Parameter67.Name,omitempty"` + // Parameter value + Parameter67Value *string `json:"Parameter67.Value,omitempty"` + // Parameter name + Parameter68Name *string `json:"Parameter68.Name,omitempty"` + // Parameter value + Parameter68Value *string `json:"Parameter68.Value,omitempty"` + // Parameter name + Parameter69Name *string `json:"Parameter69.Name,omitempty"` + // Parameter value + Parameter69Value *string `json:"Parameter69.Value,omitempty"` + // Parameter name + Parameter70Name *string `json:"Parameter70.Name,omitempty"` + // Parameter value + Parameter70Value *string `json:"Parameter70.Value,omitempty"` + // Parameter name + Parameter71Name *string `json:"Parameter71.Name,omitempty"` + // Parameter value + Parameter71Value *string `json:"Parameter71.Value,omitempty"` + // Parameter name + Parameter72Name *string `json:"Parameter72.Name,omitempty"` + // Parameter value + Parameter72Value *string `json:"Parameter72.Value,omitempty"` + // Parameter name + Parameter73Name *string `json:"Parameter73.Name,omitempty"` + // Parameter value + Parameter73Value *string `json:"Parameter73.Value,omitempty"` + // Parameter name + Parameter74Name *string `json:"Parameter74.Name,omitempty"` + // Parameter value + Parameter74Value *string `json:"Parameter74.Value,omitempty"` + // Parameter name + Parameter75Name *string `json:"Parameter75.Name,omitempty"` + // Parameter value + Parameter75Value *string `json:"Parameter75.Value,omitempty"` + // Parameter name + Parameter76Name *string `json:"Parameter76.Name,omitempty"` + // Parameter value + Parameter76Value *string `json:"Parameter76.Value,omitempty"` + // Parameter name + Parameter77Name *string `json:"Parameter77.Name,omitempty"` + // Parameter value + Parameter77Value *string `json:"Parameter77.Value,omitempty"` + // Parameter name + Parameter78Name *string `json:"Parameter78.Name,omitempty"` + // Parameter value + Parameter78Value *string `json:"Parameter78.Value,omitempty"` + // Parameter name + Parameter79Name *string `json:"Parameter79.Name,omitempty"` + // Parameter value + Parameter79Value *string `json:"Parameter79.Value,omitempty"` + // Parameter name + Parameter80Name *string `json:"Parameter80.Name,omitempty"` + // Parameter value + Parameter80Value *string `json:"Parameter80.Value,omitempty"` + // Parameter name + Parameter81Name *string `json:"Parameter81.Name,omitempty"` + // Parameter value + Parameter81Value *string `json:"Parameter81.Value,omitempty"` + // Parameter name + Parameter82Name *string `json:"Parameter82.Name,omitempty"` + // Parameter value + Parameter82Value *string `json:"Parameter82.Value,omitempty"` + // Parameter name + Parameter83Name *string `json:"Parameter83.Name,omitempty"` + // Parameter value + Parameter83Value *string `json:"Parameter83.Value,omitempty"` + // Parameter name + Parameter84Name *string `json:"Parameter84.Name,omitempty"` + // Parameter value + Parameter84Value *string `json:"Parameter84.Value,omitempty"` + // Parameter name + Parameter85Name *string `json:"Parameter85.Name,omitempty"` + // Parameter value + Parameter85Value *string `json:"Parameter85.Value,omitempty"` + // Parameter name + Parameter86Name *string `json:"Parameter86.Name,omitempty"` + // Parameter value + Parameter86Value *string `json:"Parameter86.Value,omitempty"` + // Parameter name + Parameter87Name *string `json:"Parameter87.Name,omitempty"` + // Parameter value + Parameter87Value *string `json:"Parameter87.Value,omitempty"` + // Parameter name + Parameter88Name *string `json:"Parameter88.Name,omitempty"` + // Parameter value + Parameter88Value *string `json:"Parameter88.Value,omitempty"` + // Parameter name + Parameter89Name *string `json:"Parameter89.Name,omitempty"` + // Parameter value + Parameter89Value *string `json:"Parameter89.Value,omitempty"` + // Parameter name + Parameter90Name *string `json:"Parameter90.Name,omitempty"` + // Parameter value + Parameter90Value *string `json:"Parameter90.Value,omitempty"` + // Parameter name + Parameter91Name *string `json:"Parameter91.Name,omitempty"` + // Parameter value + Parameter91Value *string `json:"Parameter91.Value,omitempty"` + // Parameter name + Parameter92Name *string `json:"Parameter92.Name,omitempty"` + // Parameter value + Parameter92Value *string `json:"Parameter92.Value,omitempty"` + // Parameter name + Parameter93Name *string `json:"Parameter93.Name,omitempty"` + // Parameter value + Parameter93Value *string `json:"Parameter93.Value,omitempty"` + // Parameter name + Parameter94Name *string `json:"Parameter94.Name,omitempty"` + // Parameter value + Parameter94Value *string `json:"Parameter94.Value,omitempty"` + // Parameter name + Parameter95Name *string `json:"Parameter95.Name,omitempty"` + // Parameter value + Parameter95Value *string `json:"Parameter95.Value,omitempty"` + // Parameter name + Parameter96Name *string `json:"Parameter96.Name,omitempty"` + // Parameter value + Parameter96Value *string `json:"Parameter96.Value,omitempty"` + // Parameter name + Parameter97Name *string `json:"Parameter97.Name,omitempty"` + // Parameter value + Parameter97Value *string `json:"Parameter97.Value,omitempty"` + // Parameter name + Parameter98Name *string `json:"Parameter98.Name,omitempty"` + // Parameter value + Parameter98Value *string `json:"Parameter98.Value,omitempty"` + // Parameter name + Parameter99Name *string `json:"Parameter99.Name,omitempty"` + // Parameter value + Parameter99Value *string `json:"Parameter99.Value,omitempty"` } -func (params *CreateStreamParams) SetPathAccountSid(PathAccountSid string) *CreateStreamParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateStreamParams) SetPathAccountSid(PathAccountSid string) (*CreateStreamParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateStreamParams) SetUrl(Url string) *CreateStreamParams { - params.Url = &Url - return params +func (params *CreateStreamParams) SetUrl(Url string) (*CreateStreamParams){ + params.Url = &Url + return params } -func (params *CreateStreamParams) SetName(Name string) *CreateStreamParams { - params.Name = &Name - return params +func (params *CreateStreamParams) SetName(Name string) (*CreateStreamParams){ + params.Name = &Name + return params } -func (params *CreateStreamParams) SetTrack(Track string) *CreateStreamParams { - params.Track = &Track - return params +func (params *CreateStreamParams) SetTrack(Track string) (*CreateStreamParams){ + params.Track = &Track + return params } -func (params *CreateStreamParams) SetStatusCallback(StatusCallback string) *CreateStreamParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateStreamParams) SetStatusCallback(StatusCallback string) (*CreateStreamParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreateStreamParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateStreamParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *CreateStreamParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateStreamParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *CreateStreamParams) SetParameter1Name(Parameter1Name string) *CreateStreamParams { - params.Parameter1Name = &Parameter1Name - return params +func (params *CreateStreamParams) SetParameter1Name(Parameter1Name string) (*CreateStreamParams){ + params.Parameter1Name = &Parameter1Name + return params } -func (params *CreateStreamParams) SetParameter1Value(Parameter1Value string) *CreateStreamParams { - params.Parameter1Value = &Parameter1Value - return params +func (params *CreateStreamParams) SetParameter1Value(Parameter1Value string) (*CreateStreamParams){ + params.Parameter1Value = &Parameter1Value + return params } -func (params *CreateStreamParams) SetParameter2Name(Parameter2Name string) *CreateStreamParams { - params.Parameter2Name = &Parameter2Name - return params +func (params *CreateStreamParams) SetParameter2Name(Parameter2Name string) (*CreateStreamParams){ + params.Parameter2Name = &Parameter2Name + return params } -func (params *CreateStreamParams) SetParameter2Value(Parameter2Value string) *CreateStreamParams { - params.Parameter2Value = &Parameter2Value - return params +func (params *CreateStreamParams) SetParameter2Value(Parameter2Value string) (*CreateStreamParams){ + params.Parameter2Value = &Parameter2Value + return params } -func (params *CreateStreamParams) SetParameter3Name(Parameter3Name string) *CreateStreamParams { - params.Parameter3Name = &Parameter3Name - return params +func (params *CreateStreamParams) SetParameter3Name(Parameter3Name string) (*CreateStreamParams){ + params.Parameter3Name = &Parameter3Name + return params } -func (params *CreateStreamParams) SetParameter3Value(Parameter3Value string) *CreateStreamParams { - params.Parameter3Value = &Parameter3Value - return params +func (params *CreateStreamParams) SetParameter3Value(Parameter3Value string) (*CreateStreamParams){ + params.Parameter3Value = &Parameter3Value + return params } -func (params *CreateStreamParams) SetParameter4Name(Parameter4Name string) *CreateStreamParams { - params.Parameter4Name = &Parameter4Name - return params +func (params *CreateStreamParams) SetParameter4Name(Parameter4Name string) (*CreateStreamParams){ + params.Parameter4Name = &Parameter4Name + return params } -func (params *CreateStreamParams) SetParameter4Value(Parameter4Value string) *CreateStreamParams { - params.Parameter4Value = &Parameter4Value - return params +func (params *CreateStreamParams) SetParameter4Value(Parameter4Value string) (*CreateStreamParams){ + params.Parameter4Value = &Parameter4Value + return params } -func (params *CreateStreamParams) SetParameter5Name(Parameter5Name string) *CreateStreamParams { - params.Parameter5Name = &Parameter5Name - return params +func (params *CreateStreamParams) SetParameter5Name(Parameter5Name string) (*CreateStreamParams){ + params.Parameter5Name = &Parameter5Name + return params } -func (params *CreateStreamParams) SetParameter5Value(Parameter5Value string) *CreateStreamParams { - params.Parameter5Value = &Parameter5Value - return params +func (params *CreateStreamParams) SetParameter5Value(Parameter5Value string) (*CreateStreamParams){ + params.Parameter5Value = &Parameter5Value + return params } -func (params *CreateStreamParams) SetParameter6Name(Parameter6Name string) *CreateStreamParams { - params.Parameter6Name = &Parameter6Name - return params +func (params *CreateStreamParams) SetParameter6Name(Parameter6Name string) (*CreateStreamParams){ + params.Parameter6Name = &Parameter6Name + return params } -func (params *CreateStreamParams) SetParameter6Value(Parameter6Value string) *CreateStreamParams { - params.Parameter6Value = &Parameter6Value - return params +func (params *CreateStreamParams) SetParameter6Value(Parameter6Value string) (*CreateStreamParams){ + params.Parameter6Value = &Parameter6Value + return params } -func (params *CreateStreamParams) SetParameter7Name(Parameter7Name string) *CreateStreamParams { - params.Parameter7Name = &Parameter7Name - return params +func (params *CreateStreamParams) SetParameter7Name(Parameter7Name string) (*CreateStreamParams){ + params.Parameter7Name = &Parameter7Name + return params } -func (params *CreateStreamParams) SetParameter7Value(Parameter7Value string) *CreateStreamParams { - params.Parameter7Value = &Parameter7Value - return params +func (params *CreateStreamParams) SetParameter7Value(Parameter7Value string) (*CreateStreamParams){ + params.Parameter7Value = &Parameter7Value + return params } -func (params *CreateStreamParams) SetParameter8Name(Parameter8Name string) *CreateStreamParams { - params.Parameter8Name = &Parameter8Name - return params +func (params *CreateStreamParams) SetParameter8Name(Parameter8Name string) (*CreateStreamParams){ + params.Parameter8Name = &Parameter8Name + return params } -func (params *CreateStreamParams) SetParameter8Value(Parameter8Value string) *CreateStreamParams { - params.Parameter8Value = &Parameter8Value - return params +func (params *CreateStreamParams) SetParameter8Value(Parameter8Value string) (*CreateStreamParams){ + params.Parameter8Value = &Parameter8Value + return params } -func (params *CreateStreamParams) SetParameter9Name(Parameter9Name string) *CreateStreamParams { - params.Parameter9Name = &Parameter9Name - return params +func (params *CreateStreamParams) SetParameter9Name(Parameter9Name string) (*CreateStreamParams){ + params.Parameter9Name = &Parameter9Name + return params } -func (params *CreateStreamParams) SetParameter9Value(Parameter9Value string) *CreateStreamParams { - params.Parameter9Value = &Parameter9Value - return params +func (params *CreateStreamParams) SetParameter9Value(Parameter9Value string) (*CreateStreamParams){ + params.Parameter9Value = &Parameter9Value + return params } -func (params *CreateStreamParams) SetParameter10Name(Parameter10Name string) *CreateStreamParams { - params.Parameter10Name = &Parameter10Name - return params +func (params *CreateStreamParams) SetParameter10Name(Parameter10Name string) (*CreateStreamParams){ + params.Parameter10Name = &Parameter10Name + return params } -func (params *CreateStreamParams) SetParameter10Value(Parameter10Value string) *CreateStreamParams { - params.Parameter10Value = &Parameter10Value - return params +func (params *CreateStreamParams) SetParameter10Value(Parameter10Value string) (*CreateStreamParams){ + params.Parameter10Value = &Parameter10Value + return params } -func (params *CreateStreamParams) SetParameter11Name(Parameter11Name string) *CreateStreamParams { - params.Parameter11Name = &Parameter11Name - return params +func (params *CreateStreamParams) SetParameter11Name(Parameter11Name string) (*CreateStreamParams){ + params.Parameter11Name = &Parameter11Name + return params } -func (params *CreateStreamParams) SetParameter11Value(Parameter11Value string) *CreateStreamParams { - params.Parameter11Value = &Parameter11Value - return params +func (params *CreateStreamParams) SetParameter11Value(Parameter11Value string) (*CreateStreamParams){ + params.Parameter11Value = &Parameter11Value + return params } -func (params *CreateStreamParams) SetParameter12Name(Parameter12Name string) *CreateStreamParams { - params.Parameter12Name = &Parameter12Name - return params +func (params *CreateStreamParams) SetParameter12Name(Parameter12Name string) (*CreateStreamParams){ + params.Parameter12Name = &Parameter12Name + return params } -func (params *CreateStreamParams) SetParameter12Value(Parameter12Value string) *CreateStreamParams { - params.Parameter12Value = &Parameter12Value - return params +func (params *CreateStreamParams) SetParameter12Value(Parameter12Value string) (*CreateStreamParams){ + params.Parameter12Value = &Parameter12Value + return params } -func (params *CreateStreamParams) SetParameter13Name(Parameter13Name string) *CreateStreamParams { - params.Parameter13Name = &Parameter13Name - return params +func (params *CreateStreamParams) SetParameter13Name(Parameter13Name string) (*CreateStreamParams){ + params.Parameter13Name = &Parameter13Name + return params } -func (params *CreateStreamParams) SetParameter13Value(Parameter13Value string) *CreateStreamParams { - params.Parameter13Value = &Parameter13Value - return params +func (params *CreateStreamParams) SetParameter13Value(Parameter13Value string) (*CreateStreamParams){ + params.Parameter13Value = &Parameter13Value + return params } -func (params *CreateStreamParams) SetParameter14Name(Parameter14Name string) *CreateStreamParams { - params.Parameter14Name = &Parameter14Name - return params +func (params *CreateStreamParams) SetParameter14Name(Parameter14Name string) (*CreateStreamParams){ + params.Parameter14Name = &Parameter14Name + return params } -func (params *CreateStreamParams) SetParameter14Value(Parameter14Value string) *CreateStreamParams { - params.Parameter14Value = &Parameter14Value - return params +func (params *CreateStreamParams) SetParameter14Value(Parameter14Value string) (*CreateStreamParams){ + params.Parameter14Value = &Parameter14Value + return params } -func (params *CreateStreamParams) SetParameter15Name(Parameter15Name string) *CreateStreamParams { - params.Parameter15Name = &Parameter15Name - return params +func (params *CreateStreamParams) SetParameter15Name(Parameter15Name string) (*CreateStreamParams){ + params.Parameter15Name = &Parameter15Name + return params } -func (params *CreateStreamParams) SetParameter15Value(Parameter15Value string) *CreateStreamParams { - params.Parameter15Value = &Parameter15Value - return params +func (params *CreateStreamParams) SetParameter15Value(Parameter15Value string) (*CreateStreamParams){ + params.Parameter15Value = &Parameter15Value + return params } -func (params *CreateStreamParams) SetParameter16Name(Parameter16Name string) *CreateStreamParams { - params.Parameter16Name = &Parameter16Name - return params +func (params *CreateStreamParams) SetParameter16Name(Parameter16Name string) (*CreateStreamParams){ + params.Parameter16Name = &Parameter16Name + return params } -func (params *CreateStreamParams) SetParameter16Value(Parameter16Value string) *CreateStreamParams { - params.Parameter16Value = &Parameter16Value - return params +func (params *CreateStreamParams) SetParameter16Value(Parameter16Value string) (*CreateStreamParams){ + params.Parameter16Value = &Parameter16Value + return params } -func (params *CreateStreamParams) SetParameter17Name(Parameter17Name string) *CreateStreamParams { - params.Parameter17Name = &Parameter17Name - return params +func (params *CreateStreamParams) SetParameter17Name(Parameter17Name string) (*CreateStreamParams){ + params.Parameter17Name = &Parameter17Name + return params } -func (params *CreateStreamParams) SetParameter17Value(Parameter17Value string) *CreateStreamParams { - params.Parameter17Value = &Parameter17Value - return params +func (params *CreateStreamParams) SetParameter17Value(Parameter17Value string) (*CreateStreamParams){ + params.Parameter17Value = &Parameter17Value + return params } -func (params *CreateStreamParams) SetParameter18Name(Parameter18Name string) *CreateStreamParams { - params.Parameter18Name = &Parameter18Name - return params +func (params *CreateStreamParams) SetParameter18Name(Parameter18Name string) (*CreateStreamParams){ + params.Parameter18Name = &Parameter18Name + return params } -func (params *CreateStreamParams) SetParameter18Value(Parameter18Value string) *CreateStreamParams { - params.Parameter18Value = &Parameter18Value - return params +func (params *CreateStreamParams) SetParameter18Value(Parameter18Value string) (*CreateStreamParams){ + params.Parameter18Value = &Parameter18Value + return params } -func (params *CreateStreamParams) SetParameter19Name(Parameter19Name string) *CreateStreamParams { - params.Parameter19Name = &Parameter19Name - return params +func (params *CreateStreamParams) SetParameter19Name(Parameter19Name string) (*CreateStreamParams){ + params.Parameter19Name = &Parameter19Name + return params } -func (params *CreateStreamParams) SetParameter19Value(Parameter19Value string) *CreateStreamParams { - params.Parameter19Value = &Parameter19Value - return params +func (params *CreateStreamParams) SetParameter19Value(Parameter19Value string) (*CreateStreamParams){ + params.Parameter19Value = &Parameter19Value + return params } -func (params *CreateStreamParams) SetParameter20Name(Parameter20Name string) *CreateStreamParams { - params.Parameter20Name = &Parameter20Name - return params +func (params *CreateStreamParams) SetParameter20Name(Parameter20Name string) (*CreateStreamParams){ + params.Parameter20Name = &Parameter20Name + return params } -func (params *CreateStreamParams) SetParameter20Value(Parameter20Value string) *CreateStreamParams { - params.Parameter20Value = &Parameter20Value - return params +func (params *CreateStreamParams) SetParameter20Value(Parameter20Value string) (*CreateStreamParams){ + params.Parameter20Value = &Parameter20Value + return params } -func (params *CreateStreamParams) SetParameter21Name(Parameter21Name string) *CreateStreamParams { - params.Parameter21Name = &Parameter21Name - return params +func (params *CreateStreamParams) SetParameter21Name(Parameter21Name string) (*CreateStreamParams){ + params.Parameter21Name = &Parameter21Name + return params } -func (params *CreateStreamParams) SetParameter21Value(Parameter21Value string) *CreateStreamParams { - params.Parameter21Value = &Parameter21Value - return params +func (params *CreateStreamParams) SetParameter21Value(Parameter21Value string) (*CreateStreamParams){ + params.Parameter21Value = &Parameter21Value + return params } -func (params *CreateStreamParams) SetParameter22Name(Parameter22Name string) *CreateStreamParams { - params.Parameter22Name = &Parameter22Name - return params +func (params *CreateStreamParams) SetParameter22Name(Parameter22Name string) (*CreateStreamParams){ + params.Parameter22Name = &Parameter22Name + return params } -func (params *CreateStreamParams) SetParameter22Value(Parameter22Value string) *CreateStreamParams { - params.Parameter22Value = &Parameter22Value - return params +func (params *CreateStreamParams) SetParameter22Value(Parameter22Value string) (*CreateStreamParams){ + params.Parameter22Value = &Parameter22Value + return params } -func (params *CreateStreamParams) SetParameter23Name(Parameter23Name string) *CreateStreamParams { - params.Parameter23Name = &Parameter23Name - return params +func (params *CreateStreamParams) SetParameter23Name(Parameter23Name string) (*CreateStreamParams){ + params.Parameter23Name = &Parameter23Name + return params } -func (params *CreateStreamParams) SetParameter23Value(Parameter23Value string) *CreateStreamParams { - params.Parameter23Value = &Parameter23Value - return params +func (params *CreateStreamParams) SetParameter23Value(Parameter23Value string) (*CreateStreamParams){ + params.Parameter23Value = &Parameter23Value + return params } -func (params *CreateStreamParams) SetParameter24Name(Parameter24Name string) *CreateStreamParams { - params.Parameter24Name = &Parameter24Name - return params +func (params *CreateStreamParams) SetParameter24Name(Parameter24Name string) (*CreateStreamParams){ + params.Parameter24Name = &Parameter24Name + return params } -func (params *CreateStreamParams) SetParameter24Value(Parameter24Value string) *CreateStreamParams { - params.Parameter24Value = &Parameter24Value - return params +func (params *CreateStreamParams) SetParameter24Value(Parameter24Value string) (*CreateStreamParams){ + params.Parameter24Value = &Parameter24Value + return params } -func (params *CreateStreamParams) SetParameter25Name(Parameter25Name string) *CreateStreamParams { - params.Parameter25Name = &Parameter25Name - return params +func (params *CreateStreamParams) SetParameter25Name(Parameter25Name string) (*CreateStreamParams){ + params.Parameter25Name = &Parameter25Name + return params } -func (params *CreateStreamParams) SetParameter25Value(Parameter25Value string) *CreateStreamParams { - params.Parameter25Value = &Parameter25Value - return params +func (params *CreateStreamParams) SetParameter25Value(Parameter25Value string) (*CreateStreamParams){ + params.Parameter25Value = &Parameter25Value + return params } -func (params *CreateStreamParams) SetParameter26Name(Parameter26Name string) *CreateStreamParams { - params.Parameter26Name = &Parameter26Name - return params +func (params *CreateStreamParams) SetParameter26Name(Parameter26Name string) (*CreateStreamParams){ + params.Parameter26Name = &Parameter26Name + return params } -func (params *CreateStreamParams) SetParameter26Value(Parameter26Value string) *CreateStreamParams { - params.Parameter26Value = &Parameter26Value - return params +func (params *CreateStreamParams) SetParameter26Value(Parameter26Value string) (*CreateStreamParams){ + params.Parameter26Value = &Parameter26Value + return params } -func (params *CreateStreamParams) SetParameter27Name(Parameter27Name string) *CreateStreamParams { - params.Parameter27Name = &Parameter27Name - return params +func (params *CreateStreamParams) SetParameter27Name(Parameter27Name string) (*CreateStreamParams){ + params.Parameter27Name = &Parameter27Name + return params } -func (params *CreateStreamParams) SetParameter27Value(Parameter27Value string) *CreateStreamParams { - params.Parameter27Value = &Parameter27Value - return params +func (params *CreateStreamParams) SetParameter27Value(Parameter27Value string) (*CreateStreamParams){ + params.Parameter27Value = &Parameter27Value + return params } -func (params *CreateStreamParams) SetParameter28Name(Parameter28Name string) *CreateStreamParams { - params.Parameter28Name = &Parameter28Name - return params +func (params *CreateStreamParams) SetParameter28Name(Parameter28Name string) (*CreateStreamParams){ + params.Parameter28Name = &Parameter28Name + return params } -func (params *CreateStreamParams) SetParameter28Value(Parameter28Value string) *CreateStreamParams { - params.Parameter28Value = &Parameter28Value - return params +func (params *CreateStreamParams) SetParameter28Value(Parameter28Value string) (*CreateStreamParams){ + params.Parameter28Value = &Parameter28Value + return params } -func (params *CreateStreamParams) SetParameter29Name(Parameter29Name string) *CreateStreamParams { - params.Parameter29Name = &Parameter29Name - return params +func (params *CreateStreamParams) SetParameter29Name(Parameter29Name string) (*CreateStreamParams){ + params.Parameter29Name = &Parameter29Name + return params } -func (params *CreateStreamParams) SetParameter29Value(Parameter29Value string) *CreateStreamParams { - params.Parameter29Value = &Parameter29Value - return params +func (params *CreateStreamParams) SetParameter29Value(Parameter29Value string) (*CreateStreamParams){ + params.Parameter29Value = &Parameter29Value + return params } -func (params *CreateStreamParams) SetParameter30Name(Parameter30Name string) *CreateStreamParams { - params.Parameter30Name = &Parameter30Name - return params +func (params *CreateStreamParams) SetParameter30Name(Parameter30Name string) (*CreateStreamParams){ + params.Parameter30Name = &Parameter30Name + return params } -func (params *CreateStreamParams) SetParameter30Value(Parameter30Value string) *CreateStreamParams { - params.Parameter30Value = &Parameter30Value - return params +func (params *CreateStreamParams) SetParameter30Value(Parameter30Value string) (*CreateStreamParams){ + params.Parameter30Value = &Parameter30Value + return params } -func (params *CreateStreamParams) SetParameter31Name(Parameter31Name string) *CreateStreamParams { - params.Parameter31Name = &Parameter31Name - return params +func (params *CreateStreamParams) SetParameter31Name(Parameter31Name string) (*CreateStreamParams){ + params.Parameter31Name = &Parameter31Name + return params } -func (params *CreateStreamParams) SetParameter31Value(Parameter31Value string) *CreateStreamParams { - params.Parameter31Value = &Parameter31Value - return params +func (params *CreateStreamParams) SetParameter31Value(Parameter31Value string) (*CreateStreamParams){ + params.Parameter31Value = &Parameter31Value + return params } -func (params *CreateStreamParams) SetParameter32Name(Parameter32Name string) *CreateStreamParams { - params.Parameter32Name = &Parameter32Name - return params +func (params *CreateStreamParams) SetParameter32Name(Parameter32Name string) (*CreateStreamParams){ + params.Parameter32Name = &Parameter32Name + return params } -func (params *CreateStreamParams) SetParameter32Value(Parameter32Value string) *CreateStreamParams { - params.Parameter32Value = &Parameter32Value - return params +func (params *CreateStreamParams) SetParameter32Value(Parameter32Value string) (*CreateStreamParams){ + params.Parameter32Value = &Parameter32Value + return params } -func (params *CreateStreamParams) SetParameter33Name(Parameter33Name string) *CreateStreamParams { - params.Parameter33Name = &Parameter33Name - return params +func (params *CreateStreamParams) SetParameter33Name(Parameter33Name string) (*CreateStreamParams){ + params.Parameter33Name = &Parameter33Name + return params } -func (params *CreateStreamParams) SetParameter33Value(Parameter33Value string) *CreateStreamParams { - params.Parameter33Value = &Parameter33Value - return params +func (params *CreateStreamParams) SetParameter33Value(Parameter33Value string) (*CreateStreamParams){ + params.Parameter33Value = &Parameter33Value + return params } -func (params *CreateStreamParams) SetParameter34Name(Parameter34Name string) *CreateStreamParams { - params.Parameter34Name = &Parameter34Name - return params +func (params *CreateStreamParams) SetParameter34Name(Parameter34Name string) (*CreateStreamParams){ + params.Parameter34Name = &Parameter34Name + return params } -func (params *CreateStreamParams) SetParameter34Value(Parameter34Value string) *CreateStreamParams { - params.Parameter34Value = &Parameter34Value - return params +func (params *CreateStreamParams) SetParameter34Value(Parameter34Value string) (*CreateStreamParams){ + params.Parameter34Value = &Parameter34Value + return params } -func (params *CreateStreamParams) SetParameter35Name(Parameter35Name string) *CreateStreamParams { - params.Parameter35Name = &Parameter35Name - return params +func (params *CreateStreamParams) SetParameter35Name(Parameter35Name string) (*CreateStreamParams){ + params.Parameter35Name = &Parameter35Name + return params } -func (params *CreateStreamParams) SetParameter35Value(Parameter35Value string) *CreateStreamParams { - params.Parameter35Value = &Parameter35Value - return params +func (params *CreateStreamParams) SetParameter35Value(Parameter35Value string) (*CreateStreamParams){ + params.Parameter35Value = &Parameter35Value + return params } -func (params *CreateStreamParams) SetParameter36Name(Parameter36Name string) *CreateStreamParams { - params.Parameter36Name = &Parameter36Name - return params +func (params *CreateStreamParams) SetParameter36Name(Parameter36Name string) (*CreateStreamParams){ + params.Parameter36Name = &Parameter36Name + return params } -func (params *CreateStreamParams) SetParameter36Value(Parameter36Value string) *CreateStreamParams { - params.Parameter36Value = &Parameter36Value - return params +func (params *CreateStreamParams) SetParameter36Value(Parameter36Value string) (*CreateStreamParams){ + params.Parameter36Value = &Parameter36Value + return params } -func (params *CreateStreamParams) SetParameter37Name(Parameter37Name string) *CreateStreamParams { - params.Parameter37Name = &Parameter37Name - return params +func (params *CreateStreamParams) SetParameter37Name(Parameter37Name string) (*CreateStreamParams){ + params.Parameter37Name = &Parameter37Name + return params } -func (params *CreateStreamParams) SetParameter37Value(Parameter37Value string) *CreateStreamParams { - params.Parameter37Value = &Parameter37Value - return params +func (params *CreateStreamParams) SetParameter37Value(Parameter37Value string) (*CreateStreamParams){ + params.Parameter37Value = &Parameter37Value + return params } -func (params *CreateStreamParams) SetParameter38Name(Parameter38Name string) *CreateStreamParams { - params.Parameter38Name = &Parameter38Name - return params +func (params *CreateStreamParams) SetParameter38Name(Parameter38Name string) (*CreateStreamParams){ + params.Parameter38Name = &Parameter38Name + return params } -func (params *CreateStreamParams) SetParameter38Value(Parameter38Value string) *CreateStreamParams { - params.Parameter38Value = &Parameter38Value - return params +func (params *CreateStreamParams) SetParameter38Value(Parameter38Value string) (*CreateStreamParams){ + params.Parameter38Value = &Parameter38Value + return params } -func (params *CreateStreamParams) SetParameter39Name(Parameter39Name string) *CreateStreamParams { - params.Parameter39Name = &Parameter39Name - return params +func (params *CreateStreamParams) SetParameter39Name(Parameter39Name string) (*CreateStreamParams){ + params.Parameter39Name = &Parameter39Name + return params } -func (params *CreateStreamParams) SetParameter39Value(Parameter39Value string) *CreateStreamParams { - params.Parameter39Value = &Parameter39Value - return params +func (params *CreateStreamParams) SetParameter39Value(Parameter39Value string) (*CreateStreamParams){ + params.Parameter39Value = &Parameter39Value + return params } -func (params *CreateStreamParams) SetParameter40Name(Parameter40Name string) *CreateStreamParams { - params.Parameter40Name = &Parameter40Name - return params +func (params *CreateStreamParams) SetParameter40Name(Parameter40Name string) (*CreateStreamParams){ + params.Parameter40Name = &Parameter40Name + return params } -func (params *CreateStreamParams) SetParameter40Value(Parameter40Value string) *CreateStreamParams { - params.Parameter40Value = &Parameter40Value - return params +func (params *CreateStreamParams) SetParameter40Value(Parameter40Value string) (*CreateStreamParams){ + params.Parameter40Value = &Parameter40Value + return params } -func (params *CreateStreamParams) SetParameter41Name(Parameter41Name string) *CreateStreamParams { - params.Parameter41Name = &Parameter41Name - return params +func (params *CreateStreamParams) SetParameter41Name(Parameter41Name string) (*CreateStreamParams){ + params.Parameter41Name = &Parameter41Name + return params } -func (params *CreateStreamParams) SetParameter41Value(Parameter41Value string) *CreateStreamParams { - params.Parameter41Value = &Parameter41Value - return params +func (params *CreateStreamParams) SetParameter41Value(Parameter41Value string) (*CreateStreamParams){ + params.Parameter41Value = &Parameter41Value + return params } -func (params *CreateStreamParams) SetParameter42Name(Parameter42Name string) *CreateStreamParams { - params.Parameter42Name = &Parameter42Name - return params +func (params *CreateStreamParams) SetParameter42Name(Parameter42Name string) (*CreateStreamParams){ + params.Parameter42Name = &Parameter42Name + return params } -func (params *CreateStreamParams) SetParameter42Value(Parameter42Value string) *CreateStreamParams { - params.Parameter42Value = &Parameter42Value - return params +func (params *CreateStreamParams) SetParameter42Value(Parameter42Value string) (*CreateStreamParams){ + params.Parameter42Value = &Parameter42Value + return params } -func (params *CreateStreamParams) SetParameter43Name(Parameter43Name string) *CreateStreamParams { - params.Parameter43Name = &Parameter43Name - return params +func (params *CreateStreamParams) SetParameter43Name(Parameter43Name string) (*CreateStreamParams){ + params.Parameter43Name = &Parameter43Name + return params } -func (params *CreateStreamParams) SetParameter43Value(Parameter43Value string) *CreateStreamParams { - params.Parameter43Value = &Parameter43Value - return params +func (params *CreateStreamParams) SetParameter43Value(Parameter43Value string) (*CreateStreamParams){ + params.Parameter43Value = &Parameter43Value + return params } -func (params *CreateStreamParams) SetParameter44Name(Parameter44Name string) *CreateStreamParams { - params.Parameter44Name = &Parameter44Name - return params +func (params *CreateStreamParams) SetParameter44Name(Parameter44Name string) (*CreateStreamParams){ + params.Parameter44Name = &Parameter44Name + return params } -func (params *CreateStreamParams) SetParameter44Value(Parameter44Value string) *CreateStreamParams { - params.Parameter44Value = &Parameter44Value - return params +func (params *CreateStreamParams) SetParameter44Value(Parameter44Value string) (*CreateStreamParams){ + params.Parameter44Value = &Parameter44Value + return params } -func (params *CreateStreamParams) SetParameter45Name(Parameter45Name string) *CreateStreamParams { - params.Parameter45Name = &Parameter45Name - return params +func (params *CreateStreamParams) SetParameter45Name(Parameter45Name string) (*CreateStreamParams){ + params.Parameter45Name = &Parameter45Name + return params } -func (params *CreateStreamParams) SetParameter45Value(Parameter45Value string) *CreateStreamParams { - params.Parameter45Value = &Parameter45Value - return params +func (params *CreateStreamParams) SetParameter45Value(Parameter45Value string) (*CreateStreamParams){ + params.Parameter45Value = &Parameter45Value + return params } -func (params *CreateStreamParams) SetParameter46Name(Parameter46Name string) *CreateStreamParams { - params.Parameter46Name = &Parameter46Name - return params +func (params *CreateStreamParams) SetParameter46Name(Parameter46Name string) (*CreateStreamParams){ + params.Parameter46Name = &Parameter46Name + return params } -func (params *CreateStreamParams) SetParameter46Value(Parameter46Value string) *CreateStreamParams { - params.Parameter46Value = &Parameter46Value - return params +func (params *CreateStreamParams) SetParameter46Value(Parameter46Value string) (*CreateStreamParams){ + params.Parameter46Value = &Parameter46Value + return params } -func (params *CreateStreamParams) SetParameter47Name(Parameter47Name string) *CreateStreamParams { - params.Parameter47Name = &Parameter47Name - return params +func (params *CreateStreamParams) SetParameter47Name(Parameter47Name string) (*CreateStreamParams){ + params.Parameter47Name = &Parameter47Name + return params } -func (params *CreateStreamParams) SetParameter47Value(Parameter47Value string) *CreateStreamParams { - params.Parameter47Value = &Parameter47Value - return params +func (params *CreateStreamParams) SetParameter47Value(Parameter47Value string) (*CreateStreamParams){ + params.Parameter47Value = &Parameter47Value + return params } -func (params *CreateStreamParams) SetParameter48Name(Parameter48Name string) *CreateStreamParams { - params.Parameter48Name = &Parameter48Name - return params +func (params *CreateStreamParams) SetParameter48Name(Parameter48Name string) (*CreateStreamParams){ + params.Parameter48Name = &Parameter48Name + return params } -func (params *CreateStreamParams) SetParameter48Value(Parameter48Value string) *CreateStreamParams { - params.Parameter48Value = &Parameter48Value - return params +func (params *CreateStreamParams) SetParameter48Value(Parameter48Value string) (*CreateStreamParams){ + params.Parameter48Value = &Parameter48Value + return params } -func (params *CreateStreamParams) SetParameter49Name(Parameter49Name string) *CreateStreamParams { - params.Parameter49Name = &Parameter49Name - return params +func (params *CreateStreamParams) SetParameter49Name(Parameter49Name string) (*CreateStreamParams){ + params.Parameter49Name = &Parameter49Name + return params } -func (params *CreateStreamParams) SetParameter49Value(Parameter49Value string) *CreateStreamParams { - params.Parameter49Value = &Parameter49Value - return params +func (params *CreateStreamParams) SetParameter49Value(Parameter49Value string) (*CreateStreamParams){ + params.Parameter49Value = &Parameter49Value + return params } -func (params *CreateStreamParams) SetParameter50Name(Parameter50Name string) *CreateStreamParams { - params.Parameter50Name = &Parameter50Name - return params +func (params *CreateStreamParams) SetParameter50Name(Parameter50Name string) (*CreateStreamParams){ + params.Parameter50Name = &Parameter50Name + return params } -func (params *CreateStreamParams) SetParameter50Value(Parameter50Value string) *CreateStreamParams { - params.Parameter50Value = &Parameter50Value - return params +func (params *CreateStreamParams) SetParameter50Value(Parameter50Value string) (*CreateStreamParams){ + params.Parameter50Value = &Parameter50Value + return params } -func (params *CreateStreamParams) SetParameter51Name(Parameter51Name string) *CreateStreamParams { - params.Parameter51Name = &Parameter51Name - return params +func (params *CreateStreamParams) SetParameter51Name(Parameter51Name string) (*CreateStreamParams){ + params.Parameter51Name = &Parameter51Name + return params } -func (params *CreateStreamParams) SetParameter51Value(Parameter51Value string) *CreateStreamParams { - params.Parameter51Value = &Parameter51Value - return params +func (params *CreateStreamParams) SetParameter51Value(Parameter51Value string) (*CreateStreamParams){ + params.Parameter51Value = &Parameter51Value + return params } -func (params *CreateStreamParams) SetParameter52Name(Parameter52Name string) *CreateStreamParams { - params.Parameter52Name = &Parameter52Name - return params +func (params *CreateStreamParams) SetParameter52Name(Parameter52Name string) (*CreateStreamParams){ + params.Parameter52Name = &Parameter52Name + return params } -func (params *CreateStreamParams) SetParameter52Value(Parameter52Value string) *CreateStreamParams { - params.Parameter52Value = &Parameter52Value - return params +func (params *CreateStreamParams) SetParameter52Value(Parameter52Value string) (*CreateStreamParams){ + params.Parameter52Value = &Parameter52Value + return params } -func (params *CreateStreamParams) SetParameter53Name(Parameter53Name string) *CreateStreamParams { - params.Parameter53Name = &Parameter53Name - return params +func (params *CreateStreamParams) SetParameter53Name(Parameter53Name string) (*CreateStreamParams){ + params.Parameter53Name = &Parameter53Name + return params } -func (params *CreateStreamParams) SetParameter53Value(Parameter53Value string) *CreateStreamParams { - params.Parameter53Value = &Parameter53Value - return params +func (params *CreateStreamParams) SetParameter53Value(Parameter53Value string) (*CreateStreamParams){ + params.Parameter53Value = &Parameter53Value + return params } -func (params *CreateStreamParams) SetParameter54Name(Parameter54Name string) *CreateStreamParams { - params.Parameter54Name = &Parameter54Name - return params +func (params *CreateStreamParams) SetParameter54Name(Parameter54Name string) (*CreateStreamParams){ + params.Parameter54Name = &Parameter54Name + return params } -func (params *CreateStreamParams) SetParameter54Value(Parameter54Value string) *CreateStreamParams { - params.Parameter54Value = &Parameter54Value - return params +func (params *CreateStreamParams) SetParameter54Value(Parameter54Value string) (*CreateStreamParams){ + params.Parameter54Value = &Parameter54Value + return params } -func (params *CreateStreamParams) SetParameter55Name(Parameter55Name string) *CreateStreamParams { - params.Parameter55Name = &Parameter55Name - return params +func (params *CreateStreamParams) SetParameter55Name(Parameter55Name string) (*CreateStreamParams){ + params.Parameter55Name = &Parameter55Name + return params } -func (params *CreateStreamParams) SetParameter55Value(Parameter55Value string) *CreateStreamParams { - params.Parameter55Value = &Parameter55Value - return params +func (params *CreateStreamParams) SetParameter55Value(Parameter55Value string) (*CreateStreamParams){ + params.Parameter55Value = &Parameter55Value + return params } -func (params *CreateStreamParams) SetParameter56Name(Parameter56Name string) *CreateStreamParams { - params.Parameter56Name = &Parameter56Name - return params +func (params *CreateStreamParams) SetParameter56Name(Parameter56Name string) (*CreateStreamParams){ + params.Parameter56Name = &Parameter56Name + return params } -func (params *CreateStreamParams) SetParameter56Value(Parameter56Value string) *CreateStreamParams { - params.Parameter56Value = &Parameter56Value - return params +func (params *CreateStreamParams) SetParameter56Value(Parameter56Value string) (*CreateStreamParams){ + params.Parameter56Value = &Parameter56Value + return params } -func (params *CreateStreamParams) SetParameter57Name(Parameter57Name string) *CreateStreamParams { - params.Parameter57Name = &Parameter57Name - return params +func (params *CreateStreamParams) SetParameter57Name(Parameter57Name string) (*CreateStreamParams){ + params.Parameter57Name = &Parameter57Name + return params } -func (params *CreateStreamParams) SetParameter57Value(Parameter57Value string) *CreateStreamParams { - params.Parameter57Value = &Parameter57Value - return params +func (params *CreateStreamParams) SetParameter57Value(Parameter57Value string) (*CreateStreamParams){ + params.Parameter57Value = &Parameter57Value + return params } -func (params *CreateStreamParams) SetParameter58Name(Parameter58Name string) *CreateStreamParams { - params.Parameter58Name = &Parameter58Name - return params +func (params *CreateStreamParams) SetParameter58Name(Parameter58Name string) (*CreateStreamParams){ + params.Parameter58Name = &Parameter58Name + return params } -func (params *CreateStreamParams) SetParameter58Value(Parameter58Value string) *CreateStreamParams { - params.Parameter58Value = &Parameter58Value - return params +func (params *CreateStreamParams) SetParameter58Value(Parameter58Value string) (*CreateStreamParams){ + params.Parameter58Value = &Parameter58Value + return params } -func (params *CreateStreamParams) SetParameter59Name(Parameter59Name string) *CreateStreamParams { - params.Parameter59Name = &Parameter59Name - return params +func (params *CreateStreamParams) SetParameter59Name(Parameter59Name string) (*CreateStreamParams){ + params.Parameter59Name = &Parameter59Name + return params } -func (params *CreateStreamParams) SetParameter59Value(Parameter59Value string) *CreateStreamParams { - params.Parameter59Value = &Parameter59Value - return params +func (params *CreateStreamParams) SetParameter59Value(Parameter59Value string) (*CreateStreamParams){ + params.Parameter59Value = &Parameter59Value + return params } -func (params *CreateStreamParams) SetParameter60Name(Parameter60Name string) *CreateStreamParams { - params.Parameter60Name = &Parameter60Name - return params +func (params *CreateStreamParams) SetParameter60Name(Parameter60Name string) (*CreateStreamParams){ + params.Parameter60Name = &Parameter60Name + return params } -func (params *CreateStreamParams) SetParameter60Value(Parameter60Value string) *CreateStreamParams { - params.Parameter60Value = &Parameter60Value - return params +func (params *CreateStreamParams) SetParameter60Value(Parameter60Value string) (*CreateStreamParams){ + params.Parameter60Value = &Parameter60Value + return params } -func (params *CreateStreamParams) SetParameter61Name(Parameter61Name string) *CreateStreamParams { - params.Parameter61Name = &Parameter61Name - return params +func (params *CreateStreamParams) SetParameter61Name(Parameter61Name string) (*CreateStreamParams){ + params.Parameter61Name = &Parameter61Name + return params } -func (params *CreateStreamParams) SetParameter61Value(Parameter61Value string) *CreateStreamParams { - params.Parameter61Value = &Parameter61Value - return params +func (params *CreateStreamParams) SetParameter61Value(Parameter61Value string) (*CreateStreamParams){ + params.Parameter61Value = &Parameter61Value + return params } -func (params *CreateStreamParams) SetParameter62Name(Parameter62Name string) *CreateStreamParams { - params.Parameter62Name = &Parameter62Name - return params +func (params *CreateStreamParams) SetParameter62Name(Parameter62Name string) (*CreateStreamParams){ + params.Parameter62Name = &Parameter62Name + return params } -func (params *CreateStreamParams) SetParameter62Value(Parameter62Value string) *CreateStreamParams { - params.Parameter62Value = &Parameter62Value - return params +func (params *CreateStreamParams) SetParameter62Value(Parameter62Value string) (*CreateStreamParams){ + params.Parameter62Value = &Parameter62Value + return params } -func (params *CreateStreamParams) SetParameter63Name(Parameter63Name string) *CreateStreamParams { - params.Parameter63Name = &Parameter63Name - return params +func (params *CreateStreamParams) SetParameter63Name(Parameter63Name string) (*CreateStreamParams){ + params.Parameter63Name = &Parameter63Name + return params } -func (params *CreateStreamParams) SetParameter63Value(Parameter63Value string) *CreateStreamParams { - params.Parameter63Value = &Parameter63Value - return params +func (params *CreateStreamParams) SetParameter63Value(Parameter63Value string) (*CreateStreamParams){ + params.Parameter63Value = &Parameter63Value + return params } -func (params *CreateStreamParams) SetParameter64Name(Parameter64Name string) *CreateStreamParams { - params.Parameter64Name = &Parameter64Name - return params +func (params *CreateStreamParams) SetParameter64Name(Parameter64Name string) (*CreateStreamParams){ + params.Parameter64Name = &Parameter64Name + return params } -func (params *CreateStreamParams) SetParameter64Value(Parameter64Value string) *CreateStreamParams { - params.Parameter64Value = &Parameter64Value - return params +func (params *CreateStreamParams) SetParameter64Value(Parameter64Value string) (*CreateStreamParams){ + params.Parameter64Value = &Parameter64Value + return params } -func (params *CreateStreamParams) SetParameter65Name(Parameter65Name string) *CreateStreamParams { - params.Parameter65Name = &Parameter65Name - return params +func (params *CreateStreamParams) SetParameter65Name(Parameter65Name string) (*CreateStreamParams){ + params.Parameter65Name = &Parameter65Name + return params } -func (params *CreateStreamParams) SetParameter65Value(Parameter65Value string) *CreateStreamParams { - params.Parameter65Value = &Parameter65Value - return params +func (params *CreateStreamParams) SetParameter65Value(Parameter65Value string) (*CreateStreamParams){ + params.Parameter65Value = &Parameter65Value + return params } -func (params *CreateStreamParams) SetParameter66Name(Parameter66Name string) *CreateStreamParams { - params.Parameter66Name = &Parameter66Name - return params +func (params *CreateStreamParams) SetParameter66Name(Parameter66Name string) (*CreateStreamParams){ + params.Parameter66Name = &Parameter66Name + return params } -func (params *CreateStreamParams) SetParameter66Value(Parameter66Value string) *CreateStreamParams { - params.Parameter66Value = &Parameter66Value - return params +func (params *CreateStreamParams) SetParameter66Value(Parameter66Value string) (*CreateStreamParams){ + params.Parameter66Value = &Parameter66Value + return params } -func (params *CreateStreamParams) SetParameter67Name(Parameter67Name string) *CreateStreamParams { - params.Parameter67Name = &Parameter67Name - return params +func (params *CreateStreamParams) SetParameter67Name(Parameter67Name string) (*CreateStreamParams){ + params.Parameter67Name = &Parameter67Name + return params } -func (params *CreateStreamParams) SetParameter67Value(Parameter67Value string) *CreateStreamParams { - params.Parameter67Value = &Parameter67Value - return params +func (params *CreateStreamParams) SetParameter67Value(Parameter67Value string) (*CreateStreamParams){ + params.Parameter67Value = &Parameter67Value + return params } -func (params *CreateStreamParams) SetParameter68Name(Parameter68Name string) *CreateStreamParams { - params.Parameter68Name = &Parameter68Name - return params +func (params *CreateStreamParams) SetParameter68Name(Parameter68Name string) (*CreateStreamParams){ + params.Parameter68Name = &Parameter68Name + return params } -func (params *CreateStreamParams) SetParameter68Value(Parameter68Value string) *CreateStreamParams { - params.Parameter68Value = &Parameter68Value - return params +func (params *CreateStreamParams) SetParameter68Value(Parameter68Value string) (*CreateStreamParams){ + params.Parameter68Value = &Parameter68Value + return params } -func (params *CreateStreamParams) SetParameter69Name(Parameter69Name string) *CreateStreamParams { - params.Parameter69Name = &Parameter69Name - return params +func (params *CreateStreamParams) SetParameter69Name(Parameter69Name string) (*CreateStreamParams){ + params.Parameter69Name = &Parameter69Name + return params } -func (params *CreateStreamParams) SetParameter69Value(Parameter69Value string) *CreateStreamParams { - params.Parameter69Value = &Parameter69Value - return params +func (params *CreateStreamParams) SetParameter69Value(Parameter69Value string) (*CreateStreamParams){ + params.Parameter69Value = &Parameter69Value + return params } -func (params *CreateStreamParams) SetParameter70Name(Parameter70Name string) *CreateStreamParams { - params.Parameter70Name = &Parameter70Name - return params +func (params *CreateStreamParams) SetParameter70Name(Parameter70Name string) (*CreateStreamParams){ + params.Parameter70Name = &Parameter70Name + return params } -func (params *CreateStreamParams) SetParameter70Value(Parameter70Value string) *CreateStreamParams { - params.Parameter70Value = &Parameter70Value - return params +func (params *CreateStreamParams) SetParameter70Value(Parameter70Value string) (*CreateStreamParams){ + params.Parameter70Value = &Parameter70Value + return params } -func (params *CreateStreamParams) SetParameter71Name(Parameter71Name string) *CreateStreamParams { - params.Parameter71Name = &Parameter71Name - return params +func (params *CreateStreamParams) SetParameter71Name(Parameter71Name string) (*CreateStreamParams){ + params.Parameter71Name = &Parameter71Name + return params } -func (params *CreateStreamParams) SetParameter71Value(Parameter71Value string) *CreateStreamParams { - params.Parameter71Value = &Parameter71Value - return params +func (params *CreateStreamParams) SetParameter71Value(Parameter71Value string) (*CreateStreamParams){ + params.Parameter71Value = &Parameter71Value + return params } -func (params *CreateStreamParams) SetParameter72Name(Parameter72Name string) *CreateStreamParams { - params.Parameter72Name = &Parameter72Name - return params +func (params *CreateStreamParams) SetParameter72Name(Parameter72Name string) (*CreateStreamParams){ + params.Parameter72Name = &Parameter72Name + return params } -func (params *CreateStreamParams) SetParameter72Value(Parameter72Value string) *CreateStreamParams { - params.Parameter72Value = &Parameter72Value - return params +func (params *CreateStreamParams) SetParameter72Value(Parameter72Value string) (*CreateStreamParams){ + params.Parameter72Value = &Parameter72Value + return params } -func (params *CreateStreamParams) SetParameter73Name(Parameter73Name string) *CreateStreamParams { - params.Parameter73Name = &Parameter73Name - return params +func (params *CreateStreamParams) SetParameter73Name(Parameter73Name string) (*CreateStreamParams){ + params.Parameter73Name = &Parameter73Name + return params } -func (params *CreateStreamParams) SetParameter73Value(Parameter73Value string) *CreateStreamParams { - params.Parameter73Value = &Parameter73Value - return params +func (params *CreateStreamParams) SetParameter73Value(Parameter73Value string) (*CreateStreamParams){ + params.Parameter73Value = &Parameter73Value + return params } -func (params *CreateStreamParams) SetParameter74Name(Parameter74Name string) *CreateStreamParams { - params.Parameter74Name = &Parameter74Name - return params +func (params *CreateStreamParams) SetParameter74Name(Parameter74Name string) (*CreateStreamParams){ + params.Parameter74Name = &Parameter74Name + return params } -func (params *CreateStreamParams) SetParameter74Value(Parameter74Value string) *CreateStreamParams { - params.Parameter74Value = &Parameter74Value - return params +func (params *CreateStreamParams) SetParameter74Value(Parameter74Value string) (*CreateStreamParams){ + params.Parameter74Value = &Parameter74Value + return params } -func (params *CreateStreamParams) SetParameter75Name(Parameter75Name string) *CreateStreamParams { - params.Parameter75Name = &Parameter75Name - return params +func (params *CreateStreamParams) SetParameter75Name(Parameter75Name string) (*CreateStreamParams){ + params.Parameter75Name = &Parameter75Name + return params } -func (params *CreateStreamParams) SetParameter75Value(Parameter75Value string) *CreateStreamParams { - params.Parameter75Value = &Parameter75Value - return params +func (params *CreateStreamParams) SetParameter75Value(Parameter75Value string) (*CreateStreamParams){ + params.Parameter75Value = &Parameter75Value + return params } -func (params *CreateStreamParams) SetParameter76Name(Parameter76Name string) *CreateStreamParams { - params.Parameter76Name = &Parameter76Name - return params +func (params *CreateStreamParams) SetParameter76Name(Parameter76Name string) (*CreateStreamParams){ + params.Parameter76Name = &Parameter76Name + return params } -func (params *CreateStreamParams) SetParameter76Value(Parameter76Value string) *CreateStreamParams { - params.Parameter76Value = &Parameter76Value - return params +func (params *CreateStreamParams) SetParameter76Value(Parameter76Value string) (*CreateStreamParams){ + params.Parameter76Value = &Parameter76Value + return params } -func (params *CreateStreamParams) SetParameter77Name(Parameter77Name string) *CreateStreamParams { - params.Parameter77Name = &Parameter77Name - return params +func (params *CreateStreamParams) SetParameter77Name(Parameter77Name string) (*CreateStreamParams){ + params.Parameter77Name = &Parameter77Name + return params } -func (params *CreateStreamParams) SetParameter77Value(Parameter77Value string) *CreateStreamParams { - params.Parameter77Value = &Parameter77Value - return params +func (params *CreateStreamParams) SetParameter77Value(Parameter77Value string) (*CreateStreamParams){ + params.Parameter77Value = &Parameter77Value + return params } -func (params *CreateStreamParams) SetParameter78Name(Parameter78Name string) *CreateStreamParams { - params.Parameter78Name = &Parameter78Name - return params +func (params *CreateStreamParams) SetParameter78Name(Parameter78Name string) (*CreateStreamParams){ + params.Parameter78Name = &Parameter78Name + return params } -func (params *CreateStreamParams) SetParameter78Value(Parameter78Value string) *CreateStreamParams { - params.Parameter78Value = &Parameter78Value - return params +func (params *CreateStreamParams) SetParameter78Value(Parameter78Value string) (*CreateStreamParams){ + params.Parameter78Value = &Parameter78Value + return params } -func (params *CreateStreamParams) SetParameter79Name(Parameter79Name string) *CreateStreamParams { - params.Parameter79Name = &Parameter79Name - return params +func (params *CreateStreamParams) SetParameter79Name(Parameter79Name string) (*CreateStreamParams){ + params.Parameter79Name = &Parameter79Name + return params } -func (params *CreateStreamParams) SetParameter79Value(Parameter79Value string) *CreateStreamParams { - params.Parameter79Value = &Parameter79Value - return params +func (params *CreateStreamParams) SetParameter79Value(Parameter79Value string) (*CreateStreamParams){ + params.Parameter79Value = &Parameter79Value + return params } -func (params *CreateStreamParams) SetParameter80Name(Parameter80Name string) *CreateStreamParams { - params.Parameter80Name = &Parameter80Name - return params +func (params *CreateStreamParams) SetParameter80Name(Parameter80Name string) (*CreateStreamParams){ + params.Parameter80Name = &Parameter80Name + return params } -func (params *CreateStreamParams) SetParameter80Value(Parameter80Value string) *CreateStreamParams { - params.Parameter80Value = &Parameter80Value - return params +func (params *CreateStreamParams) SetParameter80Value(Parameter80Value string) (*CreateStreamParams){ + params.Parameter80Value = &Parameter80Value + return params } -func (params *CreateStreamParams) SetParameter81Name(Parameter81Name string) *CreateStreamParams { - params.Parameter81Name = &Parameter81Name - return params +func (params *CreateStreamParams) SetParameter81Name(Parameter81Name string) (*CreateStreamParams){ + params.Parameter81Name = &Parameter81Name + return params } -func (params *CreateStreamParams) SetParameter81Value(Parameter81Value string) *CreateStreamParams { - params.Parameter81Value = &Parameter81Value - return params +func (params *CreateStreamParams) SetParameter81Value(Parameter81Value string) (*CreateStreamParams){ + params.Parameter81Value = &Parameter81Value + return params } -func (params *CreateStreamParams) SetParameter82Name(Parameter82Name string) *CreateStreamParams { - params.Parameter82Name = &Parameter82Name - return params +func (params *CreateStreamParams) SetParameter82Name(Parameter82Name string) (*CreateStreamParams){ + params.Parameter82Name = &Parameter82Name + return params } -func (params *CreateStreamParams) SetParameter82Value(Parameter82Value string) *CreateStreamParams { - params.Parameter82Value = &Parameter82Value - return params +func (params *CreateStreamParams) SetParameter82Value(Parameter82Value string) (*CreateStreamParams){ + params.Parameter82Value = &Parameter82Value + return params } -func (params *CreateStreamParams) SetParameter83Name(Parameter83Name string) *CreateStreamParams { - params.Parameter83Name = &Parameter83Name - return params +func (params *CreateStreamParams) SetParameter83Name(Parameter83Name string) (*CreateStreamParams){ + params.Parameter83Name = &Parameter83Name + return params } -func (params *CreateStreamParams) SetParameter83Value(Parameter83Value string) *CreateStreamParams { - params.Parameter83Value = &Parameter83Value - return params +func (params *CreateStreamParams) SetParameter83Value(Parameter83Value string) (*CreateStreamParams){ + params.Parameter83Value = &Parameter83Value + return params } -func (params *CreateStreamParams) SetParameter84Name(Parameter84Name string) *CreateStreamParams { - params.Parameter84Name = &Parameter84Name - return params +func (params *CreateStreamParams) SetParameter84Name(Parameter84Name string) (*CreateStreamParams){ + params.Parameter84Name = &Parameter84Name + return params } -func (params *CreateStreamParams) SetParameter84Value(Parameter84Value string) *CreateStreamParams { - params.Parameter84Value = &Parameter84Value - return params +func (params *CreateStreamParams) SetParameter84Value(Parameter84Value string) (*CreateStreamParams){ + params.Parameter84Value = &Parameter84Value + return params } -func (params *CreateStreamParams) SetParameter85Name(Parameter85Name string) *CreateStreamParams { - params.Parameter85Name = &Parameter85Name - return params +func (params *CreateStreamParams) SetParameter85Name(Parameter85Name string) (*CreateStreamParams){ + params.Parameter85Name = &Parameter85Name + return params } -func (params *CreateStreamParams) SetParameter85Value(Parameter85Value string) *CreateStreamParams { - params.Parameter85Value = &Parameter85Value - return params +func (params *CreateStreamParams) SetParameter85Value(Parameter85Value string) (*CreateStreamParams){ + params.Parameter85Value = &Parameter85Value + return params } -func (params *CreateStreamParams) SetParameter86Name(Parameter86Name string) *CreateStreamParams { - params.Parameter86Name = &Parameter86Name - return params +func (params *CreateStreamParams) SetParameter86Name(Parameter86Name string) (*CreateStreamParams){ + params.Parameter86Name = &Parameter86Name + return params } -func (params *CreateStreamParams) SetParameter86Value(Parameter86Value string) *CreateStreamParams { - params.Parameter86Value = &Parameter86Value - return params +func (params *CreateStreamParams) SetParameter86Value(Parameter86Value string) (*CreateStreamParams){ + params.Parameter86Value = &Parameter86Value + return params } -func (params *CreateStreamParams) SetParameter87Name(Parameter87Name string) *CreateStreamParams { - params.Parameter87Name = &Parameter87Name - return params +func (params *CreateStreamParams) SetParameter87Name(Parameter87Name string) (*CreateStreamParams){ + params.Parameter87Name = &Parameter87Name + return params } -func (params *CreateStreamParams) SetParameter87Value(Parameter87Value string) *CreateStreamParams { - params.Parameter87Value = &Parameter87Value - return params +func (params *CreateStreamParams) SetParameter87Value(Parameter87Value string) (*CreateStreamParams){ + params.Parameter87Value = &Parameter87Value + return params } -func (params *CreateStreamParams) SetParameter88Name(Parameter88Name string) *CreateStreamParams { - params.Parameter88Name = &Parameter88Name - return params +func (params *CreateStreamParams) SetParameter88Name(Parameter88Name string) (*CreateStreamParams){ + params.Parameter88Name = &Parameter88Name + return params } -func (params *CreateStreamParams) SetParameter88Value(Parameter88Value string) *CreateStreamParams { - params.Parameter88Value = &Parameter88Value - return params +func (params *CreateStreamParams) SetParameter88Value(Parameter88Value string) (*CreateStreamParams){ + params.Parameter88Value = &Parameter88Value + return params } -func (params *CreateStreamParams) SetParameter89Name(Parameter89Name string) *CreateStreamParams { - params.Parameter89Name = &Parameter89Name - return params +func (params *CreateStreamParams) SetParameter89Name(Parameter89Name string) (*CreateStreamParams){ + params.Parameter89Name = &Parameter89Name + return params } -func (params *CreateStreamParams) SetParameter89Value(Parameter89Value string) *CreateStreamParams { - params.Parameter89Value = &Parameter89Value - return params +func (params *CreateStreamParams) SetParameter89Value(Parameter89Value string) (*CreateStreamParams){ + params.Parameter89Value = &Parameter89Value + return params } -func (params *CreateStreamParams) SetParameter90Name(Parameter90Name string) *CreateStreamParams { - params.Parameter90Name = &Parameter90Name - return params +func (params *CreateStreamParams) SetParameter90Name(Parameter90Name string) (*CreateStreamParams){ + params.Parameter90Name = &Parameter90Name + return params } -func (params *CreateStreamParams) SetParameter90Value(Parameter90Value string) *CreateStreamParams { - params.Parameter90Value = &Parameter90Value - return params +func (params *CreateStreamParams) SetParameter90Value(Parameter90Value string) (*CreateStreamParams){ + params.Parameter90Value = &Parameter90Value + return params } -func (params *CreateStreamParams) SetParameter91Name(Parameter91Name string) *CreateStreamParams { - params.Parameter91Name = &Parameter91Name - return params +func (params *CreateStreamParams) SetParameter91Name(Parameter91Name string) (*CreateStreamParams){ + params.Parameter91Name = &Parameter91Name + return params } -func (params *CreateStreamParams) SetParameter91Value(Parameter91Value string) *CreateStreamParams { - params.Parameter91Value = &Parameter91Value - return params +func (params *CreateStreamParams) SetParameter91Value(Parameter91Value string) (*CreateStreamParams){ + params.Parameter91Value = &Parameter91Value + return params } -func (params *CreateStreamParams) SetParameter92Name(Parameter92Name string) *CreateStreamParams { - params.Parameter92Name = &Parameter92Name - return params +func (params *CreateStreamParams) SetParameter92Name(Parameter92Name string) (*CreateStreamParams){ + params.Parameter92Name = &Parameter92Name + return params } -func (params *CreateStreamParams) SetParameter92Value(Parameter92Value string) *CreateStreamParams { - params.Parameter92Value = &Parameter92Value - return params +func (params *CreateStreamParams) SetParameter92Value(Parameter92Value string) (*CreateStreamParams){ + params.Parameter92Value = &Parameter92Value + return params } -func (params *CreateStreamParams) SetParameter93Name(Parameter93Name string) *CreateStreamParams { - params.Parameter93Name = &Parameter93Name - return params +func (params *CreateStreamParams) SetParameter93Name(Parameter93Name string) (*CreateStreamParams){ + params.Parameter93Name = &Parameter93Name + return params } -func (params *CreateStreamParams) SetParameter93Value(Parameter93Value string) *CreateStreamParams { - params.Parameter93Value = &Parameter93Value - return params +func (params *CreateStreamParams) SetParameter93Value(Parameter93Value string) (*CreateStreamParams){ + params.Parameter93Value = &Parameter93Value + return params } -func (params *CreateStreamParams) SetParameter94Name(Parameter94Name string) *CreateStreamParams { - params.Parameter94Name = &Parameter94Name - return params +func (params *CreateStreamParams) SetParameter94Name(Parameter94Name string) (*CreateStreamParams){ + params.Parameter94Name = &Parameter94Name + return params } -func (params *CreateStreamParams) SetParameter94Value(Parameter94Value string) *CreateStreamParams { - params.Parameter94Value = &Parameter94Value - return params +func (params *CreateStreamParams) SetParameter94Value(Parameter94Value string) (*CreateStreamParams){ + params.Parameter94Value = &Parameter94Value + return params } -func (params *CreateStreamParams) SetParameter95Name(Parameter95Name string) *CreateStreamParams { - params.Parameter95Name = &Parameter95Name - return params +func (params *CreateStreamParams) SetParameter95Name(Parameter95Name string) (*CreateStreamParams){ + params.Parameter95Name = &Parameter95Name + return params } -func (params *CreateStreamParams) SetParameter95Value(Parameter95Value string) *CreateStreamParams { - params.Parameter95Value = &Parameter95Value - return params +func (params *CreateStreamParams) SetParameter95Value(Parameter95Value string) (*CreateStreamParams){ + params.Parameter95Value = &Parameter95Value + return params } -func (params *CreateStreamParams) SetParameter96Name(Parameter96Name string) *CreateStreamParams { - params.Parameter96Name = &Parameter96Name - return params +func (params *CreateStreamParams) SetParameter96Name(Parameter96Name string) (*CreateStreamParams){ + params.Parameter96Name = &Parameter96Name + return params } -func (params *CreateStreamParams) SetParameter96Value(Parameter96Value string) *CreateStreamParams { - params.Parameter96Value = &Parameter96Value - return params +func (params *CreateStreamParams) SetParameter96Value(Parameter96Value string) (*CreateStreamParams){ + params.Parameter96Value = &Parameter96Value + return params } -func (params *CreateStreamParams) SetParameter97Name(Parameter97Name string) *CreateStreamParams { - params.Parameter97Name = &Parameter97Name - return params +func (params *CreateStreamParams) SetParameter97Name(Parameter97Name string) (*CreateStreamParams){ + params.Parameter97Name = &Parameter97Name + return params } -func (params *CreateStreamParams) SetParameter97Value(Parameter97Value string) *CreateStreamParams { - params.Parameter97Value = &Parameter97Value - return params +func (params *CreateStreamParams) SetParameter97Value(Parameter97Value string) (*CreateStreamParams){ + params.Parameter97Value = &Parameter97Value + return params } -func (params *CreateStreamParams) SetParameter98Name(Parameter98Name string) *CreateStreamParams { - params.Parameter98Name = &Parameter98Name - return params +func (params *CreateStreamParams) SetParameter98Name(Parameter98Name string) (*CreateStreamParams){ + params.Parameter98Name = &Parameter98Name + return params } -func (params *CreateStreamParams) SetParameter98Value(Parameter98Value string) *CreateStreamParams { - params.Parameter98Value = &Parameter98Value - return params +func (params *CreateStreamParams) SetParameter98Value(Parameter98Value string) (*CreateStreamParams){ + params.Parameter98Value = &Parameter98Value + return params } -func (params *CreateStreamParams) SetParameter99Name(Parameter99Name string) *CreateStreamParams { - params.Parameter99Name = &Parameter99Name - return params +func (params *CreateStreamParams) SetParameter99Name(Parameter99Name string) (*CreateStreamParams){ + params.Parameter99Name = &Parameter99Name + return params } -func (params *CreateStreamParams) SetParameter99Value(Parameter99Value string) *CreateStreamParams { - params.Parameter99Value = &Parameter99Value - return params +func (params *CreateStreamParams) SetParameter99Value(Parameter99Value string) (*CreateStreamParams){ + params.Parameter99Value = &Parameter99Value + return params } // Create a Stream func (c *ApiService) CreateStream(CallSid string, params *CreateStreamParams) (*ApiV2010Stream, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Streams.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Streams.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Url != nil { - data.Set("Url", *params.Url) - } - if params != nil && params.Name != nil { - data.Set("Name", *params.Name) - } - if params != nil && params.Track != nil { - data.Set("Track", *params.Track) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.Parameter1Name != nil { - data.Set("Parameter1.Name", *params.Parameter1Name) - } - if params != nil && params.Parameter1Value != nil { - data.Set("Parameter1.Value", *params.Parameter1Value) - } - if params != nil && params.Parameter2Name != nil { - data.Set("Parameter2.Name", *params.Parameter2Name) - } - if params != nil && params.Parameter2Value != nil { - data.Set("Parameter2.Value", *params.Parameter2Value) - } - if params != nil && params.Parameter3Name != nil { - data.Set("Parameter3.Name", *params.Parameter3Name) - } - if params != nil && params.Parameter3Value != nil { - data.Set("Parameter3.Value", *params.Parameter3Value) - } - if params != nil && params.Parameter4Name != nil { - data.Set("Parameter4.Name", *params.Parameter4Name) - } - if params != nil && params.Parameter4Value != nil { - data.Set("Parameter4.Value", *params.Parameter4Value) - } - if params != nil && params.Parameter5Name != nil { - data.Set("Parameter5.Name", *params.Parameter5Name) - } - if params != nil && params.Parameter5Value != nil { - data.Set("Parameter5.Value", *params.Parameter5Value) - } - if params != nil && params.Parameter6Name != nil { - data.Set("Parameter6.Name", *params.Parameter6Name) - } - if params != nil && params.Parameter6Value != nil { - data.Set("Parameter6.Value", *params.Parameter6Value) - } - if params != nil && params.Parameter7Name != nil { - data.Set("Parameter7.Name", *params.Parameter7Name) - } - if params != nil && params.Parameter7Value != nil { - data.Set("Parameter7.Value", *params.Parameter7Value) - } - if params != nil && params.Parameter8Name != nil { - data.Set("Parameter8.Name", *params.Parameter8Name) - } - if params != nil && params.Parameter8Value != nil { - data.Set("Parameter8.Value", *params.Parameter8Value) - } - if params != nil && params.Parameter9Name != nil { - data.Set("Parameter9.Name", *params.Parameter9Name) - } - if params != nil && params.Parameter9Value != nil { - data.Set("Parameter9.Value", *params.Parameter9Value) - } - if params != nil && params.Parameter10Name != nil { - data.Set("Parameter10.Name", *params.Parameter10Name) - } - if params != nil && params.Parameter10Value != nil { - data.Set("Parameter10.Value", *params.Parameter10Value) - } - if params != nil && params.Parameter11Name != nil { - data.Set("Parameter11.Name", *params.Parameter11Name) - } - if params != nil && params.Parameter11Value != nil { - data.Set("Parameter11.Value", *params.Parameter11Value) - } - if params != nil && params.Parameter12Name != nil { - data.Set("Parameter12.Name", *params.Parameter12Name) - } - if params != nil && params.Parameter12Value != nil { - data.Set("Parameter12.Value", *params.Parameter12Value) - } - if params != nil && params.Parameter13Name != nil { - data.Set("Parameter13.Name", *params.Parameter13Name) - } - if params != nil && params.Parameter13Value != nil { - data.Set("Parameter13.Value", *params.Parameter13Value) - } - if params != nil && params.Parameter14Name != nil { - data.Set("Parameter14.Name", *params.Parameter14Name) - } - if params != nil && params.Parameter14Value != nil { - data.Set("Parameter14.Value", *params.Parameter14Value) - } - if params != nil && params.Parameter15Name != nil { - data.Set("Parameter15.Name", *params.Parameter15Name) - } - if params != nil && params.Parameter15Value != nil { - data.Set("Parameter15.Value", *params.Parameter15Value) - } - if params != nil && params.Parameter16Name != nil { - data.Set("Parameter16.Name", *params.Parameter16Name) - } - if params != nil && params.Parameter16Value != nil { - data.Set("Parameter16.Value", *params.Parameter16Value) - } - if params != nil && params.Parameter17Name != nil { - data.Set("Parameter17.Name", *params.Parameter17Name) - } - if params != nil && params.Parameter17Value != nil { - data.Set("Parameter17.Value", *params.Parameter17Value) - } - if params != nil && params.Parameter18Name != nil { - data.Set("Parameter18.Name", *params.Parameter18Name) - } - if params != nil && params.Parameter18Value != nil { - data.Set("Parameter18.Value", *params.Parameter18Value) - } - if params != nil && params.Parameter19Name != nil { - data.Set("Parameter19.Name", *params.Parameter19Name) - } - if params != nil && params.Parameter19Value != nil { - data.Set("Parameter19.Value", *params.Parameter19Value) - } - if params != nil && params.Parameter20Name != nil { - data.Set("Parameter20.Name", *params.Parameter20Name) - } - if params != nil && params.Parameter20Value != nil { - data.Set("Parameter20.Value", *params.Parameter20Value) - } - if params != nil && params.Parameter21Name != nil { - data.Set("Parameter21.Name", *params.Parameter21Name) - } - if params != nil && params.Parameter21Value != nil { - data.Set("Parameter21.Value", *params.Parameter21Value) - } - if params != nil && params.Parameter22Name != nil { - data.Set("Parameter22.Name", *params.Parameter22Name) - } - if params != nil && params.Parameter22Value != nil { - data.Set("Parameter22.Value", *params.Parameter22Value) - } - if params != nil && params.Parameter23Name != nil { - data.Set("Parameter23.Name", *params.Parameter23Name) - } - if params != nil && params.Parameter23Value != nil { - data.Set("Parameter23.Value", *params.Parameter23Value) - } - if params != nil && params.Parameter24Name != nil { - data.Set("Parameter24.Name", *params.Parameter24Name) - } - if params != nil && params.Parameter24Value != nil { - data.Set("Parameter24.Value", *params.Parameter24Value) - } - if params != nil && params.Parameter25Name != nil { - data.Set("Parameter25.Name", *params.Parameter25Name) - } - if params != nil && params.Parameter25Value != nil { - data.Set("Parameter25.Value", *params.Parameter25Value) - } - if params != nil && params.Parameter26Name != nil { - data.Set("Parameter26.Name", *params.Parameter26Name) - } - if params != nil && params.Parameter26Value != nil { - data.Set("Parameter26.Value", *params.Parameter26Value) - } - if params != nil && params.Parameter27Name != nil { - data.Set("Parameter27.Name", *params.Parameter27Name) - } - if params != nil && params.Parameter27Value != nil { - data.Set("Parameter27.Value", *params.Parameter27Value) - } - if params != nil && params.Parameter28Name != nil { - data.Set("Parameter28.Name", *params.Parameter28Name) - } - if params != nil && params.Parameter28Value != nil { - data.Set("Parameter28.Value", *params.Parameter28Value) - } - if params != nil && params.Parameter29Name != nil { - data.Set("Parameter29.Name", *params.Parameter29Name) - } - if params != nil && params.Parameter29Value != nil { - data.Set("Parameter29.Value", *params.Parameter29Value) - } - if params != nil && params.Parameter30Name != nil { - data.Set("Parameter30.Name", *params.Parameter30Name) - } - if params != nil && params.Parameter30Value != nil { - data.Set("Parameter30.Value", *params.Parameter30Value) - } - if params != nil && params.Parameter31Name != nil { - data.Set("Parameter31.Name", *params.Parameter31Name) - } - if params != nil && params.Parameter31Value != nil { - data.Set("Parameter31.Value", *params.Parameter31Value) - } - if params != nil && params.Parameter32Name != nil { - data.Set("Parameter32.Name", *params.Parameter32Name) - } - if params != nil && params.Parameter32Value != nil { - data.Set("Parameter32.Value", *params.Parameter32Value) - } - if params != nil && params.Parameter33Name != nil { - data.Set("Parameter33.Name", *params.Parameter33Name) - } - if params != nil && params.Parameter33Value != nil { - data.Set("Parameter33.Value", *params.Parameter33Value) - } - if params != nil && params.Parameter34Name != nil { - data.Set("Parameter34.Name", *params.Parameter34Name) - } - if params != nil && params.Parameter34Value != nil { - data.Set("Parameter34.Value", *params.Parameter34Value) - } - if params != nil && params.Parameter35Name != nil { - data.Set("Parameter35.Name", *params.Parameter35Name) - } - if params != nil && params.Parameter35Value != nil { - data.Set("Parameter35.Value", *params.Parameter35Value) - } - if params != nil && params.Parameter36Name != nil { - data.Set("Parameter36.Name", *params.Parameter36Name) - } - if params != nil && params.Parameter36Value != nil { - data.Set("Parameter36.Value", *params.Parameter36Value) - } - if params != nil && params.Parameter37Name != nil { - data.Set("Parameter37.Name", *params.Parameter37Name) - } - if params != nil && params.Parameter37Value != nil { - data.Set("Parameter37.Value", *params.Parameter37Value) - } - if params != nil && params.Parameter38Name != nil { - data.Set("Parameter38.Name", *params.Parameter38Name) - } - if params != nil && params.Parameter38Value != nil { - data.Set("Parameter38.Value", *params.Parameter38Value) - } - if params != nil && params.Parameter39Name != nil { - data.Set("Parameter39.Name", *params.Parameter39Name) - } - if params != nil && params.Parameter39Value != nil { - data.Set("Parameter39.Value", *params.Parameter39Value) - } - if params != nil && params.Parameter40Name != nil { - data.Set("Parameter40.Name", *params.Parameter40Name) - } - if params != nil && params.Parameter40Value != nil { - data.Set("Parameter40.Value", *params.Parameter40Value) - } - if params != nil && params.Parameter41Name != nil { - data.Set("Parameter41.Name", *params.Parameter41Name) - } - if params != nil && params.Parameter41Value != nil { - data.Set("Parameter41.Value", *params.Parameter41Value) - } - if params != nil && params.Parameter42Name != nil { - data.Set("Parameter42.Name", *params.Parameter42Name) - } - if params != nil && params.Parameter42Value != nil { - data.Set("Parameter42.Value", *params.Parameter42Value) - } - if params != nil && params.Parameter43Name != nil { - data.Set("Parameter43.Name", *params.Parameter43Name) - } - if params != nil && params.Parameter43Value != nil { - data.Set("Parameter43.Value", *params.Parameter43Value) - } - if params != nil && params.Parameter44Name != nil { - data.Set("Parameter44.Name", *params.Parameter44Name) - } - if params != nil && params.Parameter44Value != nil { - data.Set("Parameter44.Value", *params.Parameter44Value) - } - if params != nil && params.Parameter45Name != nil { - data.Set("Parameter45.Name", *params.Parameter45Name) - } - if params != nil && params.Parameter45Value != nil { - data.Set("Parameter45.Value", *params.Parameter45Value) - } - if params != nil && params.Parameter46Name != nil { - data.Set("Parameter46.Name", *params.Parameter46Name) - } - if params != nil && params.Parameter46Value != nil { - data.Set("Parameter46.Value", *params.Parameter46Value) - } - if params != nil && params.Parameter47Name != nil { - data.Set("Parameter47.Name", *params.Parameter47Name) - } - if params != nil && params.Parameter47Value != nil { - data.Set("Parameter47.Value", *params.Parameter47Value) - } - if params != nil && params.Parameter48Name != nil { - data.Set("Parameter48.Name", *params.Parameter48Name) - } - if params != nil && params.Parameter48Value != nil { - data.Set("Parameter48.Value", *params.Parameter48Value) - } - if params != nil && params.Parameter49Name != nil { - data.Set("Parameter49.Name", *params.Parameter49Name) - } - if params != nil && params.Parameter49Value != nil { - data.Set("Parameter49.Value", *params.Parameter49Value) - } - if params != nil && params.Parameter50Name != nil { - data.Set("Parameter50.Name", *params.Parameter50Name) - } - if params != nil && params.Parameter50Value != nil { - data.Set("Parameter50.Value", *params.Parameter50Value) - } - if params != nil && params.Parameter51Name != nil { - data.Set("Parameter51.Name", *params.Parameter51Name) - } - if params != nil && params.Parameter51Value != nil { - data.Set("Parameter51.Value", *params.Parameter51Value) - } - if params != nil && params.Parameter52Name != nil { - data.Set("Parameter52.Name", *params.Parameter52Name) - } - if params != nil && params.Parameter52Value != nil { - data.Set("Parameter52.Value", *params.Parameter52Value) - } - if params != nil && params.Parameter53Name != nil { - data.Set("Parameter53.Name", *params.Parameter53Name) - } - if params != nil && params.Parameter53Value != nil { - data.Set("Parameter53.Value", *params.Parameter53Value) - } - if params != nil && params.Parameter54Name != nil { - data.Set("Parameter54.Name", *params.Parameter54Name) - } - if params != nil && params.Parameter54Value != nil { - data.Set("Parameter54.Value", *params.Parameter54Value) - } - if params != nil && params.Parameter55Name != nil { - data.Set("Parameter55.Name", *params.Parameter55Name) - } - if params != nil && params.Parameter55Value != nil { - data.Set("Parameter55.Value", *params.Parameter55Value) - } - if params != nil && params.Parameter56Name != nil { - data.Set("Parameter56.Name", *params.Parameter56Name) - } - if params != nil && params.Parameter56Value != nil { - data.Set("Parameter56.Value", *params.Parameter56Value) - } - if params != nil && params.Parameter57Name != nil { - data.Set("Parameter57.Name", *params.Parameter57Name) - } - if params != nil && params.Parameter57Value != nil { - data.Set("Parameter57.Value", *params.Parameter57Value) - } - if params != nil && params.Parameter58Name != nil { - data.Set("Parameter58.Name", *params.Parameter58Name) - } - if params != nil && params.Parameter58Value != nil { - data.Set("Parameter58.Value", *params.Parameter58Value) - } - if params != nil && params.Parameter59Name != nil { - data.Set("Parameter59.Name", *params.Parameter59Name) - } - if params != nil && params.Parameter59Value != nil { - data.Set("Parameter59.Value", *params.Parameter59Value) - } - if params != nil && params.Parameter60Name != nil { - data.Set("Parameter60.Name", *params.Parameter60Name) - } - if params != nil && params.Parameter60Value != nil { - data.Set("Parameter60.Value", *params.Parameter60Value) - } - if params != nil && params.Parameter61Name != nil { - data.Set("Parameter61.Name", *params.Parameter61Name) - } - if params != nil && params.Parameter61Value != nil { - data.Set("Parameter61.Value", *params.Parameter61Value) - } - if params != nil && params.Parameter62Name != nil { - data.Set("Parameter62.Name", *params.Parameter62Name) - } - if params != nil && params.Parameter62Value != nil { - data.Set("Parameter62.Value", *params.Parameter62Value) - } - if params != nil && params.Parameter63Name != nil { - data.Set("Parameter63.Name", *params.Parameter63Name) - } - if params != nil && params.Parameter63Value != nil { - data.Set("Parameter63.Value", *params.Parameter63Value) - } - if params != nil && params.Parameter64Name != nil { - data.Set("Parameter64.Name", *params.Parameter64Name) - } - if params != nil && params.Parameter64Value != nil { - data.Set("Parameter64.Value", *params.Parameter64Value) - } - if params != nil && params.Parameter65Name != nil { - data.Set("Parameter65.Name", *params.Parameter65Name) - } - if params != nil && params.Parameter65Value != nil { - data.Set("Parameter65.Value", *params.Parameter65Value) - } - if params != nil && params.Parameter66Name != nil { - data.Set("Parameter66.Name", *params.Parameter66Name) - } - if params != nil && params.Parameter66Value != nil { - data.Set("Parameter66.Value", *params.Parameter66Value) - } - if params != nil && params.Parameter67Name != nil { - data.Set("Parameter67.Name", *params.Parameter67Name) - } - if params != nil && params.Parameter67Value != nil { - data.Set("Parameter67.Value", *params.Parameter67Value) - } - if params != nil && params.Parameter68Name != nil { - data.Set("Parameter68.Name", *params.Parameter68Name) - } - if params != nil && params.Parameter68Value != nil { - data.Set("Parameter68.Value", *params.Parameter68Value) - } - if params != nil && params.Parameter69Name != nil { - data.Set("Parameter69.Name", *params.Parameter69Name) - } - if params != nil && params.Parameter69Value != nil { - data.Set("Parameter69.Value", *params.Parameter69Value) - } - if params != nil && params.Parameter70Name != nil { - data.Set("Parameter70.Name", *params.Parameter70Name) - } - if params != nil && params.Parameter70Value != nil { - data.Set("Parameter70.Value", *params.Parameter70Value) - } - if params != nil && params.Parameter71Name != nil { - data.Set("Parameter71.Name", *params.Parameter71Name) - } - if params != nil && params.Parameter71Value != nil { - data.Set("Parameter71.Value", *params.Parameter71Value) - } - if params != nil && params.Parameter72Name != nil { - data.Set("Parameter72.Name", *params.Parameter72Name) - } - if params != nil && params.Parameter72Value != nil { - data.Set("Parameter72.Value", *params.Parameter72Value) - } - if params != nil && params.Parameter73Name != nil { - data.Set("Parameter73.Name", *params.Parameter73Name) - } - if params != nil && params.Parameter73Value != nil { - data.Set("Parameter73.Value", *params.Parameter73Value) - } - if params != nil && params.Parameter74Name != nil { - data.Set("Parameter74.Name", *params.Parameter74Name) - } - if params != nil && params.Parameter74Value != nil { - data.Set("Parameter74.Value", *params.Parameter74Value) - } - if params != nil && params.Parameter75Name != nil { - data.Set("Parameter75.Name", *params.Parameter75Name) - } - if params != nil && params.Parameter75Value != nil { - data.Set("Parameter75.Value", *params.Parameter75Value) - } - if params != nil && params.Parameter76Name != nil { - data.Set("Parameter76.Name", *params.Parameter76Name) - } - if params != nil && params.Parameter76Value != nil { - data.Set("Parameter76.Value", *params.Parameter76Value) - } - if params != nil && params.Parameter77Name != nil { - data.Set("Parameter77.Name", *params.Parameter77Name) - } - if params != nil && params.Parameter77Value != nil { - data.Set("Parameter77.Value", *params.Parameter77Value) - } - if params != nil && params.Parameter78Name != nil { - data.Set("Parameter78.Name", *params.Parameter78Name) - } - if params != nil && params.Parameter78Value != nil { - data.Set("Parameter78.Value", *params.Parameter78Value) - } - if params != nil && params.Parameter79Name != nil { - data.Set("Parameter79.Name", *params.Parameter79Name) - } - if params != nil && params.Parameter79Value != nil { - data.Set("Parameter79.Value", *params.Parameter79Value) - } - if params != nil && params.Parameter80Name != nil { - data.Set("Parameter80.Name", *params.Parameter80Name) - } - if params != nil && params.Parameter80Value != nil { - data.Set("Parameter80.Value", *params.Parameter80Value) - } - if params != nil && params.Parameter81Name != nil { - data.Set("Parameter81.Name", *params.Parameter81Name) - } - if params != nil && params.Parameter81Value != nil { - data.Set("Parameter81.Value", *params.Parameter81Value) - } - if params != nil && params.Parameter82Name != nil { - data.Set("Parameter82.Name", *params.Parameter82Name) - } - if params != nil && params.Parameter82Value != nil { - data.Set("Parameter82.Value", *params.Parameter82Value) - } - if params != nil && params.Parameter83Name != nil { - data.Set("Parameter83.Name", *params.Parameter83Name) - } - if params != nil && params.Parameter83Value != nil { - data.Set("Parameter83.Value", *params.Parameter83Value) - } - if params != nil && params.Parameter84Name != nil { - data.Set("Parameter84.Name", *params.Parameter84Name) - } - if params != nil && params.Parameter84Value != nil { - data.Set("Parameter84.Value", *params.Parameter84Value) - } - if params != nil && params.Parameter85Name != nil { - data.Set("Parameter85.Name", *params.Parameter85Name) - } - if params != nil && params.Parameter85Value != nil { - data.Set("Parameter85.Value", *params.Parameter85Value) - } - if params != nil && params.Parameter86Name != nil { - data.Set("Parameter86.Name", *params.Parameter86Name) - } - if params != nil && params.Parameter86Value != nil { - data.Set("Parameter86.Value", *params.Parameter86Value) - } - if params != nil && params.Parameter87Name != nil { - data.Set("Parameter87.Name", *params.Parameter87Name) - } - if params != nil && params.Parameter87Value != nil { - data.Set("Parameter87.Value", *params.Parameter87Value) - } - if params != nil && params.Parameter88Name != nil { - data.Set("Parameter88.Name", *params.Parameter88Name) - } - if params != nil && params.Parameter88Value != nil { - data.Set("Parameter88.Value", *params.Parameter88Value) - } - if params != nil && params.Parameter89Name != nil { - data.Set("Parameter89.Name", *params.Parameter89Name) - } - if params != nil && params.Parameter89Value != nil { - data.Set("Parameter89.Value", *params.Parameter89Value) - } - if params != nil && params.Parameter90Name != nil { - data.Set("Parameter90.Name", *params.Parameter90Name) - } - if params != nil && params.Parameter90Value != nil { - data.Set("Parameter90.Value", *params.Parameter90Value) - } - if params != nil && params.Parameter91Name != nil { - data.Set("Parameter91.Name", *params.Parameter91Name) - } - if params != nil && params.Parameter91Value != nil { - data.Set("Parameter91.Value", *params.Parameter91Value) - } - if params != nil && params.Parameter92Name != nil { - data.Set("Parameter92.Name", *params.Parameter92Name) - } - if params != nil && params.Parameter92Value != nil { - data.Set("Parameter92.Value", *params.Parameter92Value) - } - if params != nil && params.Parameter93Name != nil { - data.Set("Parameter93.Name", *params.Parameter93Name) - } - if params != nil && params.Parameter93Value != nil { - data.Set("Parameter93.Value", *params.Parameter93Value) - } - if params != nil && params.Parameter94Name != nil { - data.Set("Parameter94.Name", *params.Parameter94Name) - } - if params != nil && params.Parameter94Value != nil { - data.Set("Parameter94.Value", *params.Parameter94Value) - } - if params != nil && params.Parameter95Name != nil { - data.Set("Parameter95.Name", *params.Parameter95Name) - } - if params != nil && params.Parameter95Value != nil { - data.Set("Parameter95.Value", *params.Parameter95Value) - } - if params != nil && params.Parameter96Name != nil { - data.Set("Parameter96.Name", *params.Parameter96Name) - } - if params != nil && params.Parameter96Value != nil { - data.Set("Parameter96.Value", *params.Parameter96Value) - } - if params != nil && params.Parameter97Name != nil { - data.Set("Parameter97.Name", *params.Parameter97Name) - } - if params != nil && params.Parameter97Value != nil { - data.Set("Parameter97.Value", *params.Parameter97Value) - } - if params != nil && params.Parameter98Name != nil { - data.Set("Parameter98.Name", *params.Parameter98Name) - } - if params != nil && params.Parameter98Value != nil { - data.Set("Parameter98.Value", *params.Parameter98Value) - } - if params != nil && params.Parameter99Name != nil { - data.Set("Parameter99.Name", *params.Parameter99Name) - } - if params != nil && params.Parameter99Value != nil { - data.Set("Parameter99.Value", *params.Parameter99Value) - } + if params != nil && params.Url != nil { + data.Set("Url", *params.Url) + } + if params != nil && params.Name != nil { + data.Set("Name", *params.Name) + } + if params != nil && params.Track != nil { + data.Set("Track", *params.Track) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.Parameter1Name != nil { + data.Set("Parameter1.Name", *params.Parameter1Name) + } + if params != nil && params.Parameter1Value != nil { + data.Set("Parameter1.Value", *params.Parameter1Value) + } + if params != nil && params.Parameter2Name != nil { + data.Set("Parameter2.Name", *params.Parameter2Name) + } + if params != nil && params.Parameter2Value != nil { + data.Set("Parameter2.Value", *params.Parameter2Value) + } + if params != nil && params.Parameter3Name != nil { + data.Set("Parameter3.Name", *params.Parameter3Name) + } + if params != nil && params.Parameter3Value != nil { + data.Set("Parameter3.Value", *params.Parameter3Value) + } + if params != nil && params.Parameter4Name != nil { + data.Set("Parameter4.Name", *params.Parameter4Name) + } + if params != nil && params.Parameter4Value != nil { + data.Set("Parameter4.Value", *params.Parameter4Value) + } + if params != nil && params.Parameter5Name != nil { + data.Set("Parameter5.Name", *params.Parameter5Name) + } + if params != nil && params.Parameter5Value != nil { + data.Set("Parameter5.Value", *params.Parameter5Value) + } + if params != nil && params.Parameter6Name != nil { + data.Set("Parameter6.Name", *params.Parameter6Name) + } + if params != nil && params.Parameter6Value != nil { + data.Set("Parameter6.Value", *params.Parameter6Value) + } + if params != nil && params.Parameter7Name != nil { + data.Set("Parameter7.Name", *params.Parameter7Name) + } + if params != nil && params.Parameter7Value != nil { + data.Set("Parameter7.Value", *params.Parameter7Value) + } + if params != nil && params.Parameter8Name != nil { + data.Set("Parameter8.Name", *params.Parameter8Name) + } + if params != nil && params.Parameter8Value != nil { + data.Set("Parameter8.Value", *params.Parameter8Value) + } + if params != nil && params.Parameter9Name != nil { + data.Set("Parameter9.Name", *params.Parameter9Name) + } + if params != nil && params.Parameter9Value != nil { + data.Set("Parameter9.Value", *params.Parameter9Value) + } + if params != nil && params.Parameter10Name != nil { + data.Set("Parameter10.Name", *params.Parameter10Name) + } + if params != nil && params.Parameter10Value != nil { + data.Set("Parameter10.Value", *params.Parameter10Value) + } + if params != nil && params.Parameter11Name != nil { + data.Set("Parameter11.Name", *params.Parameter11Name) + } + if params != nil && params.Parameter11Value != nil { + data.Set("Parameter11.Value", *params.Parameter11Value) + } + if params != nil && params.Parameter12Name != nil { + data.Set("Parameter12.Name", *params.Parameter12Name) + } + if params != nil && params.Parameter12Value != nil { + data.Set("Parameter12.Value", *params.Parameter12Value) + } + if params != nil && params.Parameter13Name != nil { + data.Set("Parameter13.Name", *params.Parameter13Name) + } + if params != nil && params.Parameter13Value != nil { + data.Set("Parameter13.Value", *params.Parameter13Value) + } + if params != nil && params.Parameter14Name != nil { + data.Set("Parameter14.Name", *params.Parameter14Name) + } + if params != nil && params.Parameter14Value != nil { + data.Set("Parameter14.Value", *params.Parameter14Value) + } + if params != nil && params.Parameter15Name != nil { + data.Set("Parameter15.Name", *params.Parameter15Name) + } + if params != nil && params.Parameter15Value != nil { + data.Set("Parameter15.Value", *params.Parameter15Value) + } + if params != nil && params.Parameter16Name != nil { + data.Set("Parameter16.Name", *params.Parameter16Name) + } + if params != nil && params.Parameter16Value != nil { + data.Set("Parameter16.Value", *params.Parameter16Value) + } + if params != nil && params.Parameter17Name != nil { + data.Set("Parameter17.Name", *params.Parameter17Name) + } + if params != nil && params.Parameter17Value != nil { + data.Set("Parameter17.Value", *params.Parameter17Value) + } + if params != nil && params.Parameter18Name != nil { + data.Set("Parameter18.Name", *params.Parameter18Name) + } + if params != nil && params.Parameter18Value != nil { + data.Set("Parameter18.Value", *params.Parameter18Value) + } + if params != nil && params.Parameter19Name != nil { + data.Set("Parameter19.Name", *params.Parameter19Name) + } + if params != nil && params.Parameter19Value != nil { + data.Set("Parameter19.Value", *params.Parameter19Value) + } + if params != nil && params.Parameter20Name != nil { + data.Set("Parameter20.Name", *params.Parameter20Name) + } + if params != nil && params.Parameter20Value != nil { + data.Set("Parameter20.Value", *params.Parameter20Value) + } + if params != nil && params.Parameter21Name != nil { + data.Set("Parameter21.Name", *params.Parameter21Name) + } + if params != nil && params.Parameter21Value != nil { + data.Set("Parameter21.Value", *params.Parameter21Value) + } + if params != nil && params.Parameter22Name != nil { + data.Set("Parameter22.Name", *params.Parameter22Name) + } + if params != nil && params.Parameter22Value != nil { + data.Set("Parameter22.Value", *params.Parameter22Value) + } + if params != nil && params.Parameter23Name != nil { + data.Set("Parameter23.Name", *params.Parameter23Name) + } + if params != nil && params.Parameter23Value != nil { + data.Set("Parameter23.Value", *params.Parameter23Value) + } + if params != nil && params.Parameter24Name != nil { + data.Set("Parameter24.Name", *params.Parameter24Name) + } + if params != nil && params.Parameter24Value != nil { + data.Set("Parameter24.Value", *params.Parameter24Value) + } + if params != nil && params.Parameter25Name != nil { + data.Set("Parameter25.Name", *params.Parameter25Name) + } + if params != nil && params.Parameter25Value != nil { + data.Set("Parameter25.Value", *params.Parameter25Value) + } + if params != nil && params.Parameter26Name != nil { + data.Set("Parameter26.Name", *params.Parameter26Name) + } + if params != nil && params.Parameter26Value != nil { + data.Set("Parameter26.Value", *params.Parameter26Value) + } + if params != nil && params.Parameter27Name != nil { + data.Set("Parameter27.Name", *params.Parameter27Name) + } + if params != nil && params.Parameter27Value != nil { + data.Set("Parameter27.Value", *params.Parameter27Value) + } + if params != nil && params.Parameter28Name != nil { + data.Set("Parameter28.Name", *params.Parameter28Name) + } + if params != nil && params.Parameter28Value != nil { + data.Set("Parameter28.Value", *params.Parameter28Value) + } + if params != nil && params.Parameter29Name != nil { + data.Set("Parameter29.Name", *params.Parameter29Name) + } + if params != nil && params.Parameter29Value != nil { + data.Set("Parameter29.Value", *params.Parameter29Value) + } + if params != nil && params.Parameter30Name != nil { + data.Set("Parameter30.Name", *params.Parameter30Name) + } + if params != nil && params.Parameter30Value != nil { + data.Set("Parameter30.Value", *params.Parameter30Value) + } + if params != nil && params.Parameter31Name != nil { + data.Set("Parameter31.Name", *params.Parameter31Name) + } + if params != nil && params.Parameter31Value != nil { + data.Set("Parameter31.Value", *params.Parameter31Value) + } + if params != nil && params.Parameter32Name != nil { + data.Set("Parameter32.Name", *params.Parameter32Name) + } + if params != nil && params.Parameter32Value != nil { + data.Set("Parameter32.Value", *params.Parameter32Value) + } + if params != nil && params.Parameter33Name != nil { + data.Set("Parameter33.Name", *params.Parameter33Name) + } + if params != nil && params.Parameter33Value != nil { + data.Set("Parameter33.Value", *params.Parameter33Value) + } + if params != nil && params.Parameter34Name != nil { + data.Set("Parameter34.Name", *params.Parameter34Name) + } + if params != nil && params.Parameter34Value != nil { + data.Set("Parameter34.Value", *params.Parameter34Value) + } + if params != nil && params.Parameter35Name != nil { + data.Set("Parameter35.Name", *params.Parameter35Name) + } + if params != nil && params.Parameter35Value != nil { + data.Set("Parameter35.Value", *params.Parameter35Value) + } + if params != nil && params.Parameter36Name != nil { + data.Set("Parameter36.Name", *params.Parameter36Name) + } + if params != nil && params.Parameter36Value != nil { + data.Set("Parameter36.Value", *params.Parameter36Value) + } + if params != nil && params.Parameter37Name != nil { + data.Set("Parameter37.Name", *params.Parameter37Name) + } + if params != nil && params.Parameter37Value != nil { + data.Set("Parameter37.Value", *params.Parameter37Value) + } + if params != nil && params.Parameter38Name != nil { + data.Set("Parameter38.Name", *params.Parameter38Name) + } + if params != nil && params.Parameter38Value != nil { + data.Set("Parameter38.Value", *params.Parameter38Value) + } + if params != nil && params.Parameter39Name != nil { + data.Set("Parameter39.Name", *params.Parameter39Name) + } + if params != nil && params.Parameter39Value != nil { + data.Set("Parameter39.Value", *params.Parameter39Value) + } + if params != nil && params.Parameter40Name != nil { + data.Set("Parameter40.Name", *params.Parameter40Name) + } + if params != nil && params.Parameter40Value != nil { + data.Set("Parameter40.Value", *params.Parameter40Value) + } + if params != nil && params.Parameter41Name != nil { + data.Set("Parameter41.Name", *params.Parameter41Name) + } + if params != nil && params.Parameter41Value != nil { + data.Set("Parameter41.Value", *params.Parameter41Value) + } + if params != nil && params.Parameter42Name != nil { + data.Set("Parameter42.Name", *params.Parameter42Name) + } + if params != nil && params.Parameter42Value != nil { + data.Set("Parameter42.Value", *params.Parameter42Value) + } + if params != nil && params.Parameter43Name != nil { + data.Set("Parameter43.Name", *params.Parameter43Name) + } + if params != nil && params.Parameter43Value != nil { + data.Set("Parameter43.Value", *params.Parameter43Value) + } + if params != nil && params.Parameter44Name != nil { + data.Set("Parameter44.Name", *params.Parameter44Name) + } + if params != nil && params.Parameter44Value != nil { + data.Set("Parameter44.Value", *params.Parameter44Value) + } + if params != nil && params.Parameter45Name != nil { + data.Set("Parameter45.Name", *params.Parameter45Name) + } + if params != nil && params.Parameter45Value != nil { + data.Set("Parameter45.Value", *params.Parameter45Value) + } + if params != nil && params.Parameter46Name != nil { + data.Set("Parameter46.Name", *params.Parameter46Name) + } + if params != nil && params.Parameter46Value != nil { + data.Set("Parameter46.Value", *params.Parameter46Value) + } + if params != nil && params.Parameter47Name != nil { + data.Set("Parameter47.Name", *params.Parameter47Name) + } + if params != nil && params.Parameter47Value != nil { + data.Set("Parameter47.Value", *params.Parameter47Value) + } + if params != nil && params.Parameter48Name != nil { + data.Set("Parameter48.Name", *params.Parameter48Name) + } + if params != nil && params.Parameter48Value != nil { + data.Set("Parameter48.Value", *params.Parameter48Value) + } + if params != nil && params.Parameter49Name != nil { + data.Set("Parameter49.Name", *params.Parameter49Name) + } + if params != nil && params.Parameter49Value != nil { + data.Set("Parameter49.Value", *params.Parameter49Value) + } + if params != nil && params.Parameter50Name != nil { + data.Set("Parameter50.Name", *params.Parameter50Name) + } + if params != nil && params.Parameter50Value != nil { + data.Set("Parameter50.Value", *params.Parameter50Value) + } + if params != nil && params.Parameter51Name != nil { + data.Set("Parameter51.Name", *params.Parameter51Name) + } + if params != nil && params.Parameter51Value != nil { + data.Set("Parameter51.Value", *params.Parameter51Value) + } + if params != nil && params.Parameter52Name != nil { + data.Set("Parameter52.Name", *params.Parameter52Name) + } + if params != nil && params.Parameter52Value != nil { + data.Set("Parameter52.Value", *params.Parameter52Value) + } + if params != nil && params.Parameter53Name != nil { + data.Set("Parameter53.Name", *params.Parameter53Name) + } + if params != nil && params.Parameter53Value != nil { + data.Set("Parameter53.Value", *params.Parameter53Value) + } + if params != nil && params.Parameter54Name != nil { + data.Set("Parameter54.Name", *params.Parameter54Name) + } + if params != nil && params.Parameter54Value != nil { + data.Set("Parameter54.Value", *params.Parameter54Value) + } + if params != nil && params.Parameter55Name != nil { + data.Set("Parameter55.Name", *params.Parameter55Name) + } + if params != nil && params.Parameter55Value != nil { + data.Set("Parameter55.Value", *params.Parameter55Value) + } + if params != nil && params.Parameter56Name != nil { + data.Set("Parameter56.Name", *params.Parameter56Name) + } + if params != nil && params.Parameter56Value != nil { + data.Set("Parameter56.Value", *params.Parameter56Value) + } + if params != nil && params.Parameter57Name != nil { + data.Set("Parameter57.Name", *params.Parameter57Name) + } + if params != nil && params.Parameter57Value != nil { + data.Set("Parameter57.Value", *params.Parameter57Value) + } + if params != nil && params.Parameter58Name != nil { + data.Set("Parameter58.Name", *params.Parameter58Name) + } + if params != nil && params.Parameter58Value != nil { + data.Set("Parameter58.Value", *params.Parameter58Value) + } + if params != nil && params.Parameter59Name != nil { + data.Set("Parameter59.Name", *params.Parameter59Name) + } + if params != nil && params.Parameter59Value != nil { + data.Set("Parameter59.Value", *params.Parameter59Value) + } + if params != nil && params.Parameter60Name != nil { + data.Set("Parameter60.Name", *params.Parameter60Name) + } + if params != nil && params.Parameter60Value != nil { + data.Set("Parameter60.Value", *params.Parameter60Value) + } + if params != nil && params.Parameter61Name != nil { + data.Set("Parameter61.Name", *params.Parameter61Name) + } + if params != nil && params.Parameter61Value != nil { + data.Set("Parameter61.Value", *params.Parameter61Value) + } + if params != nil && params.Parameter62Name != nil { + data.Set("Parameter62.Name", *params.Parameter62Name) + } + if params != nil && params.Parameter62Value != nil { + data.Set("Parameter62.Value", *params.Parameter62Value) + } + if params != nil && params.Parameter63Name != nil { + data.Set("Parameter63.Name", *params.Parameter63Name) + } + if params != nil && params.Parameter63Value != nil { + data.Set("Parameter63.Value", *params.Parameter63Value) + } + if params != nil && params.Parameter64Name != nil { + data.Set("Parameter64.Name", *params.Parameter64Name) + } + if params != nil && params.Parameter64Value != nil { + data.Set("Parameter64.Value", *params.Parameter64Value) + } + if params != nil && params.Parameter65Name != nil { + data.Set("Parameter65.Name", *params.Parameter65Name) + } + if params != nil && params.Parameter65Value != nil { + data.Set("Parameter65.Value", *params.Parameter65Value) + } + if params != nil && params.Parameter66Name != nil { + data.Set("Parameter66.Name", *params.Parameter66Name) + } + if params != nil && params.Parameter66Value != nil { + data.Set("Parameter66.Value", *params.Parameter66Value) + } + if params != nil && params.Parameter67Name != nil { + data.Set("Parameter67.Name", *params.Parameter67Name) + } + if params != nil && params.Parameter67Value != nil { + data.Set("Parameter67.Value", *params.Parameter67Value) + } + if params != nil && params.Parameter68Name != nil { + data.Set("Parameter68.Name", *params.Parameter68Name) + } + if params != nil && params.Parameter68Value != nil { + data.Set("Parameter68.Value", *params.Parameter68Value) + } + if params != nil && params.Parameter69Name != nil { + data.Set("Parameter69.Name", *params.Parameter69Name) + } + if params != nil && params.Parameter69Value != nil { + data.Set("Parameter69.Value", *params.Parameter69Value) + } + if params != nil && params.Parameter70Name != nil { + data.Set("Parameter70.Name", *params.Parameter70Name) + } + if params != nil && params.Parameter70Value != nil { + data.Set("Parameter70.Value", *params.Parameter70Value) + } + if params != nil && params.Parameter71Name != nil { + data.Set("Parameter71.Name", *params.Parameter71Name) + } + if params != nil && params.Parameter71Value != nil { + data.Set("Parameter71.Value", *params.Parameter71Value) + } + if params != nil && params.Parameter72Name != nil { + data.Set("Parameter72.Name", *params.Parameter72Name) + } + if params != nil && params.Parameter72Value != nil { + data.Set("Parameter72.Value", *params.Parameter72Value) + } + if params != nil && params.Parameter73Name != nil { + data.Set("Parameter73.Name", *params.Parameter73Name) + } + if params != nil && params.Parameter73Value != nil { + data.Set("Parameter73.Value", *params.Parameter73Value) + } + if params != nil && params.Parameter74Name != nil { + data.Set("Parameter74.Name", *params.Parameter74Name) + } + if params != nil && params.Parameter74Value != nil { + data.Set("Parameter74.Value", *params.Parameter74Value) + } + if params != nil && params.Parameter75Name != nil { + data.Set("Parameter75.Name", *params.Parameter75Name) + } + if params != nil && params.Parameter75Value != nil { + data.Set("Parameter75.Value", *params.Parameter75Value) + } + if params != nil && params.Parameter76Name != nil { + data.Set("Parameter76.Name", *params.Parameter76Name) + } + if params != nil && params.Parameter76Value != nil { + data.Set("Parameter76.Value", *params.Parameter76Value) + } + if params != nil && params.Parameter77Name != nil { + data.Set("Parameter77.Name", *params.Parameter77Name) + } + if params != nil && params.Parameter77Value != nil { + data.Set("Parameter77.Value", *params.Parameter77Value) + } + if params != nil && params.Parameter78Name != nil { + data.Set("Parameter78.Name", *params.Parameter78Name) + } + if params != nil && params.Parameter78Value != nil { + data.Set("Parameter78.Value", *params.Parameter78Value) + } + if params != nil && params.Parameter79Name != nil { + data.Set("Parameter79.Name", *params.Parameter79Name) + } + if params != nil && params.Parameter79Value != nil { + data.Set("Parameter79.Value", *params.Parameter79Value) + } + if params != nil && params.Parameter80Name != nil { + data.Set("Parameter80.Name", *params.Parameter80Name) + } + if params != nil && params.Parameter80Value != nil { + data.Set("Parameter80.Value", *params.Parameter80Value) + } + if params != nil && params.Parameter81Name != nil { + data.Set("Parameter81.Name", *params.Parameter81Name) + } + if params != nil && params.Parameter81Value != nil { + data.Set("Parameter81.Value", *params.Parameter81Value) + } + if params != nil && params.Parameter82Name != nil { + data.Set("Parameter82.Name", *params.Parameter82Name) + } + if params != nil && params.Parameter82Value != nil { + data.Set("Parameter82.Value", *params.Parameter82Value) + } + if params != nil && params.Parameter83Name != nil { + data.Set("Parameter83.Name", *params.Parameter83Name) + } + if params != nil && params.Parameter83Value != nil { + data.Set("Parameter83.Value", *params.Parameter83Value) + } + if params != nil && params.Parameter84Name != nil { + data.Set("Parameter84.Name", *params.Parameter84Name) + } + if params != nil && params.Parameter84Value != nil { + data.Set("Parameter84.Value", *params.Parameter84Value) + } + if params != nil && params.Parameter85Name != nil { + data.Set("Parameter85.Name", *params.Parameter85Name) + } + if params != nil && params.Parameter85Value != nil { + data.Set("Parameter85.Value", *params.Parameter85Value) + } + if params != nil && params.Parameter86Name != nil { + data.Set("Parameter86.Name", *params.Parameter86Name) + } + if params != nil && params.Parameter86Value != nil { + data.Set("Parameter86.Value", *params.Parameter86Value) + } + if params != nil && params.Parameter87Name != nil { + data.Set("Parameter87.Name", *params.Parameter87Name) + } + if params != nil && params.Parameter87Value != nil { + data.Set("Parameter87.Value", *params.Parameter87Value) + } + if params != nil && params.Parameter88Name != nil { + data.Set("Parameter88.Name", *params.Parameter88Name) + } + if params != nil && params.Parameter88Value != nil { + data.Set("Parameter88.Value", *params.Parameter88Value) + } + if params != nil && params.Parameter89Name != nil { + data.Set("Parameter89.Name", *params.Parameter89Name) + } + if params != nil && params.Parameter89Value != nil { + data.Set("Parameter89.Value", *params.Parameter89Value) + } + if params != nil && params.Parameter90Name != nil { + data.Set("Parameter90.Name", *params.Parameter90Name) + } + if params != nil && params.Parameter90Value != nil { + data.Set("Parameter90.Value", *params.Parameter90Value) + } + if params != nil && params.Parameter91Name != nil { + data.Set("Parameter91.Name", *params.Parameter91Name) + } + if params != nil && params.Parameter91Value != nil { + data.Set("Parameter91.Value", *params.Parameter91Value) + } + if params != nil && params.Parameter92Name != nil { + data.Set("Parameter92.Name", *params.Parameter92Name) + } + if params != nil && params.Parameter92Value != nil { + data.Set("Parameter92.Value", *params.Parameter92Value) + } + if params != nil && params.Parameter93Name != nil { + data.Set("Parameter93.Name", *params.Parameter93Name) + } + if params != nil && params.Parameter93Value != nil { + data.Set("Parameter93.Value", *params.Parameter93Value) + } + if params != nil && params.Parameter94Name != nil { + data.Set("Parameter94.Name", *params.Parameter94Name) + } + if params != nil && params.Parameter94Value != nil { + data.Set("Parameter94.Value", *params.Parameter94Value) + } + if params != nil && params.Parameter95Name != nil { + data.Set("Parameter95.Name", *params.Parameter95Name) + } + if params != nil && params.Parameter95Value != nil { + data.Set("Parameter95.Value", *params.Parameter95Value) + } + if params != nil && params.Parameter96Name != nil { + data.Set("Parameter96.Name", *params.Parameter96Name) + } + if params != nil && params.Parameter96Value != nil { + data.Set("Parameter96.Value", *params.Parameter96Value) + } + if params != nil && params.Parameter97Name != nil { + data.Set("Parameter97.Name", *params.Parameter97Name) + } + if params != nil && params.Parameter97Value != nil { + data.Set("Parameter97.Value", *params.Parameter97Value) + } + if params != nil && params.Parameter98Name != nil { + data.Set("Parameter98.Name", *params.Parameter98Name) + } + if params != nil && params.Parameter98Value != nil { + data.Set("Parameter98.Value", *params.Parameter98Value) + } + if params != nil && params.Parameter99Name != nil { + data.Set("Parameter99.Name", *params.Parameter99Name) + } + if params != nil && params.Parameter99Value != nil { + data.Set("Parameter99.Value", *params.Parameter99Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Stream{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Stream{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateStream' type UpdateStreamParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - Status *string `json:"Status,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateStreamParams) SetPathAccountSid(PathAccountSid string) *UpdateStreamParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateStreamParams) SetPathAccountSid(PathAccountSid string) (*UpdateStreamParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateStreamParams) SetStatus(Status string) *UpdateStreamParams { - params.Status = &Status - return params +func (params *UpdateStreamParams) SetStatus(Status string) (*UpdateStreamParams){ + params.Status = &Status + return params } // Stop a Stream using either the SID of the Stream resource or the `name` used when creating the resource func (c *ApiService) UpdateStream(CallSid string, Sid string, params *UpdateStreamParams) (*ApiV2010Stream, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Streams/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/Streams/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010Stream{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010Stream{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_calls_user_defined_message_subscriptions.go b/rest/api/v2010/accounts_calls_user_defined_message_subscriptions.go index b31d910d4..aaf7bbaaa 100644 --- a/rest/api/v2010/accounts_calls_user_defined_message_subscriptions.go +++ b/rest/api/v2010/accounts_calls_user_defined_message_subscriptions.go @@ -16,108 +16,114 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUserDefinedMessageSubscription' type CreateUserDefinedMessageSubscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The URL we should call using the `method` to send user defined events to your application. URLs must contain a valid hostname (underscores are not permitted). - Callback *string `json:"Callback,omitempty"` - // A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. - IdempotencyKey *string `json:"IdempotencyKey,omitempty"` - // The HTTP method Twilio will use when requesting the above `Url`. Either `GET` or `POST`. Default is `POST`. - Method *string `json:"Method,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The URL we should call using the `method` to send user defined events to your application. URLs must contain a valid hostname (underscores are not permitted). + Callback *string `json:"Callback,omitempty"` + // A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. + IdempotencyKey *string `json:"IdempotencyKey,omitempty"` + // The HTTP method Twilio will use when requesting the above `Url`. Either `GET` or `POST`. Default is `POST`. + Method *string `json:"Method,omitempty"` } -func (params *CreateUserDefinedMessageSubscriptionParams) SetPathAccountSid(PathAccountSid string) *CreateUserDefinedMessageSubscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateUserDefinedMessageSubscriptionParams) SetPathAccountSid(PathAccountSid string) (*CreateUserDefinedMessageSubscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateUserDefinedMessageSubscriptionParams) SetCallback(Callback string) *CreateUserDefinedMessageSubscriptionParams { - params.Callback = &Callback - return params +func (params *CreateUserDefinedMessageSubscriptionParams) SetCallback(Callback string) (*CreateUserDefinedMessageSubscriptionParams){ + params.Callback = &Callback + return params } -func (params *CreateUserDefinedMessageSubscriptionParams) SetIdempotencyKey(IdempotencyKey string) *CreateUserDefinedMessageSubscriptionParams { - params.IdempotencyKey = &IdempotencyKey - return params +func (params *CreateUserDefinedMessageSubscriptionParams) SetIdempotencyKey(IdempotencyKey string) (*CreateUserDefinedMessageSubscriptionParams){ + params.IdempotencyKey = &IdempotencyKey + return params } -func (params *CreateUserDefinedMessageSubscriptionParams) SetMethod(Method string) *CreateUserDefinedMessageSubscriptionParams { - params.Method = &Method - return params +func (params *CreateUserDefinedMessageSubscriptionParams) SetMethod(Method string) (*CreateUserDefinedMessageSubscriptionParams){ + params.Method = &Method + return params } // Subscribe to User Defined Messages for a given Call SID. func (c *ApiService) CreateUserDefinedMessageSubscription(CallSid string, params *CreateUserDefinedMessageSubscriptionParams) (*ApiV2010UserDefinedMessageSubscription, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Callback != nil { - data.Set("Callback", *params.Callback) - } - if params != nil && params.IdempotencyKey != nil { - data.Set("IdempotencyKey", *params.IdempotencyKey) - } - if params != nil && params.Method != nil { - data.Set("Method", *params.Method) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010UserDefinedMessageSubscription{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Callback != nil { + data.Set("Callback", *params.Callback) + } + if params != nil && params.IdempotencyKey != nil { + data.Set("IdempotencyKey", *params.IdempotencyKey) + } + if params != nil && params.Method != nil { + data.Set("Method", *params.Method) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010UserDefinedMessageSubscription{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteUserDefinedMessageSubscription' type DeleteUserDefinedMessageSubscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteUserDefinedMessageSubscriptionParams) SetPathAccountSid(PathAccountSid string) *DeleteUserDefinedMessageSubscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteUserDefinedMessageSubscriptionParams) SetPathAccountSid(PathAccountSid string) (*DeleteUserDefinedMessageSubscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a specific User Defined Message Subscription. -func (c *ApiService) DeleteUserDefinedMessageSubscription(CallSid string, Sid string, params *DeleteUserDefinedMessageSubscriptionParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() - - return nil +func (c *ApiService) DeleteUserDefinedMessageSubscription(CallSid string, Sid string, params *DeleteUserDefinedMessageSubscriptionParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessageSubscriptions/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } diff --git a/rest/api/v2010/accounts_calls_user_defined_messages.go b/rest/api/v2010/accounts_calls_user_defined_messages.go index b17e6428e..fbdde429f 100644 --- a/rest/api/v2010/accounts_calls_user_defined_messages.go +++ b/rest/api/v2010/accounts_calls_user_defined_messages.go @@ -16,64 +16,68 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUserDefinedMessage' type CreateUserDefinedMessageParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The User Defined Message in the form of URL-encoded JSON string. - Content *string `json:"Content,omitempty"` - // A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. - IdempotencyKey *string `json:"IdempotencyKey,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The User Defined Message in the form of URL-encoded JSON string. + Content *string `json:"Content,omitempty"` + // A unique string value to identify API call. This should be a unique string value per API call and can be a randomly generated. + IdempotencyKey *string `json:"IdempotencyKey,omitempty"` } -func (params *CreateUserDefinedMessageParams) SetPathAccountSid(PathAccountSid string) *CreateUserDefinedMessageParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateUserDefinedMessageParams) SetPathAccountSid(PathAccountSid string) (*CreateUserDefinedMessageParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateUserDefinedMessageParams) SetContent(Content string) *CreateUserDefinedMessageParams { - params.Content = &Content - return params +func (params *CreateUserDefinedMessageParams) SetContent(Content string) (*CreateUserDefinedMessageParams){ + params.Content = &Content + return params } -func (params *CreateUserDefinedMessageParams) SetIdempotencyKey(IdempotencyKey string) *CreateUserDefinedMessageParams { - params.IdempotencyKey = &IdempotencyKey - return params +func (params *CreateUserDefinedMessageParams) SetIdempotencyKey(IdempotencyKey string) (*CreateUserDefinedMessageParams){ + params.IdempotencyKey = &IdempotencyKey + return params } // Create a new User Defined Message for the given Call SID. func (c *ApiService) CreateUserDefinedMessage(CallSid string, params *CreateUserDefinedMessageParams) (*ApiV2010UserDefinedMessage, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessages.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Calls/{CallSid}/UserDefinedMessages.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Content != nil { + data.Set("Content", *params.Content) + } + if params != nil && params.IdempotencyKey != nil { + data.Set("IdempotencyKey", *params.IdempotencyKey) + } - if params != nil && params.Content != nil { - data.Set("Content", *params.Content) - } - if params != nil && params.IdempotencyKey != nil { - data.Set("IdempotencyKey", *params.IdempotencyKey) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010UserDefinedMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010UserDefinedMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_conferences.go b/rest/api/v2010/accounts_conferences.go index 2897051e7..ee7471462 100644 --- a/rest/api/v2010/accounts_conferences.go +++ b/rest/api/v2010/accounts_conferences.go @@ -18,189 +18,155 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchConference' type FetchConferenceParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchConferenceParams) SetPathAccountSid(PathAccountSid string) *FetchConferenceParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchConferenceParams) SetPathAccountSid(PathAccountSid string) (*FetchConferenceParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a conference func (c *ApiService) FetchConference(Sid string, params *FetchConferenceParams) (*ApiV2010Conference, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Conference{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Conference{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConference' type ListConferenceParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - DateCreated *string `json:"DateCreated,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - DateCreatedBefore *string `json:"DateCreated<,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - DateCreatedAfter *string `json:"DateCreated>,omitempty"` - // The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - DateUpdated *string `json:"DateUpdated,omitempty"` - // The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - DateUpdatedBefore *string `json:"DateUpdated<,omitempty"` - // The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - DateUpdatedAfter *string `json:"DateUpdated>,omitempty"` - // The string that identifies the Conference resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. + DateCreated *string `json:"DateCreated,omitempty"` + // The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. + DateUpdated *string `json:"DateUpdated,omitempty"` + // The string that identifies the Conference resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConferenceParams) SetPathAccountSid(PathAccountSid string) *ListConferenceParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListConferenceParams) SetDateCreated(DateCreated string) *ListConferenceParams { - params.DateCreated = &DateCreated - return params +func (params *ListConferenceParams) SetPathAccountSid(PathAccountSid string) (*ListConferenceParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListConferenceParams) SetDateCreatedBefore(DateCreatedBefore string) *ListConferenceParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListConferenceParams) SetDateCreated(DateCreated string) (*ListConferenceParams){ + params.DateCreated = &DateCreated + return params } -func (params *ListConferenceParams) SetDateCreatedAfter(DateCreatedAfter string) *ListConferenceParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListConferenceParams) SetDateUpdated(DateUpdated string) (*ListConferenceParams){ + params.DateUpdated = &DateUpdated + return params } -func (params *ListConferenceParams) SetDateUpdated(DateUpdated string) *ListConferenceParams { - params.DateUpdated = &DateUpdated - return params +func (params *ListConferenceParams) SetFriendlyName(FriendlyName string) (*ListConferenceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListConferenceParams) SetDateUpdatedBefore(DateUpdatedBefore string) *ListConferenceParams { - params.DateUpdatedBefore = &DateUpdatedBefore - return params +func (params *ListConferenceParams) SetStatus(Status string) (*ListConferenceParams){ + params.Status = &Status + return params } -func (params *ListConferenceParams) SetDateUpdatedAfter(DateUpdatedAfter string) *ListConferenceParams { - params.DateUpdatedAfter = &DateUpdatedAfter - return params +func (params *ListConferenceParams) SetPageSize(PageSize int) (*ListConferenceParams){ + params.PageSize = &PageSize + return params } -func (params *ListConferenceParams) SetFriendlyName(FriendlyName string) *ListConferenceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListConferenceParams) SetStatus(Status string) *ListConferenceParams { - params.Status = &Status - return params -} -func (params *ListConferenceParams) SetPageSize(PageSize int) *ListConferenceParams { - params.PageSize = &PageSize - return params -} -func (params *ListConferenceParams) SetLimit(Limit int) *ListConferenceParams { - params.Limit = &Limit - return params +func (params *ListConferenceParams) SetLimit(Limit int) (*ListConferenceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Conference records from the API. Request is executed immediately. -func (c *ApiService) PageConference(params *ListConferenceParams, pageToken, pageNumber string) (*ListConferenceResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint(*params.DateCreated)) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreated<", fmt.Sprint(*params.DateCreatedBefore)) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreated>", fmt.Sprint(*params.DateCreatedAfter)) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint(*params.DateUpdated)) - } - if params != nil && params.DateUpdatedBefore != nil { - data.Set("DateUpdated<", fmt.Sprint(*params.DateUpdatedBefore)) - } - if params != nil && params.DateUpdatedAfter != nil { - data.Set("DateUpdated>", fmt.Sprint(*params.DateUpdatedAfter)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() +func (c *ApiService) PageConference(params *ListConferenceParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Conferences.json" - ps := &ListConferenceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint(*params.DateCreated)) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint(*params.DateUpdated)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Conference records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListConference(params *ListConferenceParams) ([]ApiV2010Conference, error) { +func (c *ApiService) ListConference(params *ListConferenceParams) (ListConference200Response, error) { response, errors := c.StreamConference(params) - records := make([]ApiV2010Conference, 0) + records := make(ListConference200Response, 0) for record := range response { records = append(records, record) } @@ -213,13 +179,13 @@ func (c *ApiService) ListConference(params *ListConferenceParams) ([]ApiV2010Con } // Streams Conference records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamConference(params *ListConferenceParams) (chan ApiV2010Conference, chan error) { +func (c *ApiService) StreamConference(params *ListConferenceParams) (chan ListConference200Response, chan error) { if params == nil { params = &ListConferenceParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Conference, 1) + recordChannel := make(chan ListConference200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageConference(params, "", "") @@ -234,11 +200,12 @@ func (c *ApiService) StreamConference(params *ListConferenceParams) (chan ApiV20 return recordChannel, errorChannel } -func (c *ApiService) streamConference(response *ListConferenceResponse, params *ListConferenceParams, recordChannel chan ApiV2010Conference, errorChannel chan error) { + +func (c *ApiService) streamConference(response *, params *ListConferenceParams, recordChannel chan ListConference200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Conferences + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -249,7 +216,7 @@ func (c *ApiService) streamConference(response *ListConferenceResponse, params * } } - record, err := client.GetNext(c.baseURL, response, c.getNextListConferenceResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -257,94 +224,96 @@ func (c *ApiService) streamConference(response *ListConferenceResponse, params * break } - response = record.(*ListConferenceResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListConferenceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConference' type UpdateConferenceParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - Status *string `json:"Status,omitempty"` - // The URL we should call to announce something into the conference. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. - AnnounceUrl *string `json:"AnnounceUrl,omitempty"` - // The HTTP method used to call `announce_url`. Can be: `GET` or `POST` and the default is `POST` - AnnounceMethod *string `json:"AnnounceMethod,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The URL we should call to announce something into the conference. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. + AnnounceUrl *string `json:"AnnounceUrl,omitempty"` + // The HTTP method used to call `announce_url`. Can be: `GET` or `POST` and the default is `POST` + AnnounceMethod *string `json:"AnnounceMethod,omitempty"` } -func (params *UpdateConferenceParams) SetPathAccountSid(PathAccountSid string) *UpdateConferenceParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateConferenceParams) SetPathAccountSid(PathAccountSid string) (*UpdateConferenceParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateConferenceParams) SetStatus(Status string) *UpdateConferenceParams { - params.Status = &Status - return params +func (params *UpdateConferenceParams) SetStatus(Status string) (*UpdateConferenceParams){ + params.Status = &Status + return params } -func (params *UpdateConferenceParams) SetAnnounceUrl(AnnounceUrl string) *UpdateConferenceParams { - params.AnnounceUrl = &AnnounceUrl - return params +func (params *UpdateConferenceParams) SetAnnounceUrl(AnnounceUrl string) (*UpdateConferenceParams){ + params.AnnounceUrl = &AnnounceUrl + return params } -func (params *UpdateConferenceParams) SetAnnounceMethod(AnnounceMethod string) *UpdateConferenceParams { - params.AnnounceMethod = &AnnounceMethod - return params +func (params *UpdateConferenceParams) SetAnnounceMethod(AnnounceMethod string) (*UpdateConferenceParams){ + params.AnnounceMethod = &AnnounceMethod + return params } -// +// func (c *ApiService) UpdateConference(Sid string, params *UpdateConferenceParams) (*ApiV2010Conference, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.AnnounceUrl != nil { - data.Set("AnnounceUrl", *params.AnnounceUrl) - } - if params != nil && params.AnnounceMethod != nil { - data.Set("AnnounceMethod", *params.AnnounceMethod) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.AnnounceUrl != nil { + data.Set("AnnounceUrl", *params.AnnounceUrl) + } + if params != nil && params.AnnounceMethod != nil { + data.Set("AnnounceMethod", *params.AnnounceMethod) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Conference{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Conference{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_conferences_participants.go b/rest/api/v2010/accounts_conferences_participants.go index 32ba1ec10..4b02f8a70 100644 --- a/rest/api/v2010/accounts_conferences_participants.go +++ b/rest/api/v2010/accounts_conferences_participants.go @@ -18,661 +18,657 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateParticipant' type CreateParticipantParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `from` must also be a phone number. If `to` is sip address, this value of `from` should be a username portion to be used to populate the P-Asserted-Identity header that is passed to the SIP endpoint. - From *string `json:"From,omitempty"` - // The phone number, SIP address, or Client identifier that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client identifiers are formatted `client:name`. [Custom parameters](https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters) may also be specified. - To *string `json:"To,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` and `POST` and defaults to `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The conference state changes that should generate a call to `status_callback`. Can be: `initiated`, `ringing`, `answered`, and `completed`. Separate multiple values with a space. The default value is `completed`. - StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` - // A label for this participant. If one is supplied, it may subsequently be used to fetch, update or delete the participant. - Label *string `json:"Label,omitempty"` - // The number of seconds that we should allow the phone to ring before assuming there is no answer. Can be an integer between `5` and `600`, inclusive. The default value is `60`. We always add a 5-second timeout buffer to outgoing calls, so value of 10 would result in an actual timeout that was closer to 15 seconds. - Timeout *int `json:"Timeout,omitempty"` - // Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. - Record *bool `json:"Record,omitempty"` - // Whether the agent is muted in the conference. Can be `true` or `false` and the default is `false`. - Muted *bool `json:"Muted,omitempty"` - // Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. - Beep *string `json:"Beep,omitempty"` - // Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. - StartConferenceOnEnter *bool `json:"StartConferenceOnEnter,omitempty"` - // Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. - EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` - // The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). - WaitUrl *string `json:"WaitUrl,omitempty"` - // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. - WaitMethod *string `json:"WaitMethod,omitempty"` - // Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`. - EarlyMedia *bool `json:"EarlyMedia,omitempty"` - // The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. - MaxParticipants *int `json:"MaxParticipants,omitempty"` - // Whether to record the conference the participant is joining. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. - ConferenceRecord *string `json:"ConferenceRecord,omitempty"` - // Whether to trim leading and trailing silence from the conference recording. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. - ConferenceTrim *string `json:"ConferenceTrim,omitempty"` - // The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. - ConferenceStatusCallback *string `json:"ConferenceStatusCallback,omitempty"` - // The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - ConferenceStatusCallbackMethod *string `json:"ConferenceStatusCallbackMethod,omitempty"` - // The conference state changes that should generate a call to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and `announcement`. Separate multiple values with a space. Defaults to `start end`. - ConferenceStatusCallbackEvent *[]string `json:"ConferenceStatusCallbackEvent,omitempty"` - // The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. - RecordingChannels *string `json:"RecordingChannels,omitempty"` - // The URL that we should call using the `recording_status_callback_method` when the recording status changes. - RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` - // The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` - // The SIP username used for authentication. - SipAuthUsername *string `json:"SipAuthUsername,omitempty"` - // The SIP password for authentication. - SipAuthPassword *string `json:"SipAuthPassword,omitempty"` - // The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. - Region *string `json:"Region,omitempty"` - // The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. - ConferenceRecordingStatusCallback *string `json:"ConferenceRecordingStatusCallback,omitempty"` - // The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - ConferenceRecordingStatusCallbackMethod *string `json:"ConferenceRecordingStatusCallbackMethod,omitempty"` - // The recording state changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`. - RecordingStatusCallbackEvent *[]string `json:"RecordingStatusCallbackEvent,omitempty"` - // The conference recording state changes that generate a call to `conference_recording_status_callback`. Can be: `in-progress`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'` - ConferenceRecordingStatusCallbackEvent *[]string `json:"ConferenceRecordingStatusCallbackEvent,omitempty"` - // Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. - Coaching *bool `json:"Coaching,omitempty"` - // The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. - CallSidToCoach *string `json:"CallSidToCoach,omitempty"` - // Jitter buffer size for the connecting participant. Twilio will use this setting to apply Jitter Buffer before participant's audio is mixed into the conference. Can be: `off`, `small`, `medium`, and `large`. Default to `large`. - JitterBufferSize *string `json:"JitterBufferSize,omitempty"` - // The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) - Byoc *string `json:"Byoc,omitempty"` - // The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. - CallerId *string `json:"CallerId,omitempty"` - // The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) - CallReason *string `json:"CallReason,omitempty"` - // The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. - RecordingTrack *string `json:"RecordingTrack,omitempty"` - // The maximum duration of the call in seconds. Constraints depend on account and configuration. - TimeLimit *int `json:"TimeLimit,omitempty"` - // Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). - MachineDetection *string `json:"MachineDetection,omitempty"` - // The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. - MachineDetectionTimeout *int `json:"MachineDetectionTimeout,omitempty"` - // The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. - MachineDetectionSpeechThreshold *int `json:"MachineDetectionSpeechThreshold,omitempty"` - // The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. - MachineDetectionSpeechEndThreshold *int `json:"MachineDetectionSpeechEndThreshold,omitempty"` - // The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. - MachineDetectionSilenceTimeout *int `json:"MachineDetectionSilenceTimeout,omitempty"` - // The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. - AmdStatusCallback *string `json:"AmdStatusCallback,omitempty"` - // The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. - AmdStatusCallbackMethod *string `json:"AmdStatusCallbackMethod,omitempty"` - // Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. - Trim *string `json:"Trim,omitempty"` - // A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. - CallToken *string `json:"CallToken,omitempty"` -} - -func (params *CreateParticipantParams) SetPathAccountSid(PathAccountSid string) *CreateParticipantParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateParticipantParams) SetFrom(From string) *CreateParticipantParams { - params.From = &From - return params -} -func (params *CreateParticipantParams) SetTo(To string) *CreateParticipantParams { - params.To = &To - return params -} -func (params *CreateParticipantParams) SetStatusCallback(StatusCallback string) *CreateParticipantParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateParticipantParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateParticipantParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateParticipantParams) SetStatusCallbackEvent(StatusCallbackEvent []string) *CreateParticipantParams { - params.StatusCallbackEvent = &StatusCallbackEvent - return params -} -func (params *CreateParticipantParams) SetLabel(Label string) *CreateParticipantParams { - params.Label = &Label - return params -} -func (params *CreateParticipantParams) SetTimeout(Timeout int) *CreateParticipantParams { - params.Timeout = &Timeout - return params -} -func (params *CreateParticipantParams) SetRecord(Record bool) *CreateParticipantParams { - params.Record = &Record - return params -} -func (params *CreateParticipantParams) SetMuted(Muted bool) *CreateParticipantParams { - params.Muted = &Muted - return params -} -func (params *CreateParticipantParams) SetBeep(Beep string) *CreateParticipantParams { - params.Beep = &Beep - return params -} -func (params *CreateParticipantParams) SetStartConferenceOnEnter(StartConferenceOnEnter bool) *CreateParticipantParams { - params.StartConferenceOnEnter = &StartConferenceOnEnter - return params -} -func (params *CreateParticipantParams) SetEndConferenceOnExit(EndConferenceOnExit bool) *CreateParticipantParams { - params.EndConferenceOnExit = &EndConferenceOnExit - return params -} -func (params *CreateParticipantParams) SetWaitUrl(WaitUrl string) *CreateParticipantParams { - params.WaitUrl = &WaitUrl - return params -} -func (params *CreateParticipantParams) SetWaitMethod(WaitMethod string) *CreateParticipantParams { - params.WaitMethod = &WaitMethod - return params -} -func (params *CreateParticipantParams) SetEarlyMedia(EarlyMedia bool) *CreateParticipantParams { - params.EarlyMedia = &EarlyMedia - return params -} -func (params *CreateParticipantParams) SetMaxParticipants(MaxParticipants int) *CreateParticipantParams { - params.MaxParticipants = &MaxParticipants - return params -} -func (params *CreateParticipantParams) SetConferenceRecord(ConferenceRecord string) *CreateParticipantParams { - params.ConferenceRecord = &ConferenceRecord - return params -} -func (params *CreateParticipantParams) SetConferenceTrim(ConferenceTrim string) *CreateParticipantParams { - params.ConferenceTrim = &ConferenceTrim - return params -} -func (params *CreateParticipantParams) SetConferenceStatusCallback(ConferenceStatusCallback string) *CreateParticipantParams { - params.ConferenceStatusCallback = &ConferenceStatusCallback - return params -} -func (params *CreateParticipantParams) SetConferenceStatusCallbackMethod(ConferenceStatusCallbackMethod string) *CreateParticipantParams { - params.ConferenceStatusCallbackMethod = &ConferenceStatusCallbackMethod - return params -} -func (params *CreateParticipantParams) SetConferenceStatusCallbackEvent(ConferenceStatusCallbackEvent []string) *CreateParticipantParams { - params.ConferenceStatusCallbackEvent = &ConferenceStatusCallbackEvent - return params -} -func (params *CreateParticipantParams) SetRecordingChannels(RecordingChannels string) *CreateParticipantParams { - params.RecordingChannels = &RecordingChannels - return params -} -func (params *CreateParticipantParams) SetRecordingStatusCallback(RecordingStatusCallback string) *CreateParticipantParams { - params.RecordingStatusCallback = &RecordingStatusCallback - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `from` must also be a phone number. If `to` is sip address, this value of `from` should be a username portion to be used to populate the P-Asserted-Identity header that is passed to the SIP endpoint. + From *string `json:"From,omitempty"` + // The phone number, SIP address, or Client identifier that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `sip:name@company.com`. Client identifiers are formatted `client:name`. [Custom parameters](https://www.twilio.com/docs/voice/api/conference-participant-resource#custom-parameters) may also be specified. + To *string `json:"To,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` and `POST` and defaults to `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The conference state changes that should generate a call to `status_callback`. Can be: `initiated`, `ringing`, `answered`, and `completed`. Separate multiple values with a space. The default value is `completed`. + StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` + // A label for this participant. If one is supplied, it may subsequently be used to fetch, update or delete the participant. + Label *string `json:"Label,omitempty"` + // The number of seconds that we should allow the phone to ring before assuming there is no answer. Can be an integer between `5` and `600`, inclusive. The default value is `60`. We always add a 5-second timeout buffer to outgoing calls, so value of 10 would result in an actual timeout that was closer to 15 seconds. + Timeout *int `json:"Timeout,omitempty"` + // Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. + Record *bool `json:"Record,omitempty"` + // Whether the agent is muted in the conference. Can be `true` or `false` and the default is `false`. + Muted *bool `json:"Muted,omitempty"` + // Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. + Beep *string `json:"Beep,omitempty"` + // Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + StartConferenceOnEnter *bool `json:"StartConferenceOnEnter,omitempty"` + // Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. + EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` + // The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + WaitUrl *string `json:"WaitUrl,omitempty"` + // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. + WaitMethod *string `json:"WaitMethod,omitempty"` + // Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`. + EarlyMedia *bool `json:"EarlyMedia,omitempty"` + // The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. + MaxParticipants *int `json:"MaxParticipants,omitempty"` + // Whether to record the conference the participant is joining. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. + ConferenceRecord *string `json:"ConferenceRecord,omitempty"` + // Whether to trim leading and trailing silence from the conference recording. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. + ConferenceTrim *string `json:"ConferenceTrim,omitempty"` + // The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. + ConferenceStatusCallback *string `json:"ConferenceStatusCallback,omitempty"` + // The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + ConferenceStatusCallbackMethod *string `json:"ConferenceStatusCallbackMethod,omitempty"` + // The conference state changes that should generate a call to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and `announcement`. Separate multiple values with a space. Defaults to `start end`. + ConferenceStatusCallbackEvent *[]string `json:"ConferenceStatusCallbackEvent,omitempty"` + // The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. + RecordingChannels *string `json:"RecordingChannels,omitempty"` + // The URL that we should call using the `recording_status_callback_method` when the recording status changes. + RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` + // The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` + // The SIP username used for authentication. + SipAuthUsername *string `json:"SipAuthUsername,omitempty"` + // The SIP password for authentication. + SipAuthPassword *string `json:"SipAuthPassword,omitempty"` + // The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + Region *string `json:"Region,omitempty"` + // The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. + ConferenceRecordingStatusCallback *string `json:"ConferenceRecordingStatusCallback,omitempty"` + // The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + ConferenceRecordingStatusCallbackMethod *string `json:"ConferenceRecordingStatusCallbackMethod,omitempty"` + // The recording state changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`. + RecordingStatusCallbackEvent *[]string `json:"RecordingStatusCallbackEvent,omitempty"` + // The conference recording state changes that generate a call to `conference_recording_status_callback`. Can be: `in-progress`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'` + ConferenceRecordingStatusCallbackEvent *[]string `json:"ConferenceRecordingStatusCallbackEvent,omitempty"` + // Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. + Coaching *bool `json:"Coaching,omitempty"` + // The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. + CallSidToCoach *string `json:"CallSidToCoach,omitempty"` + // Jitter buffer size for the connecting participant. Twilio will use this setting to apply Jitter Buffer before participant's audio is mixed into the conference. Can be: `off`, `small`, `medium`, and `large`. Default to `large`. + JitterBufferSize *string `json:"JitterBufferSize,omitempty"` + // The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) + Byoc *string `json:"Byoc,omitempty"` + // The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. + CallerId *string `json:"CallerId,omitempty"` + // The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) + CallReason *string `json:"CallReason,omitempty"` + // The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. + RecordingTrack *string `json:"RecordingTrack,omitempty"` + // The maximum duration of the call in seconds. Constraints depend on account and configuration. + TimeLimit *int `json:"TimeLimit,omitempty"` + // Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). + MachineDetection *string `json:"MachineDetection,omitempty"` + // The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. + MachineDetectionTimeout *int `json:"MachineDetectionTimeout,omitempty"` + // The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. + MachineDetectionSpeechThreshold *int `json:"MachineDetectionSpeechThreshold,omitempty"` + // The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. + MachineDetectionSpeechEndThreshold *int `json:"MachineDetectionSpeechEndThreshold,omitempty"` + // The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. + MachineDetectionSilenceTimeout *int `json:"MachineDetectionSilenceTimeout,omitempty"` + // The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. + AmdStatusCallback *string `json:"AmdStatusCallback,omitempty"` + // The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. + AmdStatusCallbackMethod *string `json:"AmdStatusCallbackMethod,omitempty"` + // Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. + Trim *string `json:"Trim,omitempty"` +} + +func (params *CreateParticipantParams) SetPathAccountSid(PathAccountSid string) (*CreateParticipantParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateParticipantParams) SetFrom(From string) (*CreateParticipantParams){ + params.From = &From + return params +} +func (params *CreateParticipantParams) SetTo(To string) (*CreateParticipantParams){ + params.To = &To + return params +} +func (params *CreateParticipantParams) SetStatusCallback(StatusCallback string) (*CreateParticipantParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateParticipantParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateParticipantParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateParticipantParams) SetStatusCallbackEvent(StatusCallbackEvent []string) (*CreateParticipantParams){ + params.StatusCallbackEvent = &StatusCallbackEvent + return params +} +func (params *CreateParticipantParams) SetLabel(Label string) (*CreateParticipantParams){ + params.Label = &Label + return params +} +func (params *CreateParticipantParams) SetTimeout(Timeout int) (*CreateParticipantParams){ + params.Timeout = &Timeout + return params +} +func (params *CreateParticipantParams) SetRecord(Record bool) (*CreateParticipantParams){ + params.Record = &Record + return params +} +func (params *CreateParticipantParams) SetMuted(Muted bool) (*CreateParticipantParams){ + params.Muted = &Muted + return params +} +func (params *CreateParticipantParams) SetBeep(Beep string) (*CreateParticipantParams){ + params.Beep = &Beep + return params +} +func (params *CreateParticipantParams) SetStartConferenceOnEnter(StartConferenceOnEnter bool) (*CreateParticipantParams){ + params.StartConferenceOnEnter = &StartConferenceOnEnter + return params +} +func (params *CreateParticipantParams) SetEndConferenceOnExit(EndConferenceOnExit bool) (*CreateParticipantParams){ + params.EndConferenceOnExit = &EndConferenceOnExit + return params +} +func (params *CreateParticipantParams) SetWaitUrl(WaitUrl string) (*CreateParticipantParams){ + params.WaitUrl = &WaitUrl + return params +} +func (params *CreateParticipantParams) SetWaitMethod(WaitMethod string) (*CreateParticipantParams){ + params.WaitMethod = &WaitMethod + return params +} +func (params *CreateParticipantParams) SetEarlyMedia(EarlyMedia bool) (*CreateParticipantParams){ + params.EarlyMedia = &EarlyMedia + return params +} +func (params *CreateParticipantParams) SetMaxParticipants(MaxParticipants int) (*CreateParticipantParams){ + params.MaxParticipants = &MaxParticipants + return params +} +func (params *CreateParticipantParams) SetConferenceRecord(ConferenceRecord string) (*CreateParticipantParams){ + params.ConferenceRecord = &ConferenceRecord + return params +} +func (params *CreateParticipantParams) SetConferenceTrim(ConferenceTrim string) (*CreateParticipantParams){ + params.ConferenceTrim = &ConferenceTrim + return params +} +func (params *CreateParticipantParams) SetConferenceStatusCallback(ConferenceStatusCallback string) (*CreateParticipantParams){ + params.ConferenceStatusCallback = &ConferenceStatusCallback + return params +} +func (params *CreateParticipantParams) SetConferenceStatusCallbackMethod(ConferenceStatusCallbackMethod string) (*CreateParticipantParams){ + params.ConferenceStatusCallbackMethod = &ConferenceStatusCallbackMethod + return params +} +func (params *CreateParticipantParams) SetConferenceStatusCallbackEvent(ConferenceStatusCallbackEvent []string) (*CreateParticipantParams){ + params.ConferenceStatusCallbackEvent = &ConferenceStatusCallbackEvent + return params +} +func (params *CreateParticipantParams) SetRecordingChannels(RecordingChannels string) (*CreateParticipantParams){ + params.RecordingChannels = &RecordingChannels + return params } -func (params *CreateParticipantParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) *CreateParticipantParams { - params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod - return params +func (params *CreateParticipantParams) SetRecordingStatusCallback(RecordingStatusCallback string) (*CreateParticipantParams){ + params.RecordingStatusCallback = &RecordingStatusCallback + return params } -func (params *CreateParticipantParams) SetSipAuthUsername(SipAuthUsername string) *CreateParticipantParams { - params.SipAuthUsername = &SipAuthUsername - return params +func (params *CreateParticipantParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) (*CreateParticipantParams){ + params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod + return params } -func (params *CreateParticipantParams) SetSipAuthPassword(SipAuthPassword string) *CreateParticipantParams { - params.SipAuthPassword = &SipAuthPassword - return params +func (params *CreateParticipantParams) SetSipAuthUsername(SipAuthUsername string) (*CreateParticipantParams){ + params.SipAuthUsername = &SipAuthUsername + return params } -func (params *CreateParticipantParams) SetRegion(Region string) *CreateParticipantParams { - params.Region = &Region - return params +func (params *CreateParticipantParams) SetSipAuthPassword(SipAuthPassword string) (*CreateParticipantParams){ + params.SipAuthPassword = &SipAuthPassword + return params } -func (params *CreateParticipantParams) SetConferenceRecordingStatusCallback(ConferenceRecordingStatusCallback string) *CreateParticipantParams { - params.ConferenceRecordingStatusCallback = &ConferenceRecordingStatusCallback - return params +func (params *CreateParticipantParams) SetRegion(Region string) (*CreateParticipantParams){ + params.Region = &Region + return params } -func (params *CreateParticipantParams) SetConferenceRecordingStatusCallbackMethod(ConferenceRecordingStatusCallbackMethod string) *CreateParticipantParams { - params.ConferenceRecordingStatusCallbackMethod = &ConferenceRecordingStatusCallbackMethod - return params +func (params *CreateParticipantParams) SetConferenceRecordingStatusCallback(ConferenceRecordingStatusCallback string) (*CreateParticipantParams){ + params.ConferenceRecordingStatusCallback = &ConferenceRecordingStatusCallback + return params } -func (params *CreateParticipantParams) SetRecordingStatusCallbackEvent(RecordingStatusCallbackEvent []string) *CreateParticipantParams { - params.RecordingStatusCallbackEvent = &RecordingStatusCallbackEvent - return params +func (params *CreateParticipantParams) SetConferenceRecordingStatusCallbackMethod(ConferenceRecordingStatusCallbackMethod string) (*CreateParticipantParams){ + params.ConferenceRecordingStatusCallbackMethod = &ConferenceRecordingStatusCallbackMethod + return params } -func (params *CreateParticipantParams) SetConferenceRecordingStatusCallbackEvent(ConferenceRecordingStatusCallbackEvent []string) *CreateParticipantParams { - params.ConferenceRecordingStatusCallbackEvent = &ConferenceRecordingStatusCallbackEvent - return params +func (params *CreateParticipantParams) SetRecordingStatusCallbackEvent(RecordingStatusCallbackEvent []string) (*CreateParticipantParams){ + params.RecordingStatusCallbackEvent = &RecordingStatusCallbackEvent + return params } -func (params *CreateParticipantParams) SetCoaching(Coaching bool) *CreateParticipantParams { - params.Coaching = &Coaching - return params +func (params *CreateParticipantParams) SetConferenceRecordingStatusCallbackEvent(ConferenceRecordingStatusCallbackEvent []string) (*CreateParticipantParams){ + params.ConferenceRecordingStatusCallbackEvent = &ConferenceRecordingStatusCallbackEvent + return params } -func (params *CreateParticipantParams) SetCallSidToCoach(CallSidToCoach string) *CreateParticipantParams { - params.CallSidToCoach = &CallSidToCoach - return params +func (params *CreateParticipantParams) SetCoaching(Coaching bool) (*CreateParticipantParams){ + params.Coaching = &Coaching + return params } -func (params *CreateParticipantParams) SetJitterBufferSize(JitterBufferSize string) *CreateParticipantParams { - params.JitterBufferSize = &JitterBufferSize - return params +func (params *CreateParticipantParams) SetCallSidToCoach(CallSidToCoach string) (*CreateParticipantParams){ + params.CallSidToCoach = &CallSidToCoach + return params } -func (params *CreateParticipantParams) SetByoc(Byoc string) *CreateParticipantParams { - params.Byoc = &Byoc - return params +func (params *CreateParticipantParams) SetJitterBufferSize(JitterBufferSize string) (*CreateParticipantParams){ + params.JitterBufferSize = &JitterBufferSize + return params } -func (params *CreateParticipantParams) SetCallerId(CallerId string) *CreateParticipantParams { - params.CallerId = &CallerId - return params +func (params *CreateParticipantParams) SetByoc(Byoc string) (*CreateParticipantParams){ + params.Byoc = &Byoc + return params } -func (params *CreateParticipantParams) SetCallReason(CallReason string) *CreateParticipantParams { - params.CallReason = &CallReason - return params +func (params *CreateParticipantParams) SetCallerId(CallerId string) (*CreateParticipantParams){ + params.CallerId = &CallerId + return params } -func (params *CreateParticipantParams) SetRecordingTrack(RecordingTrack string) *CreateParticipantParams { - params.RecordingTrack = &RecordingTrack - return params +func (params *CreateParticipantParams) SetCallReason(CallReason string) (*CreateParticipantParams){ + params.CallReason = &CallReason + return params } -func (params *CreateParticipantParams) SetTimeLimit(TimeLimit int) *CreateParticipantParams { - params.TimeLimit = &TimeLimit - return params +func (params *CreateParticipantParams) SetRecordingTrack(RecordingTrack string) (*CreateParticipantParams){ + params.RecordingTrack = &RecordingTrack + return params } -func (params *CreateParticipantParams) SetMachineDetection(MachineDetection string) *CreateParticipantParams { - params.MachineDetection = &MachineDetection - return params +func (params *CreateParticipantParams) SetTimeLimit(TimeLimit int) (*CreateParticipantParams){ + params.TimeLimit = &TimeLimit + return params } -func (params *CreateParticipantParams) SetMachineDetectionTimeout(MachineDetectionTimeout int) *CreateParticipantParams { - params.MachineDetectionTimeout = &MachineDetectionTimeout - return params +func (params *CreateParticipantParams) SetMachineDetection(MachineDetection string) (*CreateParticipantParams){ + params.MachineDetection = &MachineDetection + return params } -func (params *CreateParticipantParams) SetMachineDetectionSpeechThreshold(MachineDetectionSpeechThreshold int) *CreateParticipantParams { - params.MachineDetectionSpeechThreshold = &MachineDetectionSpeechThreshold - return params +func (params *CreateParticipantParams) SetMachineDetectionTimeout(MachineDetectionTimeout int) (*CreateParticipantParams){ + params.MachineDetectionTimeout = &MachineDetectionTimeout + return params } -func (params *CreateParticipantParams) SetMachineDetectionSpeechEndThreshold(MachineDetectionSpeechEndThreshold int) *CreateParticipantParams { - params.MachineDetectionSpeechEndThreshold = &MachineDetectionSpeechEndThreshold - return params +func (params *CreateParticipantParams) SetMachineDetectionSpeechThreshold(MachineDetectionSpeechThreshold int) (*CreateParticipantParams){ + params.MachineDetectionSpeechThreshold = &MachineDetectionSpeechThreshold + return params } -func (params *CreateParticipantParams) SetMachineDetectionSilenceTimeout(MachineDetectionSilenceTimeout int) *CreateParticipantParams { - params.MachineDetectionSilenceTimeout = &MachineDetectionSilenceTimeout - return params +func (params *CreateParticipantParams) SetMachineDetectionSpeechEndThreshold(MachineDetectionSpeechEndThreshold int) (*CreateParticipantParams){ + params.MachineDetectionSpeechEndThreshold = &MachineDetectionSpeechEndThreshold + return params } -func (params *CreateParticipantParams) SetAmdStatusCallback(AmdStatusCallback string) *CreateParticipantParams { - params.AmdStatusCallback = &AmdStatusCallback - return params +func (params *CreateParticipantParams) SetMachineDetectionSilenceTimeout(MachineDetectionSilenceTimeout int) (*CreateParticipantParams){ + params.MachineDetectionSilenceTimeout = &MachineDetectionSilenceTimeout + return params } -func (params *CreateParticipantParams) SetAmdStatusCallbackMethod(AmdStatusCallbackMethod string) *CreateParticipantParams { - params.AmdStatusCallbackMethod = &AmdStatusCallbackMethod - return params +func (params *CreateParticipantParams) SetAmdStatusCallback(AmdStatusCallback string) (*CreateParticipantParams){ + params.AmdStatusCallback = &AmdStatusCallback + return params } -func (params *CreateParticipantParams) SetTrim(Trim string) *CreateParticipantParams { - params.Trim = &Trim - return params +func (params *CreateParticipantParams) SetAmdStatusCallbackMethod(AmdStatusCallbackMethod string) (*CreateParticipantParams){ + params.AmdStatusCallbackMethod = &AmdStatusCallbackMethod + return params } -func (params *CreateParticipantParams) SetCallToken(CallToken string) *CreateParticipantParams { - params.CallToken = &CallToken - return params +func (params *CreateParticipantParams) SetTrim(Trim string) (*CreateParticipantParams){ + params.Trim = &Trim + return params } -// +// func (c *ApiService) CreateParticipant(ConferenceSid string, params *CreateParticipantParams) (*ApiV2010Participant, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.StatusCallbackEvent != nil { - for _, item := range *params.StatusCallbackEvent { - data.Add("StatusCallbackEvent", item) - } - } - if params != nil && params.Label != nil { - data.Set("Label", *params.Label) - } - if params != nil && params.Timeout != nil { - data.Set("Timeout", fmt.Sprint(*params.Timeout)) - } - if params != nil && params.Record != nil { - data.Set("Record", fmt.Sprint(*params.Record)) - } - if params != nil && params.Muted != nil { - data.Set("Muted", fmt.Sprint(*params.Muted)) - } - if params != nil && params.Beep != nil { - data.Set("Beep", *params.Beep) - } - if params != nil && params.StartConferenceOnEnter != nil { - data.Set("StartConferenceOnEnter", fmt.Sprint(*params.StartConferenceOnEnter)) - } - if params != nil && params.EndConferenceOnExit != nil { - data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) - } - if params != nil && params.WaitUrl != nil { - data.Set("WaitUrl", *params.WaitUrl) - } - if params != nil && params.WaitMethod != nil { - data.Set("WaitMethod", *params.WaitMethod) - } - if params != nil && params.EarlyMedia != nil { - data.Set("EarlyMedia", fmt.Sprint(*params.EarlyMedia)) - } - if params != nil && params.MaxParticipants != nil { - data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) - } - if params != nil && params.ConferenceRecord != nil { - data.Set("ConferenceRecord", *params.ConferenceRecord) - } - if params != nil && params.ConferenceTrim != nil { - data.Set("ConferenceTrim", *params.ConferenceTrim) - } - if params != nil && params.ConferenceStatusCallback != nil { - data.Set("ConferenceStatusCallback", *params.ConferenceStatusCallback) - } - if params != nil && params.ConferenceStatusCallbackMethod != nil { - data.Set("ConferenceStatusCallbackMethod", *params.ConferenceStatusCallbackMethod) - } - if params != nil && params.ConferenceStatusCallbackEvent != nil { - for _, item := range *params.ConferenceStatusCallbackEvent { - data.Add("ConferenceStatusCallbackEvent", item) - } - } - if params != nil && params.RecordingChannels != nil { - data.Set("RecordingChannels", *params.RecordingChannels) - } - if params != nil && params.RecordingStatusCallback != nil { - data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) - } - if params != nil && params.RecordingStatusCallbackMethod != nil { - data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) - } - if params != nil && params.SipAuthUsername != nil { - data.Set("SipAuthUsername", *params.SipAuthUsername) - } - if params != nil && params.SipAuthPassword != nil { - data.Set("SipAuthPassword", *params.SipAuthPassword) - } - if params != nil && params.Region != nil { - data.Set("Region", *params.Region) - } - if params != nil && params.ConferenceRecordingStatusCallback != nil { - data.Set("ConferenceRecordingStatusCallback", *params.ConferenceRecordingStatusCallback) - } - if params != nil && params.ConferenceRecordingStatusCallbackMethod != nil { - data.Set("ConferenceRecordingStatusCallbackMethod", *params.ConferenceRecordingStatusCallbackMethod) - } - if params != nil && params.RecordingStatusCallbackEvent != nil { - for _, item := range *params.RecordingStatusCallbackEvent { - data.Add("RecordingStatusCallbackEvent", item) - } - } - if params != nil && params.ConferenceRecordingStatusCallbackEvent != nil { - for _, item := range *params.ConferenceRecordingStatusCallbackEvent { - data.Add("ConferenceRecordingStatusCallbackEvent", item) - } - } - if params != nil && params.Coaching != nil { - data.Set("Coaching", fmt.Sprint(*params.Coaching)) - } - if params != nil && params.CallSidToCoach != nil { - data.Set("CallSidToCoach", *params.CallSidToCoach) - } - if params != nil && params.JitterBufferSize != nil { - data.Set("JitterBufferSize", *params.JitterBufferSize) - } - if params != nil && params.Byoc != nil { - data.Set("Byoc", *params.Byoc) - } - if params != nil && params.CallerId != nil { - data.Set("CallerId", *params.CallerId) - } - if params != nil && params.CallReason != nil { - data.Set("CallReason", *params.CallReason) - } - if params != nil && params.RecordingTrack != nil { - data.Set("RecordingTrack", *params.RecordingTrack) - } - if params != nil && params.TimeLimit != nil { - data.Set("TimeLimit", fmt.Sprint(*params.TimeLimit)) - } - if params != nil && params.MachineDetection != nil { - data.Set("MachineDetection", *params.MachineDetection) - } - if params != nil && params.MachineDetectionTimeout != nil { - data.Set("MachineDetectionTimeout", fmt.Sprint(*params.MachineDetectionTimeout)) - } - if params != nil && params.MachineDetectionSpeechThreshold != nil { - data.Set("MachineDetectionSpeechThreshold", fmt.Sprint(*params.MachineDetectionSpeechThreshold)) - } - if params != nil && params.MachineDetectionSpeechEndThreshold != nil { - data.Set("MachineDetectionSpeechEndThreshold", fmt.Sprint(*params.MachineDetectionSpeechEndThreshold)) - } - if params != nil && params.MachineDetectionSilenceTimeout != nil { - data.Set("MachineDetectionSilenceTimeout", fmt.Sprint(*params.MachineDetectionSilenceTimeout)) - } - if params != nil && params.AmdStatusCallback != nil { - data.Set("AmdStatusCallback", *params.AmdStatusCallback) - } - if params != nil && params.AmdStatusCallbackMethod != nil { - data.Set("AmdStatusCallbackMethod", *params.AmdStatusCallbackMethod) - } - if params != nil && params.Trim != nil { - data.Set("Trim", *params.Trim) - } - if params != nil && params.CallToken != nil { - data.Set("CallToken", *params.CallToken) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Participant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.StatusCallbackEvent != nil { + for _, item := range *params.StatusCallbackEvent { + data.Add("StatusCallbackEvent", item) + } + } + if params != nil && params.Label != nil { + data.Set("Label", *params.Label) + } + if params != nil && params.Timeout != nil { + data.Set("Timeout", fmt.Sprint(*params.Timeout)) + } + if params != nil && params.Record != nil { + data.Set("Record", fmt.Sprint(*params.Record)) + } + if params != nil && params.Muted != nil { + data.Set("Muted", fmt.Sprint(*params.Muted)) + } + if params != nil && params.Beep != nil { + data.Set("Beep", *params.Beep) + } + if params != nil && params.StartConferenceOnEnter != nil { + data.Set("StartConferenceOnEnter", fmt.Sprint(*params.StartConferenceOnEnter)) + } + if params != nil && params.EndConferenceOnExit != nil { + data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) + } + if params != nil && params.WaitUrl != nil { + data.Set("WaitUrl", *params.WaitUrl) + } + if params != nil && params.WaitMethod != nil { + data.Set("WaitMethod", *params.WaitMethod) + } + if params != nil && params.EarlyMedia != nil { + data.Set("EarlyMedia", fmt.Sprint(*params.EarlyMedia)) + } + if params != nil && params.MaxParticipants != nil { + data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) + } + if params != nil && params.ConferenceRecord != nil { + data.Set("ConferenceRecord", *params.ConferenceRecord) + } + if params != nil && params.ConferenceTrim != nil { + data.Set("ConferenceTrim", *params.ConferenceTrim) + } + if params != nil && params.ConferenceStatusCallback != nil { + data.Set("ConferenceStatusCallback", *params.ConferenceStatusCallback) + } + if params != nil && params.ConferenceStatusCallbackMethod != nil { + data.Set("ConferenceStatusCallbackMethod", *params.ConferenceStatusCallbackMethod) + } + if params != nil && params.ConferenceStatusCallbackEvent != nil { + for _, item := range *params.ConferenceStatusCallbackEvent { + data.Add("ConferenceStatusCallbackEvent", item) + } + } + if params != nil && params.RecordingChannels != nil { + data.Set("RecordingChannels", *params.RecordingChannels) + } + if params != nil && params.RecordingStatusCallback != nil { + data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) + } + if params != nil && params.RecordingStatusCallbackMethod != nil { + data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) + } + if params != nil && params.SipAuthUsername != nil { + data.Set("SipAuthUsername", *params.SipAuthUsername) + } + if params != nil && params.SipAuthPassword != nil { + data.Set("SipAuthPassword", *params.SipAuthPassword) + } + if params != nil && params.Region != nil { + data.Set("Region", *params.Region) + } + if params != nil && params.ConferenceRecordingStatusCallback != nil { + data.Set("ConferenceRecordingStatusCallback", *params.ConferenceRecordingStatusCallback) + } + if params != nil && params.ConferenceRecordingStatusCallbackMethod != nil { + data.Set("ConferenceRecordingStatusCallbackMethod", *params.ConferenceRecordingStatusCallbackMethod) + } + if params != nil && params.RecordingStatusCallbackEvent != nil { + for _, item := range *params.RecordingStatusCallbackEvent { + data.Add("RecordingStatusCallbackEvent", item) + } + } + if params != nil && params.ConferenceRecordingStatusCallbackEvent != nil { + for _, item := range *params.ConferenceRecordingStatusCallbackEvent { + data.Add("ConferenceRecordingStatusCallbackEvent", item) + } + } + if params != nil && params.Coaching != nil { + data.Set("Coaching", fmt.Sprint(*params.Coaching)) + } + if params != nil && params.CallSidToCoach != nil { + data.Set("CallSidToCoach", *params.CallSidToCoach) + } + if params != nil && params.JitterBufferSize != nil { + data.Set("JitterBufferSize", *params.JitterBufferSize) + } + if params != nil && params.Byoc != nil { + data.Set("Byoc", *params.Byoc) + } + if params != nil && params.CallerId != nil { + data.Set("CallerId", *params.CallerId) + } + if params != nil && params.CallReason != nil { + data.Set("CallReason", *params.CallReason) + } + if params != nil && params.RecordingTrack != nil { + data.Set("RecordingTrack", *params.RecordingTrack) + } + if params != nil && params.TimeLimit != nil { + data.Set("TimeLimit", fmt.Sprint(*params.TimeLimit)) + } + if params != nil && params.MachineDetection != nil { + data.Set("MachineDetection", *params.MachineDetection) + } + if params != nil && params.MachineDetectionTimeout != nil { + data.Set("MachineDetectionTimeout", fmt.Sprint(*params.MachineDetectionTimeout)) + } + if params != nil && params.MachineDetectionSpeechThreshold != nil { + data.Set("MachineDetectionSpeechThreshold", fmt.Sprint(*params.MachineDetectionSpeechThreshold)) + } + if params != nil && params.MachineDetectionSpeechEndThreshold != nil { + data.Set("MachineDetectionSpeechEndThreshold", fmt.Sprint(*params.MachineDetectionSpeechEndThreshold)) + } + if params != nil && params.MachineDetectionSilenceTimeout != nil { + data.Set("MachineDetectionSilenceTimeout", fmt.Sprint(*params.MachineDetectionSilenceTimeout)) + } + if params != nil && params.AmdStatusCallback != nil { + data.Set("AmdStatusCallback", *params.AmdStatusCallback) + } + if params != nil && params.AmdStatusCallbackMethod != nil { + data.Set("AmdStatusCallbackMethod", *params.AmdStatusCallbackMethod) + } + if params != nil && params.Trim != nil { + data.Set("Trim", *params.Trim) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Participant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteParticipant' type DeleteParticipantParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteParticipantParams) SetPathAccountSid(PathAccountSid string) *DeleteParticipantParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteParticipantParams) SetPathAccountSid(PathAccountSid string) (*DeleteParticipantParams){ + params.PathAccountSid = &PathAccountSid + return params } // Kick a participant from a given conference -func (c *ApiService) DeleteParticipant(ConferenceSid string, CallSid string, params *DeleteParticipantParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) +func (c *ApiService) DeleteParticipant(ConferenceSid string, CallSid string, params *DeleteParticipantParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchParticipant' type FetchParticipantParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchParticipantParams) SetPathAccountSid(PathAccountSid string) *FetchParticipantParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchParticipantParams) SetPathAccountSid(PathAccountSid string) (*FetchParticipantParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a participant func (c *ApiService) FetchParticipant(ConferenceSid string, CallSid string, params *FetchParticipantParams) (*ApiV2010Participant, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Participant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Participant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListParticipant' type ListParticipantParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Whether to return only participants that are muted. Can be: `true` or `false`. - Muted *bool `json:"Muted,omitempty"` - // Whether to return only participants that are on hold. Can be: `true` or `false`. - Hold *bool `json:"Hold,omitempty"` - // Whether to return only participants who are coaching another call. Can be: `true` or `false`. - Coaching *bool `json:"Coaching,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Whether to return only participants that are muted. Can be: `true` or `false`. + Muted *bool `json:"Muted,omitempty"` + // Whether to return only participants that are on hold. Can be: `true` or `false`. + Hold *bool `json:"Hold,omitempty"` + // Whether to return only participants who are coaching another call. Can be: `true` or `false`. + Coaching *bool `json:"Coaching,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListParticipantParams) SetPathAccountSid(PathAccountSid string) *ListParticipantParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListParticipantParams) SetPathAccountSid(PathAccountSid string) (*ListParticipantParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListParticipantParams) SetMuted(Muted bool) *ListParticipantParams { - params.Muted = &Muted - return params +func (params *ListParticipantParams) SetMuted(Muted bool) (*ListParticipantParams){ + params.Muted = &Muted + return params } -func (params *ListParticipantParams) SetHold(Hold bool) *ListParticipantParams { - params.Hold = &Hold - return params +func (params *ListParticipantParams) SetHold(Hold bool) (*ListParticipantParams){ + params.Hold = &Hold + return params } -func (params *ListParticipantParams) SetCoaching(Coaching bool) *ListParticipantParams { - params.Coaching = &Coaching - return params +func (params *ListParticipantParams) SetCoaching(Coaching bool) (*ListParticipantParams){ + params.Coaching = &Coaching + return params } -func (params *ListParticipantParams) SetPageSize(PageSize int) *ListParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListParticipantParams) SetPageSize(PageSize int) (*ListParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListParticipantParams) SetLimit(Limit int) *ListParticipantParams { - params.Limit = &Limit - return params +func (params *ListParticipantParams) SetLimit(Limit int) (*ListParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Participant records from the API. Request is executed immediately. -func (c *ApiService) PageParticipant(ConferenceSid string, params *ListParticipantParams, pageToken, pageNumber string) (*ListParticipantResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Muted != nil { - data.Set("Muted", fmt.Sprint(*params.Muted)) - } - if params != nil && params.Hold != nil { - data.Set("Hold", fmt.Sprint(*params.Hold)) - } - if params != nil && params.Coaching != nil { - data.Set("Coaching", fmt.Sprint(*params.Coaching)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageParticipant(ConferenceSid string, params *ListParticipantParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Muted != nil { + data.Set("Muted", fmt.Sprint(*params.Muted)) + } + if params != nil && params.Hold != nil { + data.Set("Hold", fmt.Sprint(*params.Hold)) + } + if params != nil && params.Coaching != nil { + data.Set("Coaching", fmt.Sprint(*params.Coaching)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Participant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListParticipant(ConferenceSid string, params *ListParticipantParams) ([]ApiV2010Participant, error) { +func (c *ApiService) ListParticipant(ConferenceSid string, params *ListParticipantParams) (ListParticipant200Response, error) { response, errors := c.StreamParticipant(ConferenceSid, params) - records := make([]ApiV2010Participant, 0) + records := make(ListParticipant200Response, 0) for record := range response { records = append(records, record) } @@ -685,13 +681,13 @@ func (c *ApiService) ListParticipant(ConferenceSid string, params *ListParticipa } // Streams Participant records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamParticipant(ConferenceSid string, params *ListParticipantParams) (chan ApiV2010Participant, chan error) { +func (c *ApiService) StreamParticipant(ConferenceSid string, params *ListParticipantParams) (chan ListParticipant200Response, chan error) { if params == nil { params = &ListParticipantParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Participant, 1) + recordChannel := make(chan ListParticipant200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageParticipant(ConferenceSid, params, "", "") @@ -706,11 +702,12 @@ func (c *ApiService) StreamParticipant(ConferenceSid string, params *ListPartici return recordChannel, errorChannel } -func (c *ApiService) streamParticipant(response *ListParticipantResponse, params *ListParticipantParams, recordChannel chan ApiV2010Participant, errorChannel chan error) { + +func (c *ApiService) streamParticipant(response *, params *ListParticipantParams, recordChannel chan ListParticipant200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Participants + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -721,7 +718,7 @@ func (c *ApiService) streamParticipant(response *ListParticipantResponse, params } } - record, err := client.GetNext(c.baseURL, response, c.getNextListParticipantResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -729,176 +726,178 @@ func (c *ApiService) streamParticipant(response *ListParticipantResponse, params break } - response = record.(*ListParticipantResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateParticipant' type UpdateParticipantParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Whether the participant should be muted. Can be `true` or `false`. `true` will mute the participant, and `false` will un-mute them. Anything value other than `true` or `false` is interpreted as `false`. - Muted *bool `json:"Muted,omitempty"` - // Whether the participant should be on hold. Can be: `true` or `false`. `true` puts the participant on hold, and `false` lets them rejoin the conference. - Hold *bool `json:"Hold,omitempty"` - // The URL we call using the `hold_method` for music that plays when the participant is on hold. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. - HoldUrl *string `json:"HoldUrl,omitempty"` - // The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. - HoldMethod *string `json:"HoldMethod,omitempty"` - // The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. - AnnounceUrl *string `json:"AnnounceUrl,omitempty"` - // The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. - AnnounceMethod *string `json:"AnnounceMethod,omitempty"` - // The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). - WaitUrl *string `json:"WaitUrl,omitempty"` - // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. - WaitMethod *string `json:"WaitMethod,omitempty"` - // Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. - BeepOnExit *bool `json:"BeepOnExit,omitempty"` - // Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. - EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` - // Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. - Coaching *bool `json:"Coaching,omitempty"` - // The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. - CallSidToCoach *string `json:"CallSidToCoach,omitempty"` -} - -func (params *UpdateParticipantParams) SetPathAccountSid(PathAccountSid string) *UpdateParticipantParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *UpdateParticipantParams) SetMuted(Muted bool) *UpdateParticipantParams { - params.Muted = &Muted - return params -} -func (params *UpdateParticipantParams) SetHold(Hold bool) *UpdateParticipantParams { - params.Hold = &Hold - return params -} -func (params *UpdateParticipantParams) SetHoldUrl(HoldUrl string) *UpdateParticipantParams { - params.HoldUrl = &HoldUrl - return params -} -func (params *UpdateParticipantParams) SetHoldMethod(HoldMethod string) *UpdateParticipantParams { - params.HoldMethod = &HoldMethod - return params -} -func (params *UpdateParticipantParams) SetAnnounceUrl(AnnounceUrl string) *UpdateParticipantParams { - params.AnnounceUrl = &AnnounceUrl - return params -} -func (params *UpdateParticipantParams) SetAnnounceMethod(AnnounceMethod string) *UpdateParticipantParams { - params.AnnounceMethod = &AnnounceMethod - return params -} -func (params *UpdateParticipantParams) SetWaitUrl(WaitUrl string) *UpdateParticipantParams { - params.WaitUrl = &WaitUrl - return params -} -func (params *UpdateParticipantParams) SetWaitMethod(WaitMethod string) *UpdateParticipantParams { - params.WaitMethod = &WaitMethod - return params -} -func (params *UpdateParticipantParams) SetBeepOnExit(BeepOnExit bool) *UpdateParticipantParams { - params.BeepOnExit = &BeepOnExit - return params -} -func (params *UpdateParticipantParams) SetEndConferenceOnExit(EndConferenceOnExit bool) *UpdateParticipantParams { - params.EndConferenceOnExit = &EndConferenceOnExit - return params -} -func (params *UpdateParticipantParams) SetCoaching(Coaching bool) *UpdateParticipantParams { - params.Coaching = &Coaching - return params -} -func (params *UpdateParticipantParams) SetCallSidToCoach(CallSidToCoach string) *UpdateParticipantParams { - params.CallSidToCoach = &CallSidToCoach - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Whether the participant should be muted. Can be `true` or `false`. `true` will mute the participant, and `false` will un-mute them. Anything value other than `true` or `false` is interpreted as `false`. + Muted *bool `json:"Muted,omitempty"` + // Whether the participant should be on hold. Can be: `true` or `false`. `true` puts the participant on hold, and `false` lets them rejoin the conference. + Hold *bool `json:"Hold,omitempty"` + // The URL we call using the `hold_method` for music that plays when the participant is on hold. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. + HoldUrl *string `json:"HoldUrl,omitempty"` + // The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. + HoldMethod *string `json:"HoldMethod,omitempty"` + // The URL we call using the `announce_method` for an announcement to the participant. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. + AnnounceUrl *string `json:"AnnounceUrl,omitempty"` + // The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. + AnnounceMethod *string `json:"AnnounceMethod,omitempty"` + // The URL we call using the `wait_method` for the music to play while participants are waiting for the conference to start. The URL may return an MP3 file, a WAV file, or a TwiML document that contains ``, ``, ``, or `` verbs. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + WaitUrl *string `json:"WaitUrl,omitempty"` + // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. + WaitMethod *string `json:"WaitMethod,omitempty"` + // Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. + BeepOnExit *bool `json:"BeepOnExit,omitempty"` + // Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. + EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` + // Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. + Coaching *bool `json:"Coaching,omitempty"` + // The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. + CallSidToCoach *string `json:"CallSidToCoach,omitempty"` +} + +func (params *UpdateParticipantParams) SetPathAccountSid(PathAccountSid string) (*UpdateParticipantParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *UpdateParticipantParams) SetMuted(Muted bool) (*UpdateParticipantParams){ + params.Muted = &Muted + return params +} +func (params *UpdateParticipantParams) SetHold(Hold bool) (*UpdateParticipantParams){ + params.Hold = &Hold + return params +} +func (params *UpdateParticipantParams) SetHoldUrl(HoldUrl string) (*UpdateParticipantParams){ + params.HoldUrl = &HoldUrl + return params +} +func (params *UpdateParticipantParams) SetHoldMethod(HoldMethod string) (*UpdateParticipantParams){ + params.HoldMethod = &HoldMethod + return params +} +func (params *UpdateParticipantParams) SetAnnounceUrl(AnnounceUrl string) (*UpdateParticipantParams){ + params.AnnounceUrl = &AnnounceUrl + return params +} +func (params *UpdateParticipantParams) SetAnnounceMethod(AnnounceMethod string) (*UpdateParticipantParams){ + params.AnnounceMethod = &AnnounceMethod + return params +} +func (params *UpdateParticipantParams) SetWaitUrl(WaitUrl string) (*UpdateParticipantParams){ + params.WaitUrl = &WaitUrl + return params +} +func (params *UpdateParticipantParams) SetWaitMethod(WaitMethod string) (*UpdateParticipantParams){ + params.WaitMethod = &WaitMethod + return params +} +func (params *UpdateParticipantParams) SetBeepOnExit(BeepOnExit bool) (*UpdateParticipantParams){ + params.BeepOnExit = &BeepOnExit + return params +} +func (params *UpdateParticipantParams) SetEndConferenceOnExit(EndConferenceOnExit bool) (*UpdateParticipantParams){ + params.EndConferenceOnExit = &EndConferenceOnExit + return params +} +func (params *UpdateParticipantParams) SetCoaching(Coaching bool) (*UpdateParticipantParams){ + params.Coaching = &Coaching + return params +} +func (params *UpdateParticipantParams) SetCallSidToCoach(CallSidToCoach string) (*UpdateParticipantParams){ + params.CallSidToCoach = &CallSidToCoach + return params } // Update the properties of the participant func (c *ApiService) UpdateParticipant(ConferenceSid string, CallSid string, params *UpdateParticipantParams) (*ApiV2010Participant, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Muted != nil { - data.Set("Muted", fmt.Sprint(*params.Muted)) - } - if params != nil && params.Hold != nil { - data.Set("Hold", fmt.Sprint(*params.Hold)) - } - if params != nil && params.HoldUrl != nil { - data.Set("HoldUrl", *params.HoldUrl) - } - if params != nil && params.HoldMethod != nil { - data.Set("HoldMethod", *params.HoldMethod) - } - if params != nil && params.AnnounceUrl != nil { - data.Set("AnnounceUrl", *params.AnnounceUrl) - } - if params != nil && params.AnnounceMethod != nil { - data.Set("AnnounceMethod", *params.AnnounceMethod) - } - if params != nil && params.WaitUrl != nil { - data.Set("WaitUrl", *params.WaitUrl) - } - if params != nil && params.WaitMethod != nil { - data.Set("WaitMethod", *params.WaitMethod) - } - if params != nil && params.BeepOnExit != nil { - data.Set("BeepOnExit", fmt.Sprint(*params.BeepOnExit)) - } - if params != nil && params.EndConferenceOnExit != nil { - data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) - } - if params != nil && params.Coaching != nil { - data.Set("Coaching", fmt.Sprint(*params.Coaching)) - } - if params != nil && params.CallSidToCoach != nil { - data.Set("CallSidToCoach", *params.CallSidToCoach) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Participant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Participants/{CallSid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Muted != nil { + data.Set("Muted", fmt.Sprint(*params.Muted)) + } + if params != nil && params.Hold != nil { + data.Set("Hold", fmt.Sprint(*params.Hold)) + } + if params != nil && params.HoldUrl != nil { + data.Set("HoldUrl", *params.HoldUrl) + } + if params != nil && params.HoldMethod != nil { + data.Set("HoldMethod", *params.HoldMethod) + } + if params != nil && params.AnnounceUrl != nil { + data.Set("AnnounceUrl", *params.AnnounceUrl) + } + if params != nil && params.AnnounceMethod != nil { + data.Set("AnnounceMethod", *params.AnnounceMethod) + } + if params != nil && params.WaitUrl != nil { + data.Set("WaitUrl", *params.WaitUrl) + } + if params != nil && params.WaitMethod != nil { + data.Set("WaitMethod", *params.WaitMethod) + } + if params != nil && params.BeepOnExit != nil { + data.Set("BeepOnExit", fmt.Sprint(*params.BeepOnExit)) + } + if params != nil && params.EndConferenceOnExit != nil { + data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) + } + if params != nil && params.Coaching != nil { + data.Set("Coaching", fmt.Sprint(*params.Coaching)) + } + if params != nil && params.CallSidToCoach != nil { + data.Set("CallSidToCoach", *params.CallSidToCoach) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Participant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_conferences_recordings.go b/rest/api/v2010/accounts_conferences_recordings.go index 4d0783ea1..c270a4949 100644 --- a/rest/api/v2010/accounts_conferences_recordings.go +++ b/rest/api/v2010/accounts_conferences_recordings.go @@ -18,181 +18,185 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteConferenceRecording' type DeleteConferenceRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) *DeleteConferenceRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) (*DeleteConferenceRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a recording from your account -func (c *ApiService) DeleteConferenceRecording(ConferenceSid string, Sid string, params *DeleteConferenceRecordingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteConferenceRecording(ConferenceSid string, Sid string, params *DeleteConferenceRecordingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchConferenceRecording' type FetchConferenceRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) *FetchConferenceRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) (*FetchConferenceRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a recording for a call func (c *ApiService) FetchConferenceRecording(ConferenceSid string, Sid string, params *FetchConferenceRecordingParams) (*ApiV2010ConferenceRecording, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010ConferenceRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010ConferenceRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConferenceRecording' type ListConferenceRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. - DateCreated *string `json:"DateCreated,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. - DateCreatedBefore *string `json:"DateCreated<,omitempty"` - // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. - DateCreatedAfter *string `json:"DateCreated>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. + DateCreated *string `json:"DateCreated,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. + DateCreatedBefore *string `json:"DateCreated<,omitempty"` + // The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. + DateCreatedAfter *string `json:"DateCreated>,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) *ListConferenceRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) (*ListConferenceRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListConferenceRecordingParams) SetDateCreated(DateCreated string) *ListConferenceRecordingParams { - params.DateCreated = &DateCreated - return params +func (params *ListConferenceRecordingParams) SetDateCreated(DateCreated string) (*ListConferenceRecordingParams){ + params.DateCreated = &DateCreated + return params } -func (params *ListConferenceRecordingParams) SetDateCreatedBefore(DateCreatedBefore string) *ListConferenceRecordingParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListConferenceRecordingParams) SetDateCreatedBefore(DateCreatedBefore string) (*ListConferenceRecordingParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListConferenceRecordingParams) SetDateCreatedAfter(DateCreatedAfter string) *ListConferenceRecordingParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListConferenceRecordingParams) SetDateCreatedAfter(DateCreatedAfter string) (*ListConferenceRecordingParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListConferenceRecordingParams) SetPageSize(PageSize int) *ListConferenceRecordingParams { - params.PageSize = &PageSize - return params +func (params *ListConferenceRecordingParams) SetPageSize(PageSize int) (*ListConferenceRecordingParams){ + params.PageSize = &PageSize + return params } -func (params *ListConferenceRecordingParams) SetLimit(Limit int) *ListConferenceRecordingParams { - params.Limit = &Limit - return params +func (params *ListConferenceRecordingParams) SetLimit(Limit int) (*ListConferenceRecordingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConferenceRecording records from the API. Request is executed immediately. -func (c *ApiService) PageConferenceRecording(ConferenceSid string, params *ListConferenceRecordingParams, pageToken, pageNumber string) (*ListConferenceRecordingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint(*params.DateCreated)) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreated<", fmt.Sprint(*params.DateCreatedBefore)) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreated>", fmt.Sprint(*params.DateCreatedAfter)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } +func (c *ApiService) PageConferenceRecording(ConferenceSid string, params *ListConferenceRecordingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings.json" - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint(*params.DateCreated)) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreated<", fmt.Sprint(*params.DateCreatedBefore)) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreated>", fmt.Sprint(*params.DateCreatedAfter)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists ConferenceRecording records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListConferenceRecording(ConferenceSid string, params *ListConferenceRecordingParams) ([]ApiV2010ConferenceRecording, error) { +func (c *ApiService) ListConferenceRecording(ConferenceSid string, params *ListConferenceRecordingParams) (ListConferenceRecording200Response, error) { response, errors := c.StreamConferenceRecording(ConferenceSid, params) - records := make([]ApiV2010ConferenceRecording, 0) + records := make(ListConferenceRecording200Response, 0) for record := range response { records = append(records, record) } @@ -205,13 +209,13 @@ func (c *ApiService) ListConferenceRecording(ConferenceSid string, params *ListC } // Streams ConferenceRecording records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamConferenceRecording(ConferenceSid string, params *ListConferenceRecordingParams) (chan ApiV2010ConferenceRecording, chan error) { +func (c *ApiService) StreamConferenceRecording(ConferenceSid string, params *ListConferenceRecordingParams) (chan ListConferenceRecording200Response, chan error) { if params == nil { params = &ListConferenceRecordingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010ConferenceRecording, 1) + recordChannel := make(chan ListConferenceRecording200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageConferenceRecording(ConferenceSid, params, "", "") @@ -226,11 +230,12 @@ func (c *ApiService) StreamConferenceRecording(ConferenceSid string, params *Lis return recordChannel, errorChannel } -func (c *ApiService) streamConferenceRecording(response *ListConferenceRecordingResponse, params *ListConferenceRecordingParams, recordChannel chan ApiV2010ConferenceRecording, errorChannel chan error) { + +func (c *ApiService) streamConferenceRecording(response *, params *ListConferenceRecordingParams, recordChannel chan ListConferenceRecording200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Recordings + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -241,7 +246,7 @@ func (c *ApiService) streamConferenceRecording(response *ListConferenceRecording } } - record, err := client.GetNext(c.baseURL, response, c.getNextListConferenceRecordingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -249,86 +254,88 @@ func (c *ApiService) streamConferenceRecording(response *ListConferenceRecording break } - response = record.(*ListConferenceRecordingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListConferenceRecordingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConferenceRecording' type UpdateConferenceRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - Status *string `json:"Status,omitempty"` - // Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. - PauseBehavior *string `json:"PauseBehavior,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + Status *string `json:"Status,omitempty"` + // Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. + PauseBehavior *string `json:"PauseBehavior,omitempty"` } -func (params *UpdateConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) *UpdateConferenceRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateConferenceRecordingParams) SetPathAccountSid(PathAccountSid string) (*UpdateConferenceRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateConferenceRecordingParams) SetStatus(Status string) *UpdateConferenceRecordingParams { - params.Status = &Status - return params +func (params *UpdateConferenceRecordingParams) SetStatus(Status string) (*UpdateConferenceRecordingParams){ + params.Status = &Status + return params } -func (params *UpdateConferenceRecordingParams) SetPauseBehavior(PauseBehavior string) *UpdateConferenceRecordingParams { - params.PauseBehavior = &PauseBehavior - return params +func (params *UpdateConferenceRecordingParams) SetPauseBehavior(PauseBehavior string) (*UpdateConferenceRecordingParams){ + params.PauseBehavior = &PauseBehavior + return params } // Changes the status of the recording to paused, stopped, or in-progress. Note: To use `Twilio.CURRENT`, pass it as recording sid. func (c *ApiService) UpdateConferenceRecording(ConferenceSid string, Sid string, params *UpdateConferenceRecordingParams) (*ApiV2010ConferenceRecording, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Conferences/{ConferenceSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PauseBehavior != nil { - data.Set("PauseBehavior", *params.PauseBehavior) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PauseBehavior != nil { + data.Set("PauseBehavior", *params.PauseBehavior) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010ConferenceRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010ConferenceRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_connect_apps.go b/rest/api/v2010/accounts_connect_apps.go index f37ece34c..d78e86183 100644 --- a/rest/api/v2010/accounts_connect_apps.go +++ b/rest/api/v2010/accounts_connect_apps.go @@ -18,151 +18,155 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteConnectApp' type DeleteConnectAppParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteConnectAppParams) SetPathAccountSid(PathAccountSid string) *DeleteConnectAppParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteConnectAppParams) SetPathAccountSid(PathAccountSid string) (*DeleteConnectAppParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete an instance of a connect-app -func (c *ApiService) DeleteConnectApp(Sid string, params *DeleteConnectAppParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteConnectApp(Sid string, params *DeleteConnectAppParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchConnectApp' type FetchConnectAppParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchConnectAppParams) SetPathAccountSid(PathAccountSid string) *FetchConnectAppParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchConnectAppParams) SetPathAccountSid(PathAccountSid string) (*FetchConnectAppParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a connect-app func (c *ApiService) FetchConnectApp(Sid string, params *FetchConnectAppParams) (*ApiV2010ConnectApp, error) { - path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010ConnectApp{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ApiV2010ConnectApp{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConnectApp' type ListConnectAppParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConnectAppParams) SetPathAccountSid(PathAccountSid string) *ListConnectAppParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListConnectAppParams) SetPathAccountSid(PathAccountSid string) (*ListConnectAppParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListConnectAppParams) SetPageSize(PageSize int) *ListConnectAppParams { - params.PageSize = &PageSize - return params +func (params *ListConnectAppParams) SetPageSize(PageSize int) (*ListConnectAppParams){ + params.PageSize = &PageSize + return params } -func (params *ListConnectAppParams) SetLimit(Limit int) *ListConnectAppParams { - params.Limit = &Limit - return params +func (params *ListConnectAppParams) SetLimit(Limit int) (*ListConnectAppParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConnectApp records from the API. Request is executed immediately. -func (c *ApiService) PageConnectApp(params *ListConnectAppParams, pageToken, pageNumber string) (*ListConnectAppResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps.json" +func (c *ApiService) PageConnectApp(params *ListConnectAppParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConnectAppResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConnectApp records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListConnectApp(params *ListConnectAppParams) ([]ApiV2010ConnectApp, error) { +func (c *ApiService) ListConnectApp(params *ListConnectAppParams) (ListConnectApp200Response, error) { response, errors := c.StreamConnectApp(params) - records := make([]ApiV2010ConnectApp, 0) + records := make(ListConnectApp200Response, 0) for record := range response { records = append(records, record) } @@ -175,13 +179,13 @@ func (c *ApiService) ListConnectApp(params *ListConnectAppParams) ([]ApiV2010Con } // Streams ConnectApp records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamConnectApp(params *ListConnectAppParams) (chan ApiV2010ConnectApp, chan error) { +func (c *ApiService) StreamConnectApp(params *ListConnectAppParams) (chan ListConnectApp200Response, chan error) { if params == nil { params = &ListConnectAppParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010ConnectApp, 1) + recordChannel := make(chan ListConnectApp200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageConnectApp(params, "", "") @@ -196,11 +200,12 @@ func (c *ApiService) StreamConnectApp(params *ListConnectAppParams) (chan ApiV20 return recordChannel, errorChannel } -func (c *ApiService) streamConnectApp(response *ListConnectAppResponse, params *ListConnectAppParams, recordChannel chan ApiV2010ConnectApp, errorChannel chan error) { + +func (c *ApiService) streamConnectApp(response *, params *ListConnectAppParams, recordChannel chan ListConnectApp200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.ConnectApps + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -211,7 +216,7 @@ func (c *ApiService) streamConnectApp(response *ListConnectAppResponse, params * } } - record, err := client.GetNext(c.baseURL, response, c.getNextListConnectAppResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -219,141 +224,143 @@ func (c *ApiService) streamConnectApp(response *ListConnectAppResponse, params * break } - response = record.(*ListConnectAppResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListConnectAppResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConnectAppResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConnectApp' type UpdateConnectAppParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The URL to redirect the user to after we authenticate the user and obtain authorization to access the Connect App. - AuthorizeRedirectUrl *string `json:"AuthorizeRedirectUrl,omitempty"` - // The company name to set for the Connect App. - CompanyName *string `json:"CompanyName,omitempty"` - // The HTTP method to use when calling `deauthorize_callback_url`. - DeauthorizeCallbackMethod *string `json:"DeauthorizeCallbackMethod,omitempty"` - // The URL to call using the `deauthorize_callback_method` to de-authorize the Connect App. - DeauthorizeCallbackUrl *string `json:"DeauthorizeCallbackUrl,omitempty"` - // A description of the Connect App. - Description *string `json:"Description,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // A public URL where users can obtain more information about this Connect App. - HomepageUrl *string `json:"HomepageUrl,omitempty"` - // A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. - Permissions *[]string `json:"Permissions,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The URL to redirect the user to after we authenticate the user and obtain authorization to access the Connect App. + AuthorizeRedirectUrl *string `json:"AuthorizeRedirectUrl,omitempty"` + // The company name to set for the Connect App. + CompanyName *string `json:"CompanyName,omitempty"` + // The HTTP method to use when calling `deauthorize_callback_url`. + DeauthorizeCallbackMethod *string `json:"DeauthorizeCallbackMethod,omitempty"` + // The URL to call using the `deauthorize_callback_method` to de-authorize the Connect App. + DeauthorizeCallbackUrl *string `json:"DeauthorizeCallbackUrl,omitempty"` + // A description of the Connect App. + Description *string `json:"Description,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // A public URL where users can obtain more information about this Connect App. + HomepageUrl *string `json:"HomepageUrl,omitempty"` + // A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. + Permissions *[]string `json:"Permissions,omitempty"` } -func (params *UpdateConnectAppParams) SetPathAccountSid(PathAccountSid string) *UpdateConnectAppParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateConnectAppParams) SetPathAccountSid(PathAccountSid string) (*UpdateConnectAppParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateConnectAppParams) SetAuthorizeRedirectUrl(AuthorizeRedirectUrl string) *UpdateConnectAppParams { - params.AuthorizeRedirectUrl = &AuthorizeRedirectUrl - return params +func (params *UpdateConnectAppParams) SetAuthorizeRedirectUrl(AuthorizeRedirectUrl string) (*UpdateConnectAppParams){ + params.AuthorizeRedirectUrl = &AuthorizeRedirectUrl + return params } -func (params *UpdateConnectAppParams) SetCompanyName(CompanyName string) *UpdateConnectAppParams { - params.CompanyName = &CompanyName - return params +func (params *UpdateConnectAppParams) SetCompanyName(CompanyName string) (*UpdateConnectAppParams){ + params.CompanyName = &CompanyName + return params } -func (params *UpdateConnectAppParams) SetDeauthorizeCallbackMethod(DeauthorizeCallbackMethod string) *UpdateConnectAppParams { - params.DeauthorizeCallbackMethod = &DeauthorizeCallbackMethod - return params +func (params *UpdateConnectAppParams) SetDeauthorizeCallbackMethod(DeauthorizeCallbackMethod string) (*UpdateConnectAppParams){ + params.DeauthorizeCallbackMethod = &DeauthorizeCallbackMethod + return params } -func (params *UpdateConnectAppParams) SetDeauthorizeCallbackUrl(DeauthorizeCallbackUrl string) *UpdateConnectAppParams { - params.DeauthorizeCallbackUrl = &DeauthorizeCallbackUrl - return params +func (params *UpdateConnectAppParams) SetDeauthorizeCallbackUrl(DeauthorizeCallbackUrl string) (*UpdateConnectAppParams){ + params.DeauthorizeCallbackUrl = &DeauthorizeCallbackUrl + return params } -func (params *UpdateConnectAppParams) SetDescription(Description string) *UpdateConnectAppParams { - params.Description = &Description - return params +func (params *UpdateConnectAppParams) SetDescription(Description string) (*UpdateConnectAppParams){ + params.Description = &Description + return params } -func (params *UpdateConnectAppParams) SetFriendlyName(FriendlyName string) *UpdateConnectAppParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateConnectAppParams) SetFriendlyName(FriendlyName string) (*UpdateConnectAppParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateConnectAppParams) SetHomepageUrl(HomepageUrl string) *UpdateConnectAppParams { - params.HomepageUrl = &HomepageUrl - return params +func (params *UpdateConnectAppParams) SetHomepageUrl(HomepageUrl string) (*UpdateConnectAppParams){ + params.HomepageUrl = &HomepageUrl + return params } -func (params *UpdateConnectAppParams) SetPermissions(Permissions []string) *UpdateConnectAppParams { - params.Permissions = &Permissions - return params +func (params *UpdateConnectAppParams) SetPermissions(Permissions []string) (*UpdateConnectAppParams){ + params.Permissions = &Permissions + return params } // Update a connect-app with the specified parameters func (c *ApiService) UpdateConnectApp(Sid string, params *UpdateConnectAppParams) (*ApiV2010ConnectApp, error) { - path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AuthorizeRedirectUrl != nil { - data.Set("AuthorizeRedirectUrl", *params.AuthorizeRedirectUrl) - } - if params != nil && params.CompanyName != nil { - data.Set("CompanyName", *params.CompanyName) - } - if params != nil && params.DeauthorizeCallbackMethod != nil { - data.Set("DeauthorizeCallbackMethod", *params.DeauthorizeCallbackMethod) - } - if params != nil && params.DeauthorizeCallbackUrl != nil { - data.Set("DeauthorizeCallbackUrl", *params.DeauthorizeCallbackUrl) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.HomepageUrl != nil { - data.Set("HomepageUrl", *params.HomepageUrl) - } - if params != nil && params.Permissions != nil { - for _, item := range *params.Permissions { - data.Add("Permissions", item) - } - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010ConnectApp{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/ConnectApps/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AuthorizeRedirectUrl != nil { + data.Set("AuthorizeRedirectUrl", *params.AuthorizeRedirectUrl) + } + if params != nil && params.CompanyName != nil { + data.Set("CompanyName", *params.CompanyName) + } + if params != nil && params.DeauthorizeCallbackMethod != nil { + data.Set("DeauthorizeCallbackMethod", *params.DeauthorizeCallbackMethod) + } + if params != nil && params.DeauthorizeCallbackUrl != nil { + data.Set("DeauthorizeCallbackUrl", *params.DeauthorizeCallbackUrl) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.HomepageUrl != nil { + data.Set("HomepageUrl", *params.HomepageUrl) + } + if params != nil && params.Permissions != nil { + for _, item := range *params.Permissions { + data.Add("Permissions", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010ConnectApp{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_incoming_phone_numbers.go b/rest/api/v2010/accounts_incoming_phone_numbers.go index a97f6e225..1fea7ebcf 100644 --- a/rest/api/v2010/accounts_incoming_phone_numbers.go +++ b/rest/api/v2010/accounts_incoming_phone_numbers.go @@ -18,442 +18,447 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIncomingPhoneNumber' type CreateIncomingPhoneNumberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. - ApiVersion *string `json:"ApiVersion,omitempty"` - // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the new phone number. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. - SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` - // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL we should call when the new phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` - // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // - EmergencyStatus *string `json:"EmergencyStatus,omitempty"` - // The SID of the emergency address configuration to use for emergency calling from the new phone number. - EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` - // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - TrunkSid *string `json:"TrunkSid,omitempty"` - // The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. - IdentitySid *string `json:"IdentitySid,omitempty"` - // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. - AddressSid *string `json:"AddressSid,omitempty"` - // - VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - BundleSid *string `json:"BundleSid,omitempty"` - // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // The desired area code for your new incoming phone number. Can be any three-digit, US or Canada area code. We will provision an available phone number within this area code for you. **You must provide an `area_code` or a `phone_number`.** (US and Canada only). - AreaCode *string `json:"AreaCode,omitempty"` -} - -func (params *CreateIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) *CreateIncomingPhoneNumberParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetApiVersion(ApiVersion string) *CreateIncomingPhoneNumberParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *CreateIncomingPhoneNumberParams) SetFriendlyName(FriendlyName string) *CreateIncomingPhoneNumberParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateIncomingPhoneNumberParams) SetSmsApplicationSid(SmsApplicationSid string) *CreateIncomingPhoneNumberParams { - params.SmsApplicationSid = &SmsApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetSmsFallbackMethod(SmsFallbackMethod string) *CreateIncomingPhoneNumberParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberParams) SetSmsFallbackUrl(SmsFallbackUrl string) *CreateIncomingPhoneNumberParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberParams) SetSmsMethod(SmsMethod string) *CreateIncomingPhoneNumberParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *CreateIncomingPhoneNumberParams) SetSmsUrl(SmsUrl string) *CreateIncomingPhoneNumberParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *CreateIncomingPhoneNumberParams) SetStatusCallback(StatusCallback string) *CreateIncomingPhoneNumberParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateIncomingPhoneNumberParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateIncomingPhoneNumberParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceApplicationSid(VoiceApplicationSid string) *CreateIncomingPhoneNumberParams { - params.VoiceApplicationSid = &VoiceApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *CreateIncomingPhoneNumberParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateIncomingPhoneNumberParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateIncomingPhoneNumberParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceMethod(VoiceMethod string) *CreateIncomingPhoneNumberParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceUrl(VoiceUrl string) *CreateIncomingPhoneNumberParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateIncomingPhoneNumberParams) SetEmergencyStatus(EmergencyStatus string) *CreateIncomingPhoneNumberParams { - params.EmergencyStatus = &EmergencyStatus - return params -} -func (params *CreateIncomingPhoneNumberParams) SetEmergencyAddressSid(EmergencyAddressSid string) *CreateIncomingPhoneNumberParams { - params.EmergencyAddressSid = &EmergencyAddressSid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetTrunkSid(TrunkSid string) *CreateIncomingPhoneNumberParams { - params.TrunkSid = &TrunkSid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetIdentitySid(IdentitySid string) *CreateIncomingPhoneNumberParams { - params.IdentitySid = &IdentitySid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetAddressSid(AddressSid string) *CreateIncomingPhoneNumberParams { - params.AddressSid = &AddressSid - return params -} -func (params *CreateIncomingPhoneNumberParams) SetVoiceReceiveMode(VoiceReceiveMode string) *CreateIncomingPhoneNumberParams { - params.VoiceReceiveMode = &VoiceReceiveMode - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. + ApiVersion *string `json:"ApiVersion,omitempty"` + // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the new phone number. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. + SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` + // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL we should call when the new phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` + // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // + EmergencyStatus *string `json:"EmergencyStatus,omitempty"` + // The SID of the emergency address configuration to use for emergency calling from the new phone number. + EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` + // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + TrunkSid *string `json:"TrunkSid,omitempty"` + // The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. + IdentitySid *string `json:"IdentitySid,omitempty"` + // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. + AddressSid *string `json:"AddressSid,omitempty"` + // + VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + BundleSid *string `json:"BundleSid,omitempty"` + // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The desired area code for your new incoming phone number. Can be any three-digit, US or Canada area code. We will provision an available phone number within this area code for you. **You must provide an `area_code` or a `phone_number`.** (US and Canada only). + AreaCode *string `json:"AreaCode,omitempty"` +} + +func (params *CreateIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) (*CreateIncomingPhoneNumberParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetApiVersion(ApiVersion string) (*CreateIncomingPhoneNumberParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *CreateIncomingPhoneNumberParams) SetFriendlyName(FriendlyName string) (*CreateIncomingPhoneNumberParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateIncomingPhoneNumberParams) SetSmsApplicationSid(SmsApplicationSid string) (*CreateIncomingPhoneNumberParams){ + params.SmsApplicationSid = &SmsApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*CreateIncomingPhoneNumberParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*CreateIncomingPhoneNumberParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberParams) SetSmsMethod(SmsMethod string) (*CreateIncomingPhoneNumberParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *CreateIncomingPhoneNumberParams) SetSmsUrl(SmsUrl string) (*CreateIncomingPhoneNumberParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *CreateIncomingPhoneNumberParams) SetStatusCallback(StatusCallback string) (*CreateIncomingPhoneNumberParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateIncomingPhoneNumberParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateIncomingPhoneNumberParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceApplicationSid(VoiceApplicationSid string) (*CreateIncomingPhoneNumberParams){ + params.VoiceApplicationSid = &VoiceApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*CreateIncomingPhoneNumberParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateIncomingPhoneNumberParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateIncomingPhoneNumberParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceMethod(VoiceMethod string) (*CreateIncomingPhoneNumberParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceUrl(VoiceUrl string) (*CreateIncomingPhoneNumberParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateIncomingPhoneNumberParams) SetEmergencyStatus(EmergencyStatus string) (*CreateIncomingPhoneNumberParams){ + params.EmergencyStatus = &EmergencyStatus + return params +} +func (params *CreateIncomingPhoneNumberParams) SetEmergencyAddressSid(EmergencyAddressSid string) (*CreateIncomingPhoneNumberParams){ + params.EmergencyAddressSid = &EmergencyAddressSid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetTrunkSid(TrunkSid string) (*CreateIncomingPhoneNumberParams){ + params.TrunkSid = &TrunkSid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetIdentitySid(IdentitySid string) (*CreateIncomingPhoneNumberParams){ + params.IdentitySid = &IdentitySid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetAddressSid(AddressSid string) (*CreateIncomingPhoneNumberParams){ + params.AddressSid = &AddressSid + return params +} +func (params *CreateIncomingPhoneNumberParams) SetVoiceReceiveMode(VoiceReceiveMode string) (*CreateIncomingPhoneNumberParams){ + params.VoiceReceiveMode = &VoiceReceiveMode + return params } -func (params *CreateIncomingPhoneNumberParams) SetBundleSid(BundleSid string) *CreateIncomingPhoneNumberParams { - params.BundleSid = &BundleSid - return params +func (params *CreateIncomingPhoneNumberParams) SetBundleSid(BundleSid string) (*CreateIncomingPhoneNumberParams){ + params.BundleSid = &BundleSid + return params } -func (params *CreateIncomingPhoneNumberParams) SetPhoneNumber(PhoneNumber string) *CreateIncomingPhoneNumberParams { - params.PhoneNumber = &PhoneNumber - return params +func (params *CreateIncomingPhoneNumberParams) SetPhoneNumber(PhoneNumber string) (*CreateIncomingPhoneNumberParams){ + params.PhoneNumber = &PhoneNumber + return params } -func (params *CreateIncomingPhoneNumberParams) SetAreaCode(AreaCode string) *CreateIncomingPhoneNumberParams { - params.AreaCode = &AreaCode - return params +func (params *CreateIncomingPhoneNumberParams) SetAreaCode(AreaCode string) (*CreateIncomingPhoneNumberParams){ + params.AreaCode = &AreaCode + return params } // Purchase a phone-number for the account. func (c *ApiService) CreateIncomingPhoneNumber(params *CreateIncomingPhoneNumberParams) (*ApiV2010IncomingPhoneNumber, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SmsApplicationSid != nil { - data.Set("SmsApplicationSid", *params.SmsApplicationSid) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceApplicationSid != nil { - data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.EmergencyStatus != nil { - data.Set("EmergencyStatus", *params.EmergencyStatus) - } - if params != nil && params.EmergencyAddressSid != nil { - data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) - } - if params != nil && params.TrunkSid != nil { - data.Set("TrunkSid", *params.TrunkSid) - } - if params != nil && params.IdentitySid != nil { - data.Set("IdentitySid", *params.IdentitySid) - } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.VoiceReceiveMode != nil { - data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) - } - if params != nil && params.BundleSid != nil { - data.Set("BundleSid", *params.BundleSid) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.AreaCode != nil { - data.Set("AreaCode", *params.AreaCode) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010IncomingPhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SmsApplicationSid != nil { + data.Set("SmsApplicationSid", *params.SmsApplicationSid) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceApplicationSid != nil { + data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.EmergencyStatus != nil { + data.Set("EmergencyStatus", *params.EmergencyStatus) + } + if params != nil && params.EmergencyAddressSid != nil { + data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) + } + if params != nil && params.TrunkSid != nil { + data.Set("TrunkSid", *params.TrunkSid) + } + if params != nil && params.IdentitySid != nil { + data.Set("IdentitySid", *params.IdentitySid) + } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.VoiceReceiveMode != nil { + data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) + } + if params != nil && params.BundleSid != nil { + data.Set("BundleSid", *params.BundleSid) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.AreaCode != nil { + data.Set("AreaCode", *params.AreaCode) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010IncomingPhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteIncomingPhoneNumber' type DeleteIncomingPhoneNumberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) *DeleteIncomingPhoneNumberParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) (*DeleteIncomingPhoneNumberParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a phone-numbers belonging to the account used to make the request. -func (c *ApiService) DeleteIncomingPhoneNumber(Sid string, params *DeleteIncomingPhoneNumberParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteIncomingPhoneNumber(Sid string, params *DeleteIncomingPhoneNumberParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchIncomingPhoneNumber' type FetchIncomingPhoneNumberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) *FetchIncomingPhoneNumberParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) (*FetchIncomingPhoneNumberParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an incoming-phone-number belonging to the account used to make the request. func (c *ApiService) FetchIncomingPhoneNumber(Sid string, params *FetchIncomingPhoneNumberParams) (*ApiV2010IncomingPhoneNumber, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010IncomingPhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010IncomingPhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListIncomingPhoneNumber' type ListIncomingPhoneNumberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // A string that identifies the IncomingPhoneNumber resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. - Origin *string `json:"Origin,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) *ListIncomingPhoneNumberParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListIncomingPhoneNumberParams) SetBeta(Beta bool) *ListIncomingPhoneNumberParams { - params.Beta = &Beta - return params -} -func (params *ListIncomingPhoneNumberParams) SetFriendlyName(FriendlyName string) *ListIncomingPhoneNumberParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListIncomingPhoneNumberParams) SetPhoneNumber(PhoneNumber string) *ListIncomingPhoneNumberParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *ListIncomingPhoneNumberParams) SetOrigin(Origin string) *ListIncomingPhoneNumberParams { - params.Origin = &Origin - return params -} -func (params *ListIncomingPhoneNumberParams) SetPageSize(PageSize int) *ListIncomingPhoneNumberParams { - params.PageSize = &PageSize - return params -} -func (params *ListIncomingPhoneNumberParams) SetLimit(Limit int) *ListIncomingPhoneNumberParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // A string that identifies the IncomingPhoneNumber resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. + Origin *string `json:"Origin,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) (*ListIncomingPhoneNumberParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListIncomingPhoneNumberParams) SetBeta(Beta bool) (*ListIncomingPhoneNumberParams){ + params.Beta = &Beta + return params +} +func (params *ListIncomingPhoneNumberParams) SetFriendlyName(FriendlyName string) (*ListIncomingPhoneNumberParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListIncomingPhoneNumberParams) SetPhoneNumber(PhoneNumber string) (*ListIncomingPhoneNumberParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *ListIncomingPhoneNumberParams) SetOrigin(Origin string) (*ListIncomingPhoneNumberParams){ + params.Origin = &Origin + return params +} +func (params *ListIncomingPhoneNumberParams) SetPageSize(PageSize int) (*ListIncomingPhoneNumberParams){ + params.PageSize = &PageSize + return params +} +func (params *ListIncomingPhoneNumberParams) SetLimit(Limit int) (*ListIncomingPhoneNumberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IncomingPhoneNumber records from the API. Request is executed immediately. -func (c *ApiService) PageIncomingPhoneNumber(params *ListIncomingPhoneNumberParams, pageToken, pageNumber string) (*ListIncomingPhoneNumberResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.Origin != nil { - data.Set("Origin", *params.Origin) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIncomingPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageIncomingPhoneNumber(params *ListIncomingPhoneNumberParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.Origin != nil { + data.Set("Origin", *params.Origin) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists IncomingPhoneNumber records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListIncomingPhoneNumber(params *ListIncomingPhoneNumberParams) ([]ApiV2010IncomingPhoneNumber, error) { +func (c *ApiService) ListIncomingPhoneNumber(params *ListIncomingPhoneNumberParams) (ListIncomingPhoneNumber200Response, error) { response, errors := c.StreamIncomingPhoneNumber(params) - records := make([]ApiV2010IncomingPhoneNumber, 0) + records := make(ListIncomingPhoneNumber200Response, 0) for record := range response { records = append(records, record) } @@ -466,13 +471,13 @@ func (c *ApiService) ListIncomingPhoneNumber(params *ListIncomingPhoneNumberPara } // Streams IncomingPhoneNumber records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamIncomingPhoneNumber(params *ListIncomingPhoneNumberParams) (chan ApiV2010IncomingPhoneNumber, chan error) { +func (c *ApiService) StreamIncomingPhoneNumber(params *ListIncomingPhoneNumberParams) (chan ListIncomingPhoneNumber200Response, chan error) { if params == nil { params = &ListIncomingPhoneNumberParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010IncomingPhoneNumber, 1) + recordChannel := make(chan ListIncomingPhoneNumber200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageIncomingPhoneNumber(params, "", "") @@ -487,11 +492,12 @@ func (c *ApiService) StreamIncomingPhoneNumber(params *ListIncomingPhoneNumberPa return recordChannel, errorChannel } -func (c *ApiService) streamIncomingPhoneNumber(response *ListIncomingPhoneNumberResponse, params *ListIncomingPhoneNumberParams, recordChannel chan ApiV2010IncomingPhoneNumber, errorChannel chan error) { + +func (c *ApiService) streamIncomingPhoneNumber(response *, params *ListIncomingPhoneNumberParams, recordChannel chan ListIncomingPhoneNumber200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IncomingPhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -502,7 +508,7 @@ func (c *ApiService) streamIncomingPhoneNumber(response *ListIncomingPhoneNumber } } - record, err := client.GetNext(c.baseURL, response, c.getNextListIncomingPhoneNumberResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -510,274 +516,276 @@ func (c *ApiService) streamIncomingPhoneNumber(response *ListIncomingPhoneNumber break } - response = record.(*ListIncomingPhoneNumberResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListIncomingPhoneNumberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIncomingPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateIncomingPhoneNumber' type UpdateIncomingPhoneNumberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers). - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers). - AccountSid *string `json:"AccountSid,omitempty"` - // The API version to use for incoming calls made to the phone number. The default is `2010-04-01`. - ApiVersion *string `json:"ApiVersion,omitempty"` - // A descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the application that should handle SMS messages sent to the number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. - SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` - // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL we should call when the phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The SID of the application we should use to handle phone calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` - // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call to answer a call to the phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // - EmergencyStatus *string `json:"EmergencyStatus,omitempty"` - // The SID of the emergency address configuration to use for emergency calling from this phone number. - EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` - // The SID of the Trunk we should use to handle phone calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - TrunkSid *string `json:"TrunkSid,omitempty"` - // - VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` - // The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations. - IdentitySid *string `json:"IdentitySid,omitempty"` - // The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations. - AddressSid *string `json:"AddressSid,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - BundleSid *string `json:"BundleSid,omitempty"` -} - -func (params *UpdateIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) *UpdateIncomingPhoneNumberParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetAccountSid(AccountSid string) *UpdateIncomingPhoneNumberParams { - params.AccountSid = &AccountSid - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetApiVersion(ApiVersion string) *UpdateIncomingPhoneNumberParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetFriendlyName(FriendlyName string) *UpdateIncomingPhoneNumberParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetSmsApplicationSid(SmsApplicationSid string) *UpdateIncomingPhoneNumberParams { - params.SmsApplicationSid = &SmsApplicationSid - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetSmsFallbackMethod(SmsFallbackMethod string) *UpdateIncomingPhoneNumberParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetSmsFallbackUrl(SmsFallbackUrl string) *UpdateIncomingPhoneNumberParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetSmsMethod(SmsMethod string) *UpdateIncomingPhoneNumberParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetSmsUrl(SmsUrl string) *UpdateIncomingPhoneNumberParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetStatusCallback(StatusCallback string) *UpdateIncomingPhoneNumberParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateIncomingPhoneNumberParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceApplicationSid(VoiceApplicationSid string) *UpdateIncomingPhoneNumberParams { - params.VoiceApplicationSid = &VoiceApplicationSid - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *UpdateIncomingPhoneNumberParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *UpdateIncomingPhoneNumberParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *UpdateIncomingPhoneNumberParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceMethod(VoiceMethod string) *UpdateIncomingPhoneNumberParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceUrl(VoiceUrl string) *UpdateIncomingPhoneNumberParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetEmergencyStatus(EmergencyStatus string) *UpdateIncomingPhoneNumberParams { - params.EmergencyStatus = &EmergencyStatus - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetEmergencyAddressSid(EmergencyAddressSid string) *UpdateIncomingPhoneNumberParams { - params.EmergencyAddressSid = &EmergencyAddressSid - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetTrunkSid(TrunkSid string) *UpdateIncomingPhoneNumberParams { - params.TrunkSid = &TrunkSid - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetVoiceReceiveMode(VoiceReceiveMode string) *UpdateIncomingPhoneNumberParams { - params.VoiceReceiveMode = &VoiceReceiveMode - return params -} -func (params *UpdateIncomingPhoneNumberParams) SetIdentitySid(IdentitySid string) *UpdateIncomingPhoneNumberParams { - params.IdentitySid = &IdentitySid - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers). + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers). + AccountSid *string `json:"AccountSid,omitempty"` + // The API version to use for incoming calls made to the phone number. The default is `2010-04-01`. + ApiVersion *string `json:"ApiVersion,omitempty"` + // A descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the application that should handle SMS messages sent to the number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. + SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` + // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL we should call when the phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The SID of the application we should use to handle phone calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` + // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call to answer a call to the phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // + EmergencyStatus *string `json:"EmergencyStatus,omitempty"` + // The SID of the emergency address configuration to use for emergency calling from this phone number. + EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` + // The SID of the Trunk we should use to handle phone calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + TrunkSid *string `json:"TrunkSid,omitempty"` + // + VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` + // The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations. + IdentitySid *string `json:"IdentitySid,omitempty"` + // The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations. + AddressSid *string `json:"AddressSid,omitempty"` + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + BundleSid *string `json:"BundleSid,omitempty"` +} + +func (params *UpdateIncomingPhoneNumberParams) SetPathAccountSid(PathAccountSid string) (*UpdateIncomingPhoneNumberParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetAccountSid(AccountSid string) (*UpdateIncomingPhoneNumberParams){ + params.AccountSid = &AccountSid + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetApiVersion(ApiVersion string) (*UpdateIncomingPhoneNumberParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetFriendlyName(FriendlyName string) (*UpdateIncomingPhoneNumberParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetSmsApplicationSid(SmsApplicationSid string) (*UpdateIncomingPhoneNumberParams){ + params.SmsApplicationSid = &SmsApplicationSid + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*UpdateIncomingPhoneNumberParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*UpdateIncomingPhoneNumberParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetSmsMethod(SmsMethod string) (*UpdateIncomingPhoneNumberParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetSmsUrl(SmsUrl string) (*UpdateIncomingPhoneNumberParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetStatusCallback(StatusCallback string) (*UpdateIncomingPhoneNumberParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateIncomingPhoneNumberParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceApplicationSid(VoiceApplicationSid string) (*UpdateIncomingPhoneNumberParams){ + params.VoiceApplicationSid = &VoiceApplicationSid + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*UpdateIncomingPhoneNumberParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*UpdateIncomingPhoneNumberParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*UpdateIncomingPhoneNumberParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceMethod(VoiceMethod string) (*UpdateIncomingPhoneNumberParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceUrl(VoiceUrl string) (*UpdateIncomingPhoneNumberParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetEmergencyStatus(EmergencyStatus string) (*UpdateIncomingPhoneNumberParams){ + params.EmergencyStatus = &EmergencyStatus + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetEmergencyAddressSid(EmergencyAddressSid string) (*UpdateIncomingPhoneNumberParams){ + params.EmergencyAddressSid = &EmergencyAddressSid + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetTrunkSid(TrunkSid string) (*UpdateIncomingPhoneNumberParams){ + params.TrunkSid = &TrunkSid + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetVoiceReceiveMode(VoiceReceiveMode string) (*UpdateIncomingPhoneNumberParams){ + params.VoiceReceiveMode = &VoiceReceiveMode + return params +} +func (params *UpdateIncomingPhoneNumberParams) SetIdentitySid(IdentitySid string) (*UpdateIncomingPhoneNumberParams){ + params.IdentitySid = &IdentitySid + return params } -func (params *UpdateIncomingPhoneNumberParams) SetAddressSid(AddressSid string) *UpdateIncomingPhoneNumberParams { - params.AddressSid = &AddressSid - return params +func (params *UpdateIncomingPhoneNumberParams) SetAddressSid(AddressSid string) (*UpdateIncomingPhoneNumberParams){ + params.AddressSid = &AddressSid + return params } -func (params *UpdateIncomingPhoneNumberParams) SetBundleSid(BundleSid string) *UpdateIncomingPhoneNumberParams { - params.BundleSid = &BundleSid - return params +func (params *UpdateIncomingPhoneNumberParams) SetBundleSid(BundleSid string) (*UpdateIncomingPhoneNumberParams){ + params.BundleSid = &BundleSid + return params } // Update an incoming-phone-number instance. func (c *ApiService) UpdateIncomingPhoneNumber(Sid string, params *UpdateIncomingPhoneNumberParams) (*ApiV2010IncomingPhoneNumber, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AccountSid != nil { - data.Set("AccountSid", *params.AccountSid) - } - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SmsApplicationSid != nil { - data.Set("SmsApplicationSid", *params.SmsApplicationSid) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceApplicationSid != nil { - data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.EmergencyStatus != nil { - data.Set("EmergencyStatus", *params.EmergencyStatus) - } - if params != nil && params.EmergencyAddressSid != nil { - data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) - } - if params != nil && params.TrunkSid != nil { - data.Set("TrunkSid", *params.TrunkSid) - } - if params != nil && params.VoiceReceiveMode != nil { - data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) - } - if params != nil && params.IdentitySid != nil { - data.Set("IdentitySid", *params.IdentitySid) - } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.BundleSid != nil { - data.Set("BundleSid", *params.BundleSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010IncomingPhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AccountSid != nil { + data.Set("AccountSid", *params.AccountSid) + } + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SmsApplicationSid != nil { + data.Set("SmsApplicationSid", *params.SmsApplicationSid) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceApplicationSid != nil { + data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.EmergencyStatus != nil { + data.Set("EmergencyStatus", *params.EmergencyStatus) + } + if params != nil && params.EmergencyAddressSid != nil { + data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) + } + if params != nil && params.TrunkSid != nil { + data.Set("TrunkSid", *params.TrunkSid) + } + if params != nil && params.VoiceReceiveMode != nil { + data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) + } + if params != nil && params.IdentitySid != nil { + data.Set("IdentitySid", *params.IdentitySid) + } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.BundleSid != nil { + data.Set("BundleSid", *params.BundleSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010IncomingPhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons.go b/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons.go index c6ccd00d5..3e4c2539e 100644 --- a/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons.go +++ b/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons.go @@ -18,203 +18,208 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIncomingPhoneNumberAssignedAddOn' type CreateIncomingPhoneNumberAssignedAddOnParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The SID that identifies the Add-on installation. - InstalledAddOnSid *string `json:"InstalledAddOnSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID that identifies the Add-on installation. + InstalledAddOnSid *string `json:"InstalledAddOnSid,omitempty"` } -func (params *CreateIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) *CreateIncomingPhoneNumberAssignedAddOnParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) (*CreateIncomingPhoneNumberAssignedAddOnParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateIncomingPhoneNumberAssignedAddOnParams) SetInstalledAddOnSid(InstalledAddOnSid string) *CreateIncomingPhoneNumberAssignedAddOnParams { - params.InstalledAddOnSid = &InstalledAddOnSid - return params +func (params *CreateIncomingPhoneNumberAssignedAddOnParams) SetInstalledAddOnSid(InstalledAddOnSid string) (*CreateIncomingPhoneNumberAssignedAddOnParams){ + params.InstalledAddOnSid = &InstalledAddOnSid + return params } // Assign an Add-on installation to the Number specified. func (c *ApiService) CreateIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *CreateIncomingPhoneNumberAssignedAddOnParams) (*ApiV2010IncomingPhoneNumberAssignedAddOn, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.InstalledAddOnSid != nil { - data.Set("InstalledAddOnSid", *params.InstalledAddOnSid) - } + if params != nil && params.InstalledAddOnSid != nil { + data.Set("InstalledAddOnSid", *params.InstalledAddOnSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010IncomingPhoneNumberAssignedAddOn{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010IncomingPhoneNumberAssignedAddOn{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteIncomingPhoneNumberAssignedAddOn' type DeleteIncomingPhoneNumberAssignedAddOnParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) *DeleteIncomingPhoneNumberAssignedAddOnParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) (*DeleteIncomingPhoneNumberAssignedAddOnParams){ + params.PathAccountSid = &PathAccountSid + return params } // Remove the assignment of an Add-on installation from the Number specified. -func (c *ApiService) DeleteIncomingPhoneNumberAssignedAddOn(ResourceSid string, Sid string, params *DeleteIncomingPhoneNumberAssignedAddOnParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteIncomingPhoneNumberAssignedAddOn(ResourceSid string, Sid string, params *DeleteIncomingPhoneNumberAssignedAddOnParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchIncomingPhoneNumberAssignedAddOn' type FetchIncomingPhoneNumberAssignedAddOnParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) *FetchIncomingPhoneNumberAssignedAddOnParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) (*FetchIncomingPhoneNumberAssignedAddOnParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of an Add-on installation currently assigned to this Number. func (c *ApiService) FetchIncomingPhoneNumberAssignedAddOn(ResourceSid string, Sid string, params *FetchIncomingPhoneNumberAssignedAddOnParams) (*ApiV2010IncomingPhoneNumberAssignedAddOn, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010IncomingPhoneNumberAssignedAddOn{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010IncomingPhoneNumberAssignedAddOn{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListIncomingPhoneNumberAssignedAddOn' type ListIncomingPhoneNumberAssignedAddOnParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) *ListIncomingPhoneNumberAssignedAddOnParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListIncomingPhoneNumberAssignedAddOnParams) SetPathAccountSid(PathAccountSid string) (*ListIncomingPhoneNumberAssignedAddOnParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListIncomingPhoneNumberAssignedAddOnParams) SetPageSize(PageSize int) *ListIncomingPhoneNumberAssignedAddOnParams { - params.PageSize = &PageSize - return params +func (params *ListIncomingPhoneNumberAssignedAddOnParams) SetPageSize(PageSize int) (*ListIncomingPhoneNumberAssignedAddOnParams){ + params.PageSize = &PageSize + return params } -func (params *ListIncomingPhoneNumberAssignedAddOnParams) SetLimit(Limit int) *ListIncomingPhoneNumberAssignedAddOnParams { - params.Limit = &Limit - return params +func (params *ListIncomingPhoneNumberAssignedAddOnParams) SetLimit(Limit int) (*ListIncomingPhoneNumberAssignedAddOnParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IncomingPhoneNumberAssignedAddOn records from the API. Request is executed immediately. -func (c *ApiService) PageIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *ListIncomingPhoneNumberAssignedAddOnParams, pageToken, pageNumber string) (*ListIncomingPhoneNumberAssignedAddOnResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns.json" +func (c *ApiService) PageIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *ListIncomingPhoneNumberAssignedAddOnParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIncomingPhoneNumberAssignedAddOnResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists IncomingPhoneNumberAssignedAddOn records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *ListIncomingPhoneNumberAssignedAddOnParams) ([]ApiV2010IncomingPhoneNumberAssignedAddOn, error) { +func (c *ApiService) ListIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *ListIncomingPhoneNumberAssignedAddOnParams) (ListIncomingPhoneNumberAssignedAddOn200Response, error) { response, errors := c.StreamIncomingPhoneNumberAssignedAddOn(ResourceSid, params) - records := make([]ApiV2010IncomingPhoneNumberAssignedAddOn, 0) + records := make(ListIncomingPhoneNumberAssignedAddOn200Response, 0) for record := range response { records = append(records, record) } @@ -227,13 +232,13 @@ func (c *ApiService) ListIncomingPhoneNumberAssignedAddOn(ResourceSid string, pa } // Streams IncomingPhoneNumberAssignedAddOn records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *ListIncomingPhoneNumberAssignedAddOnParams) (chan ApiV2010IncomingPhoneNumberAssignedAddOn, chan error) { +func (c *ApiService) StreamIncomingPhoneNumberAssignedAddOn(ResourceSid string, params *ListIncomingPhoneNumberAssignedAddOnParams) (chan ListIncomingPhoneNumberAssignedAddOn200Response, chan error) { if params == nil { params = &ListIncomingPhoneNumberAssignedAddOnParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010IncomingPhoneNumberAssignedAddOn, 1) + recordChannel := make(chan ListIncomingPhoneNumberAssignedAddOn200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageIncomingPhoneNumberAssignedAddOn(ResourceSid, params, "", "") @@ -248,11 +253,12 @@ func (c *ApiService) StreamIncomingPhoneNumberAssignedAddOn(ResourceSid string, return recordChannel, errorChannel } -func (c *ApiService) streamIncomingPhoneNumberAssignedAddOn(response *ListIncomingPhoneNumberAssignedAddOnResponse, params *ListIncomingPhoneNumberAssignedAddOnParams, recordChannel chan ApiV2010IncomingPhoneNumberAssignedAddOn, errorChannel chan error) { + +func (c *ApiService) streamIncomingPhoneNumberAssignedAddOn(response *, params *ListIncomingPhoneNumberAssignedAddOnParams, recordChannel chan ListIncomingPhoneNumberAssignedAddOn200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AssignedAddOns + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -263,7 +269,7 @@ func (c *ApiService) streamIncomingPhoneNumberAssignedAddOn(response *ListIncomi } } - record, err := client.GetNext(c.baseURL, response, c.getNextListIncomingPhoneNumberAssignedAddOnResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -271,27 +277,28 @@ func (c *ApiService) streamIncomingPhoneNumberAssignedAddOn(response *ListIncomi break } - response = record.(*ListIncomingPhoneNumberAssignedAddOnResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListIncomingPhoneNumberAssignedAddOnResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIncomingPhoneNumberAssignedAddOnResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons_extensions.go b/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons_extensions.go index 981b2137a..58517b45e 100644 --- a/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons_extensions.go +++ b/rest/api/v2010/accounts_incoming_phone_numbers_assigned_add_ons_extensions.go @@ -18,121 +18,123 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchIncomingPhoneNumberAssignedAddOnExtension' type FetchIncomingPhoneNumberAssignedAddOnExtensionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchIncomingPhoneNumberAssignedAddOnExtensionParams) SetPathAccountSid(PathAccountSid string) *FetchIncomingPhoneNumberAssignedAddOnExtensionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchIncomingPhoneNumberAssignedAddOnExtensionParams) SetPathAccountSid(PathAccountSid string) (*FetchIncomingPhoneNumberAssignedAddOnExtensionParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of an Extension for the Assigned Add-on. func (c *ApiService) FetchIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, Sid string, params *FetchIncomingPhoneNumberAssignedAddOnExtensionParams) (*ApiV2010IncomingPhoneNumberAssignedAddOnExtension, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{AssignedAddOnSid}/Extensions/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) - path = strings.Replace(path, "{"+"AssignedAddOnSid"+"}", AssignedAddOnSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{AssignedAddOnSid}/Extensions/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) + path = strings.Replace(path, "{"+"AssignedAddOnSid"+"}", AssignedAddOnSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010IncomingPhoneNumberAssignedAddOnExtension{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010IncomingPhoneNumberAssignedAddOnExtension{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListIncomingPhoneNumberAssignedAddOnExtension' type ListIncomingPhoneNumberAssignedAddOnExtensionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) SetPathAccountSid(PathAccountSid string) *ListIncomingPhoneNumberAssignedAddOnExtensionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) SetPathAccountSid(PathAccountSid string) (*ListIncomingPhoneNumberAssignedAddOnExtensionParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) SetPageSize(PageSize int) *ListIncomingPhoneNumberAssignedAddOnExtensionParams { - params.PageSize = &PageSize - return params +func (params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) SetPageSize(PageSize int) (*ListIncomingPhoneNumberAssignedAddOnExtensionParams){ + params.PageSize = &PageSize + return params } -func (params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) SetLimit(Limit int) *ListIncomingPhoneNumberAssignedAddOnExtensionParams { - params.Limit = &Limit - return params +func (params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) SetLimit(Limit int) (*ListIncomingPhoneNumberAssignedAddOnExtensionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IncomingPhoneNumberAssignedAddOnExtension records from the API. Request is executed immediately. -func (c *ApiService) PageIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams, pageToken, pageNumber string) (*ListIncomingPhoneNumberAssignedAddOnExtensionResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{AssignedAddOnSid}/Extensions.json" +func (c *ApiService) PageIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{ResourceSid}/AssignedAddOns/{AssignedAddOnSid}/Extensions.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) - path = strings.Replace(path, "{"+"AssignedAddOnSid"+"}", AssignedAddOnSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ResourceSid"+"}", ResourceSid, -1) + path = strings.Replace(path, "{"+"AssignedAddOnSid"+"}", AssignedAddOnSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIncomingPhoneNumberAssignedAddOnExtensionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists IncomingPhoneNumberAssignedAddOnExtension records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) ([]ApiV2010IncomingPhoneNumberAssignedAddOnExtension, error) { +func (c *ApiService) ListIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) (ListIncomingPhoneNumberAssignedAddOnExtension200Response, error) { response, errors := c.StreamIncomingPhoneNumberAssignedAddOnExtension(ResourceSid, AssignedAddOnSid, params) - records := make([]ApiV2010IncomingPhoneNumberAssignedAddOnExtension, 0) + records := make(ListIncomingPhoneNumberAssignedAddOnExtension200Response, 0) for record := range response { records = append(records, record) } @@ -145,13 +147,13 @@ func (c *ApiService) ListIncomingPhoneNumberAssignedAddOnExtension(ResourceSid s } // Streams IncomingPhoneNumberAssignedAddOnExtension records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) (chan ApiV2010IncomingPhoneNumberAssignedAddOnExtension, chan error) { +func (c *ApiService) StreamIncomingPhoneNumberAssignedAddOnExtension(ResourceSid string, AssignedAddOnSid string, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams) (chan ListIncomingPhoneNumberAssignedAddOnExtension200Response, chan error) { if params == nil { params = &ListIncomingPhoneNumberAssignedAddOnExtensionParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010IncomingPhoneNumberAssignedAddOnExtension, 1) + recordChannel := make(chan ListIncomingPhoneNumberAssignedAddOnExtension200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageIncomingPhoneNumberAssignedAddOnExtension(ResourceSid, AssignedAddOnSid, params, "", "") @@ -166,11 +168,12 @@ func (c *ApiService) StreamIncomingPhoneNumberAssignedAddOnExtension(ResourceSid return recordChannel, errorChannel } -func (c *ApiService) streamIncomingPhoneNumberAssignedAddOnExtension(response *ListIncomingPhoneNumberAssignedAddOnExtensionResponse, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams, recordChannel chan ApiV2010IncomingPhoneNumberAssignedAddOnExtension, errorChannel chan error) { + +func (c *ApiService) streamIncomingPhoneNumberAssignedAddOnExtension(response *, params *ListIncomingPhoneNumberAssignedAddOnExtensionParams, recordChannel chan ListIncomingPhoneNumberAssignedAddOnExtension200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Extensions + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -181,7 +184,7 @@ func (c *ApiService) streamIncomingPhoneNumberAssignedAddOnExtension(response *L } } - record, err := client.GetNext(c.baseURL, response, c.getNextListIncomingPhoneNumberAssignedAddOnExtensionResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -189,27 +192,28 @@ func (c *ApiService) streamIncomingPhoneNumberAssignedAddOnExtension(response *L break } - response = record.(*ListIncomingPhoneNumberAssignedAddOnExtensionResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListIncomingPhoneNumberAssignedAddOnExtensionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIncomingPhoneNumberAssignedAddOnExtensionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_incoming_phone_numbers_local.go b/rest/api/v2010/accounts_incoming_phone_numbers_local.go index e40f5ff44..46a0a5219 100644 --- a/rest/api/v2010/accounts_incoming_phone_numbers_local.go +++ b/rest/api/v2010/accounts_incoming_phone_numbers_local.go @@ -18,360 +18,361 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIncomingPhoneNumberLocal' type CreateIncomingPhoneNumberLocalParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. - ApiVersion *string `json:"ApiVersion,omitempty"` - // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. - SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` - // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL we should call when the new phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` - // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. - IdentitySid *string `json:"IdentitySid,omitempty"` - // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. - AddressSid *string `json:"AddressSid,omitempty"` - // - EmergencyStatus *string `json:"EmergencyStatus,omitempty"` - // The SID of the emergency address configuration to use for emergency calling from the new phone number. - EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` - // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - TrunkSid *string `json:"TrunkSid,omitempty"` - // - VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - BundleSid *string `json:"BundleSid,omitempty"` -} - -func (params *CreateIncomingPhoneNumberLocalParams) SetPathAccountSid(PathAccountSid string) *CreateIncomingPhoneNumberLocalParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetPhoneNumber(PhoneNumber string) *CreateIncomingPhoneNumberLocalParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetApiVersion(ApiVersion string) *CreateIncomingPhoneNumberLocalParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetFriendlyName(FriendlyName string) *CreateIncomingPhoneNumberLocalParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetSmsApplicationSid(SmsApplicationSid string) *CreateIncomingPhoneNumberLocalParams { - params.SmsApplicationSid = &SmsApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetSmsFallbackMethod(SmsFallbackMethod string) *CreateIncomingPhoneNumberLocalParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetSmsFallbackUrl(SmsFallbackUrl string) *CreateIncomingPhoneNumberLocalParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetSmsMethod(SmsMethod string) *CreateIncomingPhoneNumberLocalParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetSmsUrl(SmsUrl string) *CreateIncomingPhoneNumberLocalParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetStatusCallback(StatusCallback string) *CreateIncomingPhoneNumberLocalParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateIncomingPhoneNumberLocalParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceApplicationSid(VoiceApplicationSid string) *CreateIncomingPhoneNumberLocalParams { - params.VoiceApplicationSid = &VoiceApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *CreateIncomingPhoneNumberLocalParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateIncomingPhoneNumberLocalParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateIncomingPhoneNumberLocalParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceMethod(VoiceMethod string) *CreateIncomingPhoneNumberLocalParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceUrl(VoiceUrl string) *CreateIncomingPhoneNumberLocalParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetIdentitySid(IdentitySid string) *CreateIncomingPhoneNumberLocalParams { - params.IdentitySid = &IdentitySid - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetAddressSid(AddressSid string) *CreateIncomingPhoneNumberLocalParams { - params.AddressSid = &AddressSid - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetEmergencyStatus(EmergencyStatus string) *CreateIncomingPhoneNumberLocalParams { - params.EmergencyStatus = &EmergencyStatus - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetEmergencyAddressSid(EmergencyAddressSid string) *CreateIncomingPhoneNumberLocalParams { - params.EmergencyAddressSid = &EmergencyAddressSid - return params -} -func (params *CreateIncomingPhoneNumberLocalParams) SetTrunkSid(TrunkSid string) *CreateIncomingPhoneNumberLocalParams { - params.TrunkSid = &TrunkSid - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. + ApiVersion *string `json:"ApiVersion,omitempty"` + // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. + SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` + // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL we should call when the new phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` + // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. + IdentitySid *string `json:"IdentitySid,omitempty"` + // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. + AddressSid *string `json:"AddressSid,omitempty"` + // + EmergencyStatus *string `json:"EmergencyStatus,omitempty"` + // The SID of the emergency address configuration to use for emergency calling from the new phone number. + EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` + // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + TrunkSid *string `json:"TrunkSid,omitempty"` + // + VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + BundleSid *string `json:"BundleSid,omitempty"` +} + +func (params *CreateIncomingPhoneNumberLocalParams) SetPathAccountSid(PathAccountSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetPhoneNumber(PhoneNumber string) (*CreateIncomingPhoneNumberLocalParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetApiVersion(ApiVersion string) (*CreateIncomingPhoneNumberLocalParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetFriendlyName(FriendlyName string) (*CreateIncomingPhoneNumberLocalParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetSmsApplicationSid(SmsApplicationSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.SmsApplicationSid = &SmsApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*CreateIncomingPhoneNumberLocalParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*CreateIncomingPhoneNumberLocalParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetSmsMethod(SmsMethod string) (*CreateIncomingPhoneNumberLocalParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetSmsUrl(SmsUrl string) (*CreateIncomingPhoneNumberLocalParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetStatusCallback(StatusCallback string) (*CreateIncomingPhoneNumberLocalParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateIncomingPhoneNumberLocalParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceApplicationSid(VoiceApplicationSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceApplicationSid = &VoiceApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceMethod(VoiceMethod string) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceUrl(VoiceUrl string) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetIdentitySid(IdentitySid string) (*CreateIncomingPhoneNumberLocalParams){ + params.IdentitySid = &IdentitySid + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetAddressSid(AddressSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.AddressSid = &AddressSid + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetEmergencyStatus(EmergencyStatus string) (*CreateIncomingPhoneNumberLocalParams){ + params.EmergencyStatus = &EmergencyStatus + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetEmergencyAddressSid(EmergencyAddressSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.EmergencyAddressSid = &EmergencyAddressSid + return params +} +func (params *CreateIncomingPhoneNumberLocalParams) SetTrunkSid(TrunkSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.TrunkSid = &TrunkSid + return params } -func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceReceiveMode(VoiceReceiveMode string) *CreateIncomingPhoneNumberLocalParams { - params.VoiceReceiveMode = &VoiceReceiveMode - return params +func (params *CreateIncomingPhoneNumberLocalParams) SetVoiceReceiveMode(VoiceReceiveMode string) (*CreateIncomingPhoneNumberLocalParams){ + params.VoiceReceiveMode = &VoiceReceiveMode + return params } -func (params *CreateIncomingPhoneNumberLocalParams) SetBundleSid(BundleSid string) *CreateIncomingPhoneNumberLocalParams { - params.BundleSid = &BundleSid - return params +func (params *CreateIncomingPhoneNumberLocalParams) SetBundleSid(BundleSid string) (*CreateIncomingPhoneNumberLocalParams){ + params.BundleSid = &BundleSid + return params } -// +// func (c *ApiService) CreateIncomingPhoneNumberLocal(params *CreateIncomingPhoneNumberLocalParams) (*ApiV2010IncomingPhoneNumberLocal, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Local.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SmsApplicationSid != nil { - data.Set("SmsApplicationSid", *params.SmsApplicationSid) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceApplicationSid != nil { - data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.IdentitySid != nil { - data.Set("IdentitySid", *params.IdentitySid) - } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.EmergencyStatus != nil { - data.Set("EmergencyStatus", *params.EmergencyStatus) - } - if params != nil && params.EmergencyAddressSid != nil { - data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) - } - if params != nil && params.TrunkSid != nil { - data.Set("TrunkSid", *params.TrunkSid) - } - if params != nil && params.VoiceReceiveMode != nil { - data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) - } - if params != nil && params.BundleSid != nil { - data.Set("BundleSid", *params.BundleSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010IncomingPhoneNumberLocal{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Local.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SmsApplicationSid != nil { + data.Set("SmsApplicationSid", *params.SmsApplicationSid) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceApplicationSid != nil { + data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.IdentitySid != nil { + data.Set("IdentitySid", *params.IdentitySid) + } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.EmergencyStatus != nil { + data.Set("EmergencyStatus", *params.EmergencyStatus) + } + if params != nil && params.EmergencyAddressSid != nil { + data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) + } + if params != nil && params.TrunkSid != nil { + data.Set("TrunkSid", *params.TrunkSid) + } + if params != nil && params.VoiceReceiveMode != nil { + data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) + } + if params != nil && params.BundleSid != nil { + data.Set("BundleSid", *params.BundleSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010IncomingPhoneNumberLocal{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListIncomingPhoneNumberLocal' type ListIncomingPhoneNumberLocalParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // A string that identifies the resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. - Origin *string `json:"Origin,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListIncomingPhoneNumberLocalParams) SetPathAccountSid(PathAccountSid string) *ListIncomingPhoneNumberLocalParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListIncomingPhoneNumberLocalParams) SetBeta(Beta bool) *ListIncomingPhoneNumberLocalParams { - params.Beta = &Beta - return params -} -func (params *ListIncomingPhoneNumberLocalParams) SetFriendlyName(FriendlyName string) *ListIncomingPhoneNumberLocalParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListIncomingPhoneNumberLocalParams) SetPhoneNumber(PhoneNumber string) *ListIncomingPhoneNumberLocalParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *ListIncomingPhoneNumberLocalParams) SetOrigin(Origin string) *ListIncomingPhoneNumberLocalParams { - params.Origin = &Origin - return params -} -func (params *ListIncomingPhoneNumberLocalParams) SetPageSize(PageSize int) *ListIncomingPhoneNumberLocalParams { - params.PageSize = &PageSize - return params -} -func (params *ListIncomingPhoneNumberLocalParams) SetLimit(Limit int) *ListIncomingPhoneNumberLocalParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // A string that identifies the resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. + Origin *string `json:"Origin,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListIncomingPhoneNumberLocalParams) SetPathAccountSid(PathAccountSid string) (*ListIncomingPhoneNumberLocalParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListIncomingPhoneNumberLocalParams) SetBeta(Beta bool) (*ListIncomingPhoneNumberLocalParams){ + params.Beta = &Beta + return params +} +func (params *ListIncomingPhoneNumberLocalParams) SetFriendlyName(FriendlyName string) (*ListIncomingPhoneNumberLocalParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListIncomingPhoneNumberLocalParams) SetPhoneNumber(PhoneNumber string) (*ListIncomingPhoneNumberLocalParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *ListIncomingPhoneNumberLocalParams) SetOrigin(Origin string) (*ListIncomingPhoneNumberLocalParams){ + params.Origin = &Origin + return params +} +func (params *ListIncomingPhoneNumberLocalParams) SetPageSize(PageSize int) (*ListIncomingPhoneNumberLocalParams){ + params.PageSize = &PageSize + return params +} +func (params *ListIncomingPhoneNumberLocalParams) SetLimit(Limit int) (*ListIncomingPhoneNumberLocalParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IncomingPhoneNumberLocal records from the API. Request is executed immediately. -func (c *ApiService) PageIncomingPhoneNumberLocal(params *ListIncomingPhoneNumberLocalParams, pageToken, pageNumber string) (*ListIncomingPhoneNumberLocalResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Local.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.Origin != nil { - data.Set("Origin", *params.Origin) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIncomingPhoneNumberLocalResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageIncomingPhoneNumberLocal(params *ListIncomingPhoneNumberLocalParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Local.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.Origin != nil { + data.Set("Origin", *params.Origin) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists IncomingPhoneNumberLocal records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListIncomingPhoneNumberLocal(params *ListIncomingPhoneNumberLocalParams) ([]ApiV2010IncomingPhoneNumberLocal, error) { +func (c *ApiService) ListIncomingPhoneNumberLocal(params *ListIncomingPhoneNumberLocalParams) (ListIncomingPhoneNumberLocal200Response, error) { response, errors := c.StreamIncomingPhoneNumberLocal(params) - records := make([]ApiV2010IncomingPhoneNumberLocal, 0) + records := make(ListIncomingPhoneNumberLocal200Response, 0) for record := range response { records = append(records, record) } @@ -384,13 +385,13 @@ func (c *ApiService) ListIncomingPhoneNumberLocal(params *ListIncomingPhoneNumbe } // Streams IncomingPhoneNumberLocal records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamIncomingPhoneNumberLocal(params *ListIncomingPhoneNumberLocalParams) (chan ApiV2010IncomingPhoneNumberLocal, chan error) { +func (c *ApiService) StreamIncomingPhoneNumberLocal(params *ListIncomingPhoneNumberLocalParams) (chan ListIncomingPhoneNumberLocal200Response, chan error) { if params == nil { params = &ListIncomingPhoneNumberLocalParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010IncomingPhoneNumberLocal, 1) + recordChannel := make(chan ListIncomingPhoneNumberLocal200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageIncomingPhoneNumberLocal(params, "", "") @@ -405,11 +406,12 @@ func (c *ApiService) StreamIncomingPhoneNumberLocal(params *ListIncomingPhoneNum return recordChannel, errorChannel } -func (c *ApiService) streamIncomingPhoneNumberLocal(response *ListIncomingPhoneNumberLocalResponse, params *ListIncomingPhoneNumberLocalParams, recordChannel chan ApiV2010IncomingPhoneNumberLocal, errorChannel chan error) { + +func (c *ApiService) streamIncomingPhoneNumberLocal(response *, params *ListIncomingPhoneNumberLocalParams, recordChannel chan ListIncomingPhoneNumberLocal200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IncomingPhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -420,7 +422,7 @@ func (c *ApiService) streamIncomingPhoneNumberLocal(response *ListIncomingPhoneN } } - record, err := client.GetNext(c.baseURL, response, c.getNextListIncomingPhoneNumberLocalResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -428,27 +430,28 @@ func (c *ApiService) streamIncomingPhoneNumberLocal(response *ListIncomingPhoneN break } - response = record.(*ListIncomingPhoneNumberLocalResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListIncomingPhoneNumberLocalResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIncomingPhoneNumberLocalResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_incoming_phone_numbers_mobile.go b/rest/api/v2010/accounts_incoming_phone_numbers_mobile.go index feaef417a..8250eab65 100644 --- a/rest/api/v2010/accounts_incoming_phone_numbers_mobile.go +++ b/rest/api/v2010/accounts_incoming_phone_numbers_mobile.go @@ -18,360 +18,361 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIncomingPhoneNumberMobile' type CreateIncomingPhoneNumberMobileParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. - ApiVersion *string `json:"ApiVersion,omitempty"` - // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, the is a formatted version of the phone number. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those of the application. - SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` - // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL we should call when the new phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` - // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. - IdentitySid *string `json:"IdentitySid,omitempty"` - // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. - AddressSid *string `json:"AddressSid,omitempty"` - // - EmergencyStatus *string `json:"EmergencyStatus,omitempty"` - // The SID of the emergency address configuration to use for emergency calling from the new phone number. - EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` - // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - TrunkSid *string `json:"TrunkSid,omitempty"` - // - VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - BundleSid *string `json:"BundleSid,omitempty"` -} - -func (params *CreateIncomingPhoneNumberMobileParams) SetPathAccountSid(PathAccountSid string) *CreateIncomingPhoneNumberMobileParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetPhoneNumber(PhoneNumber string) *CreateIncomingPhoneNumberMobileParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetApiVersion(ApiVersion string) *CreateIncomingPhoneNumberMobileParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetFriendlyName(FriendlyName string) *CreateIncomingPhoneNumberMobileParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetSmsApplicationSid(SmsApplicationSid string) *CreateIncomingPhoneNumberMobileParams { - params.SmsApplicationSid = &SmsApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetSmsFallbackMethod(SmsFallbackMethod string) *CreateIncomingPhoneNumberMobileParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetSmsFallbackUrl(SmsFallbackUrl string) *CreateIncomingPhoneNumberMobileParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetSmsMethod(SmsMethod string) *CreateIncomingPhoneNumberMobileParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetSmsUrl(SmsUrl string) *CreateIncomingPhoneNumberMobileParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetStatusCallback(StatusCallback string) *CreateIncomingPhoneNumberMobileParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateIncomingPhoneNumberMobileParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceApplicationSid(VoiceApplicationSid string) *CreateIncomingPhoneNumberMobileParams { - params.VoiceApplicationSid = &VoiceApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *CreateIncomingPhoneNumberMobileParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateIncomingPhoneNumberMobileParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateIncomingPhoneNumberMobileParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceMethod(VoiceMethod string) *CreateIncomingPhoneNumberMobileParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceUrl(VoiceUrl string) *CreateIncomingPhoneNumberMobileParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetIdentitySid(IdentitySid string) *CreateIncomingPhoneNumberMobileParams { - params.IdentitySid = &IdentitySid - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetAddressSid(AddressSid string) *CreateIncomingPhoneNumberMobileParams { - params.AddressSid = &AddressSid - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetEmergencyStatus(EmergencyStatus string) *CreateIncomingPhoneNumberMobileParams { - params.EmergencyStatus = &EmergencyStatus - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetEmergencyAddressSid(EmergencyAddressSid string) *CreateIncomingPhoneNumberMobileParams { - params.EmergencyAddressSid = &EmergencyAddressSid - return params -} -func (params *CreateIncomingPhoneNumberMobileParams) SetTrunkSid(TrunkSid string) *CreateIncomingPhoneNumberMobileParams { - params.TrunkSid = &TrunkSid - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. + ApiVersion *string `json:"ApiVersion,omitempty"` + // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, the is a formatted version of the phone number. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those of the application. + SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` + // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL we should call when the new phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` + // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. + IdentitySid *string `json:"IdentitySid,omitempty"` + // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. + AddressSid *string `json:"AddressSid,omitempty"` + // + EmergencyStatus *string `json:"EmergencyStatus,omitempty"` + // The SID of the emergency address configuration to use for emergency calling from the new phone number. + EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` + // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + TrunkSid *string `json:"TrunkSid,omitempty"` + // + VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + BundleSid *string `json:"BundleSid,omitempty"` +} + +func (params *CreateIncomingPhoneNumberMobileParams) SetPathAccountSid(PathAccountSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetPhoneNumber(PhoneNumber string) (*CreateIncomingPhoneNumberMobileParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetApiVersion(ApiVersion string) (*CreateIncomingPhoneNumberMobileParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetFriendlyName(FriendlyName string) (*CreateIncomingPhoneNumberMobileParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetSmsApplicationSid(SmsApplicationSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.SmsApplicationSid = &SmsApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*CreateIncomingPhoneNumberMobileParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*CreateIncomingPhoneNumberMobileParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetSmsMethod(SmsMethod string) (*CreateIncomingPhoneNumberMobileParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetSmsUrl(SmsUrl string) (*CreateIncomingPhoneNumberMobileParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetStatusCallback(StatusCallback string) (*CreateIncomingPhoneNumberMobileParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateIncomingPhoneNumberMobileParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceApplicationSid(VoiceApplicationSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceApplicationSid = &VoiceApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceMethod(VoiceMethod string) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceUrl(VoiceUrl string) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetIdentitySid(IdentitySid string) (*CreateIncomingPhoneNumberMobileParams){ + params.IdentitySid = &IdentitySid + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetAddressSid(AddressSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.AddressSid = &AddressSid + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetEmergencyStatus(EmergencyStatus string) (*CreateIncomingPhoneNumberMobileParams){ + params.EmergencyStatus = &EmergencyStatus + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetEmergencyAddressSid(EmergencyAddressSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.EmergencyAddressSid = &EmergencyAddressSid + return params +} +func (params *CreateIncomingPhoneNumberMobileParams) SetTrunkSid(TrunkSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.TrunkSid = &TrunkSid + return params } -func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceReceiveMode(VoiceReceiveMode string) *CreateIncomingPhoneNumberMobileParams { - params.VoiceReceiveMode = &VoiceReceiveMode - return params +func (params *CreateIncomingPhoneNumberMobileParams) SetVoiceReceiveMode(VoiceReceiveMode string) (*CreateIncomingPhoneNumberMobileParams){ + params.VoiceReceiveMode = &VoiceReceiveMode + return params } -func (params *CreateIncomingPhoneNumberMobileParams) SetBundleSid(BundleSid string) *CreateIncomingPhoneNumberMobileParams { - params.BundleSid = &BundleSid - return params +func (params *CreateIncomingPhoneNumberMobileParams) SetBundleSid(BundleSid string) (*CreateIncomingPhoneNumberMobileParams){ + params.BundleSid = &BundleSid + return params } -// +// func (c *ApiService) CreateIncomingPhoneNumberMobile(params *CreateIncomingPhoneNumberMobileParams) (*ApiV2010IncomingPhoneNumberMobile, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Mobile.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SmsApplicationSid != nil { - data.Set("SmsApplicationSid", *params.SmsApplicationSid) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceApplicationSid != nil { - data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.IdentitySid != nil { - data.Set("IdentitySid", *params.IdentitySid) - } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.EmergencyStatus != nil { - data.Set("EmergencyStatus", *params.EmergencyStatus) - } - if params != nil && params.EmergencyAddressSid != nil { - data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) - } - if params != nil && params.TrunkSid != nil { - data.Set("TrunkSid", *params.TrunkSid) - } - if params != nil && params.VoiceReceiveMode != nil { - data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) - } - if params != nil && params.BundleSid != nil { - data.Set("BundleSid", *params.BundleSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010IncomingPhoneNumberMobile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Mobile.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SmsApplicationSid != nil { + data.Set("SmsApplicationSid", *params.SmsApplicationSid) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceApplicationSid != nil { + data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.IdentitySid != nil { + data.Set("IdentitySid", *params.IdentitySid) + } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.EmergencyStatus != nil { + data.Set("EmergencyStatus", *params.EmergencyStatus) + } + if params != nil && params.EmergencyAddressSid != nil { + data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) + } + if params != nil && params.TrunkSid != nil { + data.Set("TrunkSid", *params.TrunkSid) + } + if params != nil && params.VoiceReceiveMode != nil { + data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) + } + if params != nil && params.BundleSid != nil { + data.Set("BundleSid", *params.BundleSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010IncomingPhoneNumberMobile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListIncomingPhoneNumberMobile' type ListIncomingPhoneNumberMobileParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // A string that identifies the resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. - Origin *string `json:"Origin,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListIncomingPhoneNumberMobileParams) SetPathAccountSid(PathAccountSid string) *ListIncomingPhoneNumberMobileParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListIncomingPhoneNumberMobileParams) SetBeta(Beta bool) *ListIncomingPhoneNumberMobileParams { - params.Beta = &Beta - return params -} -func (params *ListIncomingPhoneNumberMobileParams) SetFriendlyName(FriendlyName string) *ListIncomingPhoneNumberMobileParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListIncomingPhoneNumberMobileParams) SetPhoneNumber(PhoneNumber string) *ListIncomingPhoneNumberMobileParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *ListIncomingPhoneNumberMobileParams) SetOrigin(Origin string) *ListIncomingPhoneNumberMobileParams { - params.Origin = &Origin - return params -} -func (params *ListIncomingPhoneNumberMobileParams) SetPageSize(PageSize int) *ListIncomingPhoneNumberMobileParams { - params.PageSize = &PageSize - return params -} -func (params *ListIncomingPhoneNumberMobileParams) SetLimit(Limit int) *ListIncomingPhoneNumberMobileParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // A string that identifies the resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. + Origin *string `json:"Origin,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListIncomingPhoneNumberMobileParams) SetPathAccountSid(PathAccountSid string) (*ListIncomingPhoneNumberMobileParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListIncomingPhoneNumberMobileParams) SetBeta(Beta bool) (*ListIncomingPhoneNumberMobileParams){ + params.Beta = &Beta + return params +} +func (params *ListIncomingPhoneNumberMobileParams) SetFriendlyName(FriendlyName string) (*ListIncomingPhoneNumberMobileParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListIncomingPhoneNumberMobileParams) SetPhoneNumber(PhoneNumber string) (*ListIncomingPhoneNumberMobileParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *ListIncomingPhoneNumberMobileParams) SetOrigin(Origin string) (*ListIncomingPhoneNumberMobileParams){ + params.Origin = &Origin + return params +} +func (params *ListIncomingPhoneNumberMobileParams) SetPageSize(PageSize int) (*ListIncomingPhoneNumberMobileParams){ + params.PageSize = &PageSize + return params +} +func (params *ListIncomingPhoneNumberMobileParams) SetLimit(Limit int) (*ListIncomingPhoneNumberMobileParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IncomingPhoneNumberMobile records from the API. Request is executed immediately. -func (c *ApiService) PageIncomingPhoneNumberMobile(params *ListIncomingPhoneNumberMobileParams, pageToken, pageNumber string) (*ListIncomingPhoneNumberMobileResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Mobile.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.Origin != nil { - data.Set("Origin", *params.Origin) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIncomingPhoneNumberMobileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageIncomingPhoneNumberMobile(params *ListIncomingPhoneNumberMobileParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/Mobile.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.Origin != nil { + data.Set("Origin", *params.Origin) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists IncomingPhoneNumberMobile records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListIncomingPhoneNumberMobile(params *ListIncomingPhoneNumberMobileParams) ([]ApiV2010IncomingPhoneNumberMobile, error) { +func (c *ApiService) ListIncomingPhoneNumberMobile(params *ListIncomingPhoneNumberMobileParams) (ListIncomingPhoneNumberMobile200Response, error) { response, errors := c.StreamIncomingPhoneNumberMobile(params) - records := make([]ApiV2010IncomingPhoneNumberMobile, 0) + records := make(ListIncomingPhoneNumberMobile200Response, 0) for record := range response { records = append(records, record) } @@ -384,13 +385,13 @@ func (c *ApiService) ListIncomingPhoneNumberMobile(params *ListIncomingPhoneNumb } // Streams IncomingPhoneNumberMobile records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamIncomingPhoneNumberMobile(params *ListIncomingPhoneNumberMobileParams) (chan ApiV2010IncomingPhoneNumberMobile, chan error) { +func (c *ApiService) StreamIncomingPhoneNumberMobile(params *ListIncomingPhoneNumberMobileParams) (chan ListIncomingPhoneNumberMobile200Response, chan error) { if params == nil { params = &ListIncomingPhoneNumberMobileParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010IncomingPhoneNumberMobile, 1) + recordChannel := make(chan ListIncomingPhoneNumberMobile200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageIncomingPhoneNumberMobile(params, "", "") @@ -405,11 +406,12 @@ func (c *ApiService) StreamIncomingPhoneNumberMobile(params *ListIncomingPhoneNu return recordChannel, errorChannel } -func (c *ApiService) streamIncomingPhoneNumberMobile(response *ListIncomingPhoneNumberMobileResponse, params *ListIncomingPhoneNumberMobileParams, recordChannel chan ApiV2010IncomingPhoneNumberMobile, errorChannel chan error) { + +func (c *ApiService) streamIncomingPhoneNumberMobile(response *, params *ListIncomingPhoneNumberMobileParams, recordChannel chan ListIncomingPhoneNumberMobile200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IncomingPhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -420,7 +422,7 @@ func (c *ApiService) streamIncomingPhoneNumberMobile(response *ListIncomingPhone } } - record, err := client.GetNext(c.baseURL, response, c.getNextListIncomingPhoneNumberMobileResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -428,27 +430,28 @@ func (c *ApiService) streamIncomingPhoneNumberMobile(response *ListIncomingPhone break } - response = record.(*ListIncomingPhoneNumberMobileResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListIncomingPhoneNumberMobileResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIncomingPhoneNumberMobileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_incoming_phone_numbers_toll_free.go b/rest/api/v2010/accounts_incoming_phone_numbers_toll_free.go index f178aed9e..bcfd97a65 100644 --- a/rest/api/v2010/accounts_incoming_phone_numbers_toll_free.go +++ b/rest/api/v2010/accounts_incoming_phone_numbers_toll_free.go @@ -18,360 +18,361 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIncomingPhoneNumberTollFree' type CreateIncomingPhoneNumberTollFreeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. - ApiVersion *string `json:"ApiVersion,omitempty"` - // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` - // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL we should call when the new phone number receives an incoming SMS message. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` - // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. - VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` - // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The SID of the Identity resource that we should associate with the new phone number. Some regions require an Identity to meet local regulations. - IdentitySid *string `json:"IdentitySid,omitempty"` - // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. - AddressSid *string `json:"AddressSid,omitempty"` - // - EmergencyStatus *string `json:"EmergencyStatus,omitempty"` - // The SID of the emergency address configuration to use for emergency calling from the new phone number. - EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` - // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - TrunkSid *string `json:"TrunkSid,omitempty"` - // - VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - BundleSid *string `json:"BundleSid,omitempty"` -} - -func (params *CreateIncomingPhoneNumberTollFreeParams) SetPathAccountSid(PathAccountSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetPhoneNumber(PhoneNumber string) *CreateIncomingPhoneNumberTollFreeParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetApiVersion(ApiVersion string) *CreateIncomingPhoneNumberTollFreeParams { - params.ApiVersion = &ApiVersion - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetFriendlyName(FriendlyName string) *CreateIncomingPhoneNumberTollFreeParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsApplicationSid(SmsApplicationSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.SmsApplicationSid = &SmsApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsFallbackMethod(SmsFallbackMethod string) *CreateIncomingPhoneNumberTollFreeParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsFallbackUrl(SmsFallbackUrl string) *CreateIncomingPhoneNumberTollFreeParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsMethod(SmsMethod string) *CreateIncomingPhoneNumberTollFreeParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsUrl(SmsUrl string) *CreateIncomingPhoneNumberTollFreeParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetStatusCallback(StatusCallback string) *CreateIncomingPhoneNumberTollFreeParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateIncomingPhoneNumberTollFreeParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceApplicationSid(VoiceApplicationSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceApplicationSid = &VoiceApplicationSid - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceCallerIdLookup = &VoiceCallerIdLookup - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceMethod(VoiceMethod string) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceUrl(VoiceUrl string) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetIdentitySid(IdentitySid string) *CreateIncomingPhoneNumberTollFreeParams { - params.IdentitySid = &IdentitySid - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetAddressSid(AddressSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.AddressSid = &AddressSid - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetEmergencyStatus(EmergencyStatus string) *CreateIncomingPhoneNumberTollFreeParams { - params.EmergencyStatus = &EmergencyStatus - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetEmergencyAddressSid(EmergencyAddressSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.EmergencyAddressSid = &EmergencyAddressSid - return params -} -func (params *CreateIncomingPhoneNumberTollFreeParams) SetTrunkSid(TrunkSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.TrunkSid = &TrunkSid - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. + ApiVersion *string `json:"ApiVersion,omitempty"` + // A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` + // The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL we should call when the new phone number receives an incoming SMS message. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + VoiceApplicationSid *string `json:"VoiceApplicationSid,omitempty"` + // Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. + VoiceCallerIdLookup *bool `json:"VoiceCallerIdLookup,omitempty"` + // The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The SID of the Identity resource that we should associate with the new phone number. Some regions require an Identity to meet local regulations. + IdentitySid *string `json:"IdentitySid,omitempty"` + // The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. + AddressSid *string `json:"AddressSid,omitempty"` + // + EmergencyStatus *string `json:"EmergencyStatus,omitempty"` + // The SID of the emergency address configuration to use for emergency calling from the new phone number. + EmergencyAddressSid *string `json:"EmergencyAddressSid,omitempty"` + // The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + TrunkSid *string `json:"TrunkSid,omitempty"` + // + VoiceReceiveMode *string `json:"VoiceReceiveMode,omitempty"` + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + BundleSid *string `json:"BundleSid,omitempty"` +} + +func (params *CreateIncomingPhoneNumberTollFreeParams) SetPathAccountSid(PathAccountSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetPhoneNumber(PhoneNumber string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetApiVersion(ApiVersion string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.ApiVersion = &ApiVersion + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetFriendlyName(FriendlyName string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsApplicationSid(SmsApplicationSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.SmsApplicationSid = &SmsApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsMethod(SmsMethod string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetSmsUrl(SmsUrl string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetStatusCallback(StatusCallback string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceApplicationSid(VoiceApplicationSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceApplicationSid = &VoiceApplicationSid + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceCallerIdLookup(VoiceCallerIdLookup bool) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceCallerIdLookup = &VoiceCallerIdLookup + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceMethod(VoiceMethod string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceUrl(VoiceUrl string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetIdentitySid(IdentitySid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.IdentitySid = &IdentitySid + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetAddressSid(AddressSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.AddressSid = &AddressSid + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetEmergencyStatus(EmergencyStatus string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.EmergencyStatus = &EmergencyStatus + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetEmergencyAddressSid(EmergencyAddressSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.EmergencyAddressSid = &EmergencyAddressSid + return params +} +func (params *CreateIncomingPhoneNumberTollFreeParams) SetTrunkSid(TrunkSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.TrunkSid = &TrunkSid + return params } -func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceReceiveMode(VoiceReceiveMode string) *CreateIncomingPhoneNumberTollFreeParams { - params.VoiceReceiveMode = &VoiceReceiveMode - return params +func (params *CreateIncomingPhoneNumberTollFreeParams) SetVoiceReceiveMode(VoiceReceiveMode string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.VoiceReceiveMode = &VoiceReceiveMode + return params } -func (params *CreateIncomingPhoneNumberTollFreeParams) SetBundleSid(BundleSid string) *CreateIncomingPhoneNumberTollFreeParams { - params.BundleSid = &BundleSid - return params +func (params *CreateIncomingPhoneNumberTollFreeParams) SetBundleSid(BundleSid string) (*CreateIncomingPhoneNumberTollFreeParams){ + params.BundleSid = &BundleSid + return params } -// +// func (c *ApiService) CreateIncomingPhoneNumberTollFree(params *CreateIncomingPhoneNumberTollFreeParams) (*ApiV2010IncomingPhoneNumberTollFree, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/TollFree.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SmsApplicationSid != nil { - data.Set("SmsApplicationSid", *params.SmsApplicationSid) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.VoiceApplicationSid != nil { - data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) - } - if params != nil && params.VoiceCallerIdLookup != nil { - data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.IdentitySid != nil { - data.Set("IdentitySid", *params.IdentitySid) - } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.EmergencyStatus != nil { - data.Set("EmergencyStatus", *params.EmergencyStatus) - } - if params != nil && params.EmergencyAddressSid != nil { - data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) - } - if params != nil && params.TrunkSid != nil { - data.Set("TrunkSid", *params.TrunkSid) - } - if params != nil && params.VoiceReceiveMode != nil { - data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) - } - if params != nil && params.BundleSid != nil { - data.Set("BundleSid", *params.BundleSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010IncomingPhoneNumberTollFree{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/TollFree.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SmsApplicationSid != nil { + data.Set("SmsApplicationSid", *params.SmsApplicationSid) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.VoiceApplicationSid != nil { + data.Set("VoiceApplicationSid", *params.VoiceApplicationSid) + } + if params != nil && params.VoiceCallerIdLookup != nil { + data.Set("VoiceCallerIdLookup", fmt.Sprint(*params.VoiceCallerIdLookup)) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.IdentitySid != nil { + data.Set("IdentitySid", *params.IdentitySid) + } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.EmergencyStatus != nil { + data.Set("EmergencyStatus", *params.EmergencyStatus) + } + if params != nil && params.EmergencyAddressSid != nil { + data.Set("EmergencyAddressSid", *params.EmergencyAddressSid) + } + if params != nil && params.TrunkSid != nil { + data.Set("TrunkSid", *params.TrunkSid) + } + if params != nil && params.VoiceReceiveMode != nil { + data.Set("VoiceReceiveMode", *params.VoiceReceiveMode) + } + if params != nil && params.BundleSid != nil { + data.Set("BundleSid", *params.BundleSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010IncomingPhoneNumberTollFree{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListIncomingPhoneNumberTollFree' type ListIncomingPhoneNumberTollFreeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. - Beta *bool `json:"Beta,omitempty"` - // A string that identifies the resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. - Origin *string `json:"Origin,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListIncomingPhoneNumberTollFreeParams) SetPathAccountSid(PathAccountSid string) *ListIncomingPhoneNumberTollFreeParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListIncomingPhoneNumberTollFreeParams) SetBeta(Beta bool) *ListIncomingPhoneNumberTollFreeParams { - params.Beta = &Beta - return params -} -func (params *ListIncomingPhoneNumberTollFreeParams) SetFriendlyName(FriendlyName string) *ListIncomingPhoneNumberTollFreeParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListIncomingPhoneNumberTollFreeParams) SetPhoneNumber(PhoneNumber string) *ListIncomingPhoneNumberTollFreeParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *ListIncomingPhoneNumberTollFreeParams) SetOrigin(Origin string) *ListIncomingPhoneNumberTollFreeParams { - params.Origin = &Origin - return params -} -func (params *ListIncomingPhoneNumberTollFreeParams) SetPageSize(PageSize int) *ListIncomingPhoneNumberTollFreeParams { - params.PageSize = &PageSize - return params -} -func (params *ListIncomingPhoneNumberTollFreeParams) SetLimit(Limit int) *ListIncomingPhoneNumberTollFreeParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. + Beta *bool `json:"Beta,omitempty"` + // A string that identifies the resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. + Origin *string `json:"Origin,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListIncomingPhoneNumberTollFreeParams) SetPathAccountSid(PathAccountSid string) (*ListIncomingPhoneNumberTollFreeParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListIncomingPhoneNumberTollFreeParams) SetBeta(Beta bool) (*ListIncomingPhoneNumberTollFreeParams){ + params.Beta = &Beta + return params +} +func (params *ListIncomingPhoneNumberTollFreeParams) SetFriendlyName(FriendlyName string) (*ListIncomingPhoneNumberTollFreeParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListIncomingPhoneNumberTollFreeParams) SetPhoneNumber(PhoneNumber string) (*ListIncomingPhoneNumberTollFreeParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *ListIncomingPhoneNumberTollFreeParams) SetOrigin(Origin string) (*ListIncomingPhoneNumberTollFreeParams){ + params.Origin = &Origin + return params +} +func (params *ListIncomingPhoneNumberTollFreeParams) SetPageSize(PageSize int) (*ListIncomingPhoneNumberTollFreeParams){ + params.PageSize = &PageSize + return params +} +func (params *ListIncomingPhoneNumberTollFreeParams) SetLimit(Limit int) (*ListIncomingPhoneNumberTollFreeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IncomingPhoneNumberTollFree records from the API. Request is executed immediately. -func (c *ApiService) PageIncomingPhoneNumberTollFree(params *ListIncomingPhoneNumberTollFreeParams, pageToken, pageNumber string) (*ListIncomingPhoneNumberTollFreeResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/TollFree.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Beta != nil { - data.Set("Beta", fmt.Sprint(*params.Beta)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.Origin != nil { - data.Set("Origin", *params.Origin) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIncomingPhoneNumberTollFreeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageIncomingPhoneNumberTollFree(params *ListIncomingPhoneNumberTollFreeParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/TollFree.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Beta != nil { + data.Set("Beta", fmt.Sprint(*params.Beta)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.Origin != nil { + data.Set("Origin", *params.Origin) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists IncomingPhoneNumberTollFree records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListIncomingPhoneNumberTollFree(params *ListIncomingPhoneNumberTollFreeParams) ([]ApiV2010IncomingPhoneNumberTollFree, error) { +func (c *ApiService) ListIncomingPhoneNumberTollFree(params *ListIncomingPhoneNumberTollFreeParams) (ListIncomingPhoneNumberTollFree200Response, error) { response, errors := c.StreamIncomingPhoneNumberTollFree(params) - records := make([]ApiV2010IncomingPhoneNumberTollFree, 0) + records := make(ListIncomingPhoneNumberTollFree200Response, 0) for record := range response { records = append(records, record) } @@ -384,13 +385,13 @@ func (c *ApiService) ListIncomingPhoneNumberTollFree(params *ListIncomingPhoneNu } // Streams IncomingPhoneNumberTollFree records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamIncomingPhoneNumberTollFree(params *ListIncomingPhoneNumberTollFreeParams) (chan ApiV2010IncomingPhoneNumberTollFree, chan error) { +func (c *ApiService) StreamIncomingPhoneNumberTollFree(params *ListIncomingPhoneNumberTollFreeParams) (chan ListIncomingPhoneNumberTollFree200Response, chan error) { if params == nil { params = &ListIncomingPhoneNumberTollFreeParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010IncomingPhoneNumberTollFree, 1) + recordChannel := make(chan ListIncomingPhoneNumberTollFree200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageIncomingPhoneNumberTollFree(params, "", "") @@ -405,11 +406,12 @@ func (c *ApiService) StreamIncomingPhoneNumberTollFree(params *ListIncomingPhone return recordChannel, errorChannel } -func (c *ApiService) streamIncomingPhoneNumberTollFree(response *ListIncomingPhoneNumberTollFreeResponse, params *ListIncomingPhoneNumberTollFreeParams, recordChannel chan ApiV2010IncomingPhoneNumberTollFree, errorChannel chan error) { + +func (c *ApiService) streamIncomingPhoneNumberTollFree(response *, params *ListIncomingPhoneNumberTollFreeParams, recordChannel chan ListIncomingPhoneNumberTollFree200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IncomingPhoneNumbers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -420,7 +422,7 @@ func (c *ApiService) streamIncomingPhoneNumberTollFree(response *ListIncomingPho } } - record, err := client.GetNext(c.baseURL, response, c.getNextListIncomingPhoneNumberTollFreeResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -428,27 +430,28 @@ func (c *ApiService) streamIncomingPhoneNumberTollFree(response *ListIncomingPho break } - response = record.(*ListIncomingPhoneNumberTollFreeResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListIncomingPhoneNumberTollFreeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIncomingPhoneNumberTollFreeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_keys.go b/rest/api/v2010/accounts_keys.go index 47e4335d5..f0eff6aeb 100644 --- a/rest/api/v2010/accounts_keys.go +++ b/rest/api/v2010/accounts_keys.go @@ -18,199 +18,204 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNewKey' type CreateNewKeyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will be responsible for the new Key resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will be responsible for the new Key resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateNewKeyParams) SetPathAccountSid(PathAccountSid string) *CreateNewKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateNewKeyParams) SetPathAccountSid(PathAccountSid string) (*CreateNewKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateNewKeyParams) SetFriendlyName(FriendlyName string) *CreateNewKeyParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateNewKeyParams) SetFriendlyName(FriendlyName string) (*CreateNewKeyParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateNewKey(params *CreateNewKeyParams) (*ApiV2010NewKey, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Keys.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/Keys.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010NewKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010NewKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteKey' type DeleteKeyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteKeyParams) SetPathAccountSid(PathAccountSid string) *DeleteKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteKeyParams) SetPathAccountSid(PathAccountSid string) (*DeleteKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -// -func (c *ApiService) DeleteKey(Sid string, params *DeleteKeyParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Keys/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteKey(Sid string, params *DeleteKeyParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Keys/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchKey' type FetchKeyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchKeyParams) SetPathAccountSid(PathAccountSid string) *FetchKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchKeyParams) SetPathAccountSid(PathAccountSid string) (*FetchKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -// +// func (c *ApiService) FetchKey(Sid string, params *FetchKeyParams) (*ApiV2010Key, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Keys/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Keys/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Key{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Key{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListKey' type ListKeyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListKeyParams) SetPathAccountSid(PathAccountSid string) *ListKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListKeyParams) SetPathAccountSid(PathAccountSid string) (*ListKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListKeyParams) SetPageSize(PageSize int) *ListKeyParams { - params.PageSize = &PageSize - return params +func (params *ListKeyParams) SetPageSize(PageSize int) (*ListKeyParams){ + params.PageSize = &PageSize + return params } -func (params *ListKeyParams) SetLimit(Limit int) *ListKeyParams { - params.Limit = &Limit - return params +func (params *ListKeyParams) SetLimit(Limit int) (*ListKeyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Key records from the API. Request is executed immediately. -func (c *ApiService) PageKey(params *ListKeyParams, pageToken, pageNumber string) (*ListKeyResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Keys.json" +func (c *ApiService) PageKey(params *ListKeyParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Keys.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListKeyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Key records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListKey(params *ListKeyParams) ([]ApiV2010Key, error) { +func (c *ApiService) ListKey(params *ListKeyParams) (ListKey200Response, error) { response, errors := c.StreamKey(params) - records := make([]ApiV2010Key, 0) + records := make(ListKey200Response, 0) for record := range response { records = append(records, record) } @@ -223,13 +228,13 @@ func (c *ApiService) ListKey(params *ListKeyParams) ([]ApiV2010Key, error) { } // Streams Key records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamKey(params *ListKeyParams) (chan ApiV2010Key, chan error) { +func (c *ApiService) StreamKey(params *ListKeyParams) (chan ListKey200Response, chan error) { if params == nil { params = &ListKeyParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Key, 1) + recordChannel := make(chan ListKey200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageKey(params, "", "") @@ -244,11 +249,12 @@ func (c *ApiService) StreamKey(params *ListKeyParams) (chan ApiV2010Key, chan er return recordChannel, errorChannel } -func (c *ApiService) streamKey(response *ListKeyResponse, params *ListKeyParams, recordChannel chan ApiV2010Key, errorChannel chan error) { + +func (c *ApiService) streamKey(response *, params *ListKeyParams, recordChannel chan ListKey200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Keys + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -259,7 +265,7 @@ func (c *ApiService) streamKey(response *ListKeyResponse, params *ListKeyParams, } } - record, err := client.GetNext(c.baseURL, response, c.getNextListKeyResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -267,76 +273,78 @@ func (c *ApiService) streamKey(response *ListKeyResponse, params *ListKeyParams, break } - response = record.(*ListKeyResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListKeyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListKeyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateKey' type UpdateKeyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateKeyParams) SetPathAccountSid(PathAccountSid string) *UpdateKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateKeyParams) SetPathAccountSid(PathAccountSid string) (*UpdateKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateKeyParams) SetFriendlyName(FriendlyName string) *UpdateKeyParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateKeyParams) SetFriendlyName(FriendlyName string) (*UpdateKeyParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateKey(Sid string, params *UpdateKeyParams) (*ApiV2010Key, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Keys/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Keys/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Key{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Key{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_messages.go b/rest/api/v2010/accounts_messages.go index f17580642..61b4cb25a 100644 --- a/rest/api/v2010/accounts_messages.go +++ b/rest/api/v2010/accounts_messages.go @@ -18,447 +18,433 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessage' type CreateMessageParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) creating the Message resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. - To *string `json:"To,omitempty"` - // The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). - StatusCallback *string `json:"StatusCallback,omitempty"` - // The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). If this parameter is provided, the `status_callback` parameter of this request is ignored; [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. - ApplicationSid *string `json:"ApplicationSid,omitempty"` - // The maximum price in US dollars that you are willing to pay for this Message's delivery. The value can have up to four decimal places. When the `max_price` parameter is provided, the cost of a message is checked before it is sent. If the cost exceeds `max_price`, the message is not sent and the Message `status` is `failed`. - MaxPrice *float32 `json:"MaxPrice,omitempty"` - // Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. - ProvideFeedback *bool `json:"ProvideFeedback,omitempty"` - // Total number of attempts made (including this request) to send the message regardless of the provider used - Attempt *int `json:"Attempt,omitempty"` - // The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) - ValidityPeriod *int `json:"ValidityPeriod,omitempty"` - // Reserved - ForceDelivery *bool `json:"ForceDelivery,omitempty"` - // - ContentRetention *string `json:"ContentRetention,omitempty"` - // - AddressRetention *string `json:"AddressRetention,omitempty"` - // Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. - SmartEncoded *bool `json:"SmartEncoded,omitempty"` - // Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). - PersistentAction *[]string `json:"PersistentAction,omitempty"` - // For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/how-to-configure-link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. - ShortenUrls *bool `json:"ShortenUrls,omitempty"` - // - ScheduleType *string `json:"ScheduleType,omitempty"` - // The time that Twilio will send the message. Must be in ISO 8601 format. - SendAt *time.Time `json:"SendAt,omitempty"` - // If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. - SendAsMms *bool `json:"SendAsMms,omitempty"` - // For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. - ContentVariables *string `json:"ContentVariables,omitempty"` - // - RiskCheck *string `json:"RiskCheck,omitempty"` - // The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. - From *string `json:"From,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // The text content of the outgoing message. Can be up to 1,600 characters in length. SMS only: If the `body` contains more than 160 [GSM-7](https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding) characters (or 70 [UCS-2](https://www.twilio.com/docs/glossary/what-is-ucs-2-character-encoding) characters), the message is segmented and charged accordingly. For long `body` text, consider using the [send_as_mms parameter](https://www.twilio.com/blog/mms-for-long-text-messages). - Body *string `json:"Body,omitempty"` - // The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. - MediaUrl *[]string `json:"MediaUrl,omitempty"` - // For [Content Editor/API](https://www.twilio.com/docs/content) only: The SID of the Content Template to be used with the Message, e.g., `HXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`. If this parameter is not provided, a Content Template is not used. Find the SID in the Console on the Content Editor page. For Content API users, the SID is found in Twilio's response when [creating the Template](https://www.twilio.com/docs/content/content-api-resources#create-templates) or by [fetching your Templates](https://www.twilio.com/docs/content/content-api-resources#fetch-all-content-resources). - ContentSid *string `json:"ContentSid,omitempty"` -} - -func (params *CreateMessageParams) SetPathAccountSid(PathAccountSid string) *CreateMessageParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateMessageParams) SetTo(To string) *CreateMessageParams { - params.To = &To - return params -} -func (params *CreateMessageParams) SetStatusCallback(StatusCallback string) *CreateMessageParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateMessageParams) SetApplicationSid(ApplicationSid string) *CreateMessageParams { - params.ApplicationSid = &ApplicationSid - return params -} -func (params *CreateMessageParams) SetMaxPrice(MaxPrice float32) *CreateMessageParams { - params.MaxPrice = &MaxPrice - return params -} -func (params *CreateMessageParams) SetProvideFeedback(ProvideFeedback bool) *CreateMessageParams { - params.ProvideFeedback = &ProvideFeedback - return params -} -func (params *CreateMessageParams) SetAttempt(Attempt int) *CreateMessageParams { - params.Attempt = &Attempt - return params -} -func (params *CreateMessageParams) SetValidityPeriod(ValidityPeriod int) *CreateMessageParams { - params.ValidityPeriod = &ValidityPeriod - return params -} -func (params *CreateMessageParams) SetForceDelivery(ForceDelivery bool) *CreateMessageParams { - params.ForceDelivery = &ForceDelivery - return params -} -func (params *CreateMessageParams) SetContentRetention(ContentRetention string) *CreateMessageParams { - params.ContentRetention = &ContentRetention - return params -} -func (params *CreateMessageParams) SetAddressRetention(AddressRetention string) *CreateMessageParams { - params.AddressRetention = &AddressRetention - return params -} -func (params *CreateMessageParams) SetSmartEncoded(SmartEncoded bool) *CreateMessageParams { - params.SmartEncoded = &SmartEncoded - return params -} -func (params *CreateMessageParams) SetPersistentAction(PersistentAction []string) *CreateMessageParams { - params.PersistentAction = &PersistentAction - return params -} -func (params *CreateMessageParams) SetShortenUrls(ShortenUrls bool) *CreateMessageParams { - params.ShortenUrls = &ShortenUrls - return params -} -func (params *CreateMessageParams) SetScheduleType(ScheduleType string) *CreateMessageParams { - params.ScheduleType = &ScheduleType - return params -} -func (params *CreateMessageParams) SetSendAt(SendAt time.Time) *CreateMessageParams { - params.SendAt = &SendAt - return params -} -func (params *CreateMessageParams) SetSendAsMms(SendAsMms bool) *CreateMessageParams { - params.SendAsMms = &SendAsMms - return params -} -func (params *CreateMessageParams) SetContentVariables(ContentVariables string) *CreateMessageParams { - params.ContentVariables = &ContentVariables - return params -} -func (params *CreateMessageParams) SetRiskCheck(RiskCheck string) *CreateMessageParams { - params.RiskCheck = &RiskCheck - return params -} -func (params *CreateMessageParams) SetFrom(From string) *CreateMessageParams { - params.From = &From - return params -} -func (params *CreateMessageParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateMessageParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *CreateMessageParams) SetBody(Body string) *CreateMessageParams { - params.Body = &Body - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) creating the Message resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. + To *string `json:"To,omitempty"` + // The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). + StatusCallback *string `json:"StatusCallback,omitempty"` + // The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). If this parameter is provided, the `status_callback` parameter of this request is ignored; [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. + ApplicationSid *string `json:"ApplicationSid,omitempty"` + // The maximum price in US dollars that you are willing to pay for this Message's delivery. The value can have up to four decimal places. When the `max_price` parameter is provided, the cost of a message is checked before it is sent. If the cost exceeds `max_price`, the message is not sent and the Message `status` is `failed`. + MaxPrice *float32 `json:"MaxPrice,omitempty"` + // Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. + ProvideFeedback *bool `json:"ProvideFeedback,omitempty"` + // Total number of attempts made (including this request) to send the message regardless of the provider used + Attempt *int `json:"Attempt,omitempty"` + // The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) + ValidityPeriod *int `json:"ValidityPeriod,omitempty"` + // Reserved + ForceDelivery *bool `json:"ForceDelivery,omitempty"` + // + ContentRetention *string `json:"ContentRetention,omitempty"` + // + AddressRetention *string `json:"AddressRetention,omitempty"` + // Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. + SmartEncoded *bool `json:"SmartEncoded,omitempty"` + // Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). + PersistentAction *[]string `json:"PersistentAction,omitempty"` + // For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/how-to-configure-link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. + ShortenUrls *bool `json:"ShortenUrls,omitempty"` + // + ScheduleType *string `json:"ScheduleType,omitempty"` + // The time that Twilio will send the message. Must be in ISO 8601 format. + SendAt *time.Time `json:"SendAt,omitempty"` + // If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. + SendAsMms *bool `json:"SendAsMms,omitempty"` + // For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. + ContentVariables *string `json:"ContentVariables,omitempty"` + // + RiskCheck *string `json:"RiskCheck,omitempty"` + // The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. + From *string `json:"From,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // The text content of the outgoing message. Can be up to 1,600 characters in length. SMS only: If the `body` contains more than 160 [GSM-7](https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding) characters (or 70 [UCS-2](https://www.twilio.com/docs/glossary/what-is-ucs-2-character-encoding) characters), the message is segmented and charged accordingly. For long `body` text, consider using the [send_as_mms parameter](https://www.twilio.com/blog/mms-for-long-text-messages). + Body *string `json:"Body,omitempty"` + // The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. + MediaUrl *[]string `json:"MediaUrl,omitempty"` + // For [Content Editor/API](https://www.twilio.com/docs/content) only: The SID of the Content Template to be used with the Message, e.g., `HXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`. If this parameter is not provided, a Content Template is not used. Find the SID in the Console on the Content Editor page. For Content API users, the SID is found in Twilio's response when [creating the Template](https://www.twilio.com/docs/content/content-api-resources#create-templates) or by [fetching your Templates](https://www.twilio.com/docs/content/content-api-resources#fetch-all-content-resources). + ContentSid *string `json:"ContentSid,omitempty"` +} + +func (params *CreateMessageParams) SetPathAccountSid(PathAccountSid string) (*CreateMessageParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateMessageParams) SetTo(To string) (*CreateMessageParams){ + params.To = &To + return params +} +func (params *CreateMessageParams) SetStatusCallback(StatusCallback string) (*CreateMessageParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateMessageParams) SetApplicationSid(ApplicationSid string) (*CreateMessageParams){ + params.ApplicationSid = &ApplicationSid + return params +} +func (params *CreateMessageParams) SetMaxPrice(MaxPrice float32) (*CreateMessageParams){ + params.MaxPrice = &MaxPrice + return params +} +func (params *CreateMessageParams) SetProvideFeedback(ProvideFeedback bool) (*CreateMessageParams){ + params.ProvideFeedback = &ProvideFeedback + return params +} +func (params *CreateMessageParams) SetAttempt(Attempt int) (*CreateMessageParams){ + params.Attempt = &Attempt + return params +} +func (params *CreateMessageParams) SetValidityPeriod(ValidityPeriod int) (*CreateMessageParams){ + params.ValidityPeriod = &ValidityPeriod + return params +} +func (params *CreateMessageParams) SetForceDelivery(ForceDelivery bool) (*CreateMessageParams){ + params.ForceDelivery = &ForceDelivery + return params +} +func (params *CreateMessageParams) SetContentRetention(ContentRetention string) (*CreateMessageParams){ + params.ContentRetention = &ContentRetention + return params +} +func (params *CreateMessageParams) SetAddressRetention(AddressRetention string) (*CreateMessageParams){ + params.AddressRetention = &AddressRetention + return params +} +func (params *CreateMessageParams) SetSmartEncoded(SmartEncoded bool) (*CreateMessageParams){ + params.SmartEncoded = &SmartEncoded + return params +} +func (params *CreateMessageParams) SetPersistentAction(PersistentAction []string) (*CreateMessageParams){ + params.PersistentAction = &PersistentAction + return params +} +func (params *CreateMessageParams) SetShortenUrls(ShortenUrls bool) (*CreateMessageParams){ + params.ShortenUrls = &ShortenUrls + return params +} +func (params *CreateMessageParams) SetScheduleType(ScheduleType string) (*CreateMessageParams){ + params.ScheduleType = &ScheduleType + return params +} +func (params *CreateMessageParams) SetSendAt(SendAt time.Time) (*CreateMessageParams){ + params.SendAt = &SendAt + return params +} +func (params *CreateMessageParams) SetSendAsMms(SendAsMms bool) (*CreateMessageParams){ + params.SendAsMms = &SendAsMms + return params +} +func (params *CreateMessageParams) SetContentVariables(ContentVariables string) (*CreateMessageParams){ + params.ContentVariables = &ContentVariables + return params +} +func (params *CreateMessageParams) SetRiskCheck(RiskCheck string) (*CreateMessageParams){ + params.RiskCheck = &RiskCheck + return params +} +func (params *CreateMessageParams) SetFrom(From string) (*CreateMessageParams){ + params.From = &From + return params +} +func (params *CreateMessageParams) SetMessagingServiceSid(MessagingServiceSid string) (*CreateMessageParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *CreateMessageParams) SetBody(Body string) (*CreateMessageParams){ + params.Body = &Body + return params } -func (params *CreateMessageParams) SetMediaUrl(MediaUrl []string) *CreateMessageParams { - params.MediaUrl = &MediaUrl - return params +func (params *CreateMessageParams) SetMediaUrl(MediaUrl []string) (*CreateMessageParams){ + params.MediaUrl = &MediaUrl + return params } -func (params *CreateMessageParams) SetContentSid(ContentSid string) *CreateMessageParams { - params.ContentSid = &ContentSid - return params +func (params *CreateMessageParams) SetContentSid(ContentSid string) (*CreateMessageParams){ + params.ContentSid = &ContentSid + return params } // Send a message func (c *ApiService) CreateMessage(params *CreateMessageParams) (*ApiV2010Message, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.ApplicationSid != nil { - data.Set("ApplicationSid", *params.ApplicationSid) - } - if params != nil && params.MaxPrice != nil { - data.Set("MaxPrice", fmt.Sprint(*params.MaxPrice)) - } - if params != nil && params.ProvideFeedback != nil { - data.Set("ProvideFeedback", fmt.Sprint(*params.ProvideFeedback)) - } - if params != nil && params.Attempt != nil { - data.Set("Attempt", fmt.Sprint(*params.Attempt)) - } - if params != nil && params.ValidityPeriod != nil { - data.Set("ValidityPeriod", fmt.Sprint(*params.ValidityPeriod)) - } - if params != nil && params.ForceDelivery != nil { - data.Set("ForceDelivery", fmt.Sprint(*params.ForceDelivery)) - } - if params != nil && params.ContentRetention != nil { - data.Set("ContentRetention", *params.ContentRetention) - } - if params != nil && params.AddressRetention != nil { - data.Set("AddressRetention", *params.AddressRetention) - } - if params != nil && params.SmartEncoded != nil { - data.Set("SmartEncoded", fmt.Sprint(*params.SmartEncoded)) - } - if params != nil && params.PersistentAction != nil { - for _, item := range *params.PersistentAction { - data.Add("PersistentAction", item) - } - } - if params != nil && params.ShortenUrls != nil { - data.Set("ShortenUrls", fmt.Sprint(*params.ShortenUrls)) - } - if params != nil && params.ScheduleType != nil { - data.Set("ScheduleType", *params.ScheduleType) - } - if params != nil && params.SendAt != nil { - data.Set("SendAt", fmt.Sprint((*params.SendAt).Format(time.RFC3339))) - } - if params != nil && params.SendAsMms != nil { - data.Set("SendAsMms", fmt.Sprint(*params.SendAsMms)) - } - if params != nil && params.ContentVariables != nil { - data.Set("ContentVariables", *params.ContentVariables) - } - if params != nil && params.RiskCheck != nil { - data.Set("RiskCheck", *params.RiskCheck) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.MediaUrl != nil { - for _, item := range *params.MediaUrl { - data.Add("MediaUrl", item) - } - } - if params != nil && params.ContentSid != nil { - data.Set("ContentSid", *params.ContentSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Messages.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.ApplicationSid != nil { + data.Set("ApplicationSid", *params.ApplicationSid) + } + if params != nil && params.MaxPrice != nil { + data.Set("MaxPrice", fmt.Sprint(*params.MaxPrice)) + } + if params != nil && params.ProvideFeedback != nil { + data.Set("ProvideFeedback", fmt.Sprint(*params.ProvideFeedback)) + } + if params != nil && params.Attempt != nil { + data.Set("Attempt", fmt.Sprint(*params.Attempt)) + } + if params != nil && params.ValidityPeriod != nil { + data.Set("ValidityPeriod", fmt.Sprint(*params.ValidityPeriod)) + } + if params != nil && params.ForceDelivery != nil { + data.Set("ForceDelivery", fmt.Sprint(*params.ForceDelivery)) + } + if params != nil && params.ContentRetention != nil { + data.Set("ContentRetention", *params.ContentRetention) + } + if params != nil && params.AddressRetention != nil { + data.Set("AddressRetention", *params.AddressRetention) + } + if params != nil && params.SmartEncoded != nil { + data.Set("SmartEncoded", fmt.Sprint(*params.SmartEncoded)) + } + if params != nil && params.PersistentAction != nil { + for _, item := range *params.PersistentAction { + data.Add("PersistentAction", item) + } + } + if params != nil && params.ShortenUrls != nil { + data.Set("ShortenUrls", fmt.Sprint(*params.ShortenUrls)) + } + if params != nil && params.ScheduleType != nil { + data.Set("ScheduleType", *params.ScheduleType) + } + if params != nil && params.SendAt != nil { + data.Set("SendAt", fmt.Sprint((*params.SendAt).Format(time.RFC3339))) + } + if params != nil && params.SendAsMms != nil { + data.Set("SendAsMms", fmt.Sprint(*params.SendAsMms)) + } + if params != nil && params.ContentVariables != nil { + data.Set("ContentVariables", *params.ContentVariables) + } + if params != nil && params.RiskCheck != nil { + data.Set("RiskCheck", *params.RiskCheck) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.MediaUrl != nil { + for _, item := range *params.MediaUrl { + data.Add("MediaUrl", item) + } + } + if params != nil && params.ContentSid != nil { + data.Set("ContentSid", *params.ContentSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteMessage' type DeleteMessageParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteMessageParams) SetPathAccountSid(PathAccountSid string) *DeleteMessageParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteMessageParams) SetPathAccountSid(PathAccountSid string) (*DeleteMessageParams){ + params.PathAccountSid = &PathAccountSid + return params } // Deletes a Message resource from your account -func (c *ApiService) DeleteMessage(Sid string, params *DeleteMessageParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteMessage(Sid string, params *DeleteMessageParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchMessage' type FetchMessageParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchMessageParams) SetPathAccountSid(PathAccountSid string) *FetchMessageParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchMessageParams) SetPathAccountSid(PathAccountSid string) (*FetchMessageParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a specific Message func (c *ApiService) FetchMessage(Sid string, params *FetchMessageParams) (*ApiV2010Message, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListMessage' type ListMessageParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` - To *string `json:"To,omitempty"` - // Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` - From *string `json:"From,omitempty"` - // Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - DateSent *time.Time `json:"DateSent,omitempty"` - // Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - DateSentBefore *time.Time `json:"DateSent<,omitempty"` - // Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - DateSentAfter *time.Time `json:"DateSent>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListMessageParams) SetPathAccountSid(PathAccountSid string) *ListMessageParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListMessageParams) SetTo(To string) *ListMessageParams { - params.To = &To - return params -} -func (params *ListMessageParams) SetFrom(From string) *ListMessageParams { - params.From = &From - return params -} -func (params *ListMessageParams) SetDateSent(DateSent time.Time) *ListMessageParams { - params.DateSent = &DateSent - return params -} -func (params *ListMessageParams) SetDateSentBefore(DateSentBefore time.Time) *ListMessageParams { - params.DateSentBefore = &DateSentBefore - return params -} -func (params *ListMessageParams) SetDateSentAfter(DateSentAfter time.Time) *ListMessageParams { - params.DateSentAfter = &DateSentAfter - return params -} -func (params *ListMessageParams) SetPageSize(PageSize int) *ListMessageParams { - params.PageSize = &PageSize - return params -} -func (params *ListMessageParams) SetLimit(Limit int) *ListMessageParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` + To *string `json:"To,omitempty"` + // Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` + From *string `json:"From,omitempty"` + // Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). + DateSent *time.Time `json:"DateSent,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListMessageParams) SetPathAccountSid(PathAccountSid string) (*ListMessageParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListMessageParams) SetTo(To string) (*ListMessageParams){ + params.To = &To + return params +} +func (params *ListMessageParams) SetFrom(From string) (*ListMessageParams){ + params.From = &From + return params +} +func (params *ListMessageParams) SetDateSent(DateSent time.Time) (*ListMessageParams){ + params.DateSent = &DateSent + return params +} +func (params *ListMessageParams) SetPageSize(PageSize int) (*ListMessageParams){ + params.PageSize = &PageSize + return params +} +func (params *ListMessageParams) SetLimit(Limit int) (*ListMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Message records from the API. Request is executed immediately. -func (c *ApiService) PageMessage(params *ListMessageParams, pageToken, pageNumber string) (*ListMessageResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages.json" +func (c *ApiService) PageMessage(params *ListMessageParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Messages.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.DateSent != nil { - data.Set("DateSent", fmt.Sprint((*params.DateSent).Format(time.RFC3339))) - } - if params != nil && params.DateSentBefore != nil { - data.Set("DateSent<", fmt.Sprint((*params.DateSentBefore).Format(time.RFC3339))) - } - if params != nil && params.DateSentAfter != nil { - data.Set("DateSent>", fmt.Sprint((*params.DateSentAfter).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.DateSent != nil { + data.Set("DateSent", fmt.Sprint((*params.DateSent).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Message records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListMessage(params *ListMessageParams) ([]ApiV2010Message, error) { +func (c *ApiService) ListMessage(params *ListMessageParams) (ListMessage200Response, error) { response, errors := c.StreamMessage(params) - records := make([]ApiV2010Message, 0) + records := make(ListMessage200Response, 0) for record := range response { records = append(records, record) } @@ -471,13 +457,13 @@ func (c *ApiService) ListMessage(params *ListMessageParams) ([]ApiV2010Message, } // Streams Message records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamMessage(params *ListMessageParams) (chan ApiV2010Message, chan error) { +func (c *ApiService) StreamMessage(params *ListMessageParams) (chan ListMessage200Response, chan error) { if params == nil { params = &ListMessageParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Message, 1) + recordChannel := make(chan ListMessage200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageMessage(params, "", "") @@ -492,11 +478,12 @@ func (c *ApiService) StreamMessage(params *ListMessageParams) (chan ApiV2010Mess return recordChannel, errorChannel } -func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMessageParams, recordChannel chan ApiV2010Message, errorChannel chan error) { + +func (c *ApiService) streamMessage(response *, params *ListMessageParams, recordChannel chan ListMessage200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Messages + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -507,7 +494,7 @@ func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMe } } - record, err := client.GetNext(c.baseURL, response, c.getNextListMessageResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -515,85 +502,87 @@ func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMe break } - response = record.(*ListMessageResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMessage' type UpdateMessageParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The new `body` of the Message resource. To redact the text content of a Message, this parameter's value must be an empty string - Body *string `json:"Body,omitempty"` - // - Status *string `json:"Status,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The new `body` of the Message resource. To redact the text content of a Message, this parameter's value must be an empty string + Body *string `json:"Body,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateMessageParams) SetPathAccountSid(PathAccountSid string) *UpdateMessageParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateMessageParams) SetPathAccountSid(PathAccountSid string) (*UpdateMessageParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateMessageParams) SetBody(Body string) *UpdateMessageParams { - params.Body = &Body - return params +func (params *UpdateMessageParams) SetBody(Body string) (*UpdateMessageParams){ + params.Body = &Body + return params } -func (params *UpdateMessageParams) SetStatus(Status string) *UpdateMessageParams { - params.Status = &Status - return params +func (params *UpdateMessageParams) SetStatus(Status string) (*UpdateMessageParams){ + params.Status = &Status + return params } // Update a Message resource (used to redact Message `body` text and to cancel not-yet-sent messages) func (c *ApiService) UpdateMessage(Sid string, params *UpdateMessageParams) (*ApiV2010Message, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_messages_feedback.go b/rest/api/v2010/accounts_messages_feedback.go index 43e0a8e26..d7c6509f8 100644 --- a/rest/api/v2010/accounts_messages_feedback.go +++ b/rest/api/v2010/accounts_messages_feedback.go @@ -16,55 +16,59 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessageFeedback' type CreateMessageFeedbackParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource for which to create MessageFeedback. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - Outcome *string `json:"Outcome,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource for which to create MessageFeedback. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + Outcome *string `json:"Outcome,omitempty"` } -func (params *CreateMessageFeedbackParams) SetPathAccountSid(PathAccountSid string) *CreateMessageFeedbackParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateMessageFeedbackParams) SetPathAccountSid(PathAccountSid string) (*CreateMessageFeedbackParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateMessageFeedbackParams) SetOutcome(Outcome string) *CreateMessageFeedbackParams { - params.Outcome = &Outcome - return params +func (params *CreateMessageFeedbackParams) SetOutcome(Outcome string) (*CreateMessageFeedbackParams){ + params.Outcome = &Outcome + return params } // Create Message Feedback to confirm a tracked user action was performed by the recipient of the associated Message func (c *ApiService) CreateMessageFeedback(MessageSid string, params *CreateMessageFeedbackParams) (*ApiV2010MessageFeedback, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Feedback.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Feedback.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Outcome != nil { + data.Set("Outcome", *params.Outcome) + } - if params != nil && params.Outcome != nil { - data.Set("Outcome", *params.Outcome) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010MessageFeedback{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010MessageFeedback{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_messages_media.go b/rest/api/v2010/accounts_messages_media.go index 4f0f81578..573a501af 100644 --- a/rest/api/v2010/accounts_messages_media.go +++ b/rest/api/v2010/accounts_messages_media.go @@ -18,182 +18,185 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteMedia' type DeleteMediaParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is associated with the Media resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is associated with the Media resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteMediaParams) SetPathAccountSid(PathAccountSid string) *DeleteMediaParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteMediaParams) SetPathAccountSid(PathAccountSid string) (*DeleteMediaParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete the Media resource. -func (c *ApiService) DeleteMedia(MessageSid string, Sid string, params *DeleteMediaParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteMedia(MessageSid string, Sid string, params *DeleteMediaParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchMedia' type FetchMediaParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Media resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Media resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchMediaParams) SetPathAccountSid(PathAccountSid string) *FetchMediaParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchMediaParams) SetPathAccountSid(PathAccountSid string) (*FetchMediaParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a single Media resource associated with a specific Message resource func (c *ApiService) FetchMedia(MessageSid string, Sid string, params *FetchMediaParams) (*ApiV2010Media, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Media{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ApiV2010Media{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMedia' type ListMediaParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is associated with the Media resources. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. - DateCreatedBefore *time.Time `json:"DateCreated<,omitempty"` - // Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. - DateCreatedAfter *time.Time `json:"DateCreated>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is associated with the Media resources. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. + DateCreatedBefore *time.Time `json:"DateCreated<,omitempty"` + // Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date. + DateCreatedAfter *time.Time `json:"DateCreated>,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMediaParams) SetPathAccountSid(PathAccountSid string) *ListMediaParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListMediaParams) SetPathAccountSid(PathAccountSid string) (*ListMediaParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListMediaParams) SetDateCreated(DateCreated time.Time) *ListMediaParams { - params.DateCreated = &DateCreated - return params +func (params *ListMediaParams) SetDateCreated(DateCreated time.Time) (*ListMediaParams){ + params.DateCreated = &DateCreated + return params } -func (params *ListMediaParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListMediaParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListMediaParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListMediaParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListMediaParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListMediaParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListMediaParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListMediaParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListMediaParams) SetPageSize(PageSize int) *ListMediaParams { - params.PageSize = &PageSize - return params +func (params *ListMediaParams) SetPageSize(PageSize int) (*ListMediaParams){ + params.PageSize = &PageSize + return params } -func (params *ListMediaParams) SetLimit(Limit int) *ListMediaParams { - params.Limit = &Limit - return params +func (params *ListMediaParams) SetLimit(Limit int) (*ListMediaParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Media records from the API. Request is executed immediately. -func (c *ApiService) PageMedia(MessageSid string, params *ListMediaParams, pageToken, pageNumber string) (*ListMediaResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) +func (c *ApiService) PageMedia(MessageSid string, params *ListMediaParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Media.json" - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreated<", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreated>", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMediaResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreated<", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreated>", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Media records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListMedia(MessageSid string, params *ListMediaParams) ([]ApiV2010Media, error) { +func (c *ApiService) ListMedia(MessageSid string, params *ListMediaParams) (ListMedia200Response, error) { response, errors := c.StreamMedia(MessageSid, params) - records := make([]ApiV2010Media, 0) + records := make(ListMedia200Response, 0) for record := range response { records = append(records, record) } @@ -206,13 +209,13 @@ func (c *ApiService) ListMedia(MessageSid string, params *ListMediaParams) ([]Ap } // Streams Media records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamMedia(MessageSid string, params *ListMediaParams) (chan ApiV2010Media, chan error) { +func (c *ApiService) StreamMedia(MessageSid string, params *ListMediaParams) (chan ListMedia200Response, chan error) { if params == nil { params = &ListMediaParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Media, 1) + recordChannel := make(chan ListMedia200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageMedia(MessageSid, params, "", "") @@ -227,11 +230,12 @@ func (c *ApiService) StreamMedia(MessageSid string, params *ListMediaParams) (ch return recordChannel, errorChannel } -func (c *ApiService) streamMedia(response *ListMediaResponse, params *ListMediaParams, recordChannel chan ApiV2010Media, errorChannel chan error) { + +func (c *ApiService) streamMedia(response *, params *ListMediaParams, recordChannel chan ListMedia200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.MediaList + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -242,7 +246,7 @@ func (c *ApiService) streamMedia(response *ListMediaResponse, params *ListMediaP } } - record, err := client.GetNext(c.baseURL, response, c.getNextListMediaResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -250,27 +254,28 @@ func (c *ApiService) streamMedia(response *ListMediaResponse, params *ListMediaP break } - response = record.(*ListMediaResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListMediaResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMediaResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_notifications.go b/rest/api/v2010/accounts_notifications.go index 4151a7021..893696be7 100644 --- a/rest/api/v2010/accounts_notifications.go +++ b/rest/api/v2010/accounts_notifications.go @@ -18,153 +18,155 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchNotification' type FetchNotificationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchNotificationParams) SetPathAccountSid(PathAccountSid string) *FetchNotificationParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchNotificationParams) SetPathAccountSid(PathAccountSid string) (*FetchNotificationParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a notification belonging to the account used to make the request func (c *ApiService) FetchNotification(Sid string, params *FetchNotificationParams) (*ApiV2010NotificationInstance, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Notifications/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Notifications/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010NotificationInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010NotificationInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListNotification' type ListNotificationParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. - Log *int `json:"Log,omitempty"` - // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. - MessageDate *string `json:"MessageDate,omitempty"` - // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. - MessageDateBefore *string `json:"MessageDate<,omitempty"` - // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. - MessageDateAfter *string `json:"MessageDate>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListNotificationParams) SetPathAccountSid(PathAccountSid string) *ListNotificationParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *ListNotificationParams) SetLog(Log int) *ListNotificationParams { - params.Log = &Log - return params -} -func (params *ListNotificationParams) SetMessageDate(MessageDate string) *ListNotificationParams { - params.MessageDate = &MessageDate - return params -} -func (params *ListNotificationParams) SetMessageDateBefore(MessageDateBefore string) *ListNotificationParams { - params.MessageDateBefore = &MessageDateBefore - return params -} -func (params *ListNotificationParams) SetMessageDateAfter(MessageDateAfter string) *ListNotificationParams { - params.MessageDateAfter = &MessageDateAfter - return params -} -func (params *ListNotificationParams) SetPageSize(PageSize int) *ListNotificationParams { - params.PageSize = &PageSize - return params -} -func (params *ListNotificationParams) SetLimit(Limit int) *ListNotificationParams { - params.Limit = &Limit - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. + Log *int `json:"Log,omitempty"` + // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. + MessageDate *string `json:"MessageDate,omitempty"` + // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. + MessageDateBefore *string `json:"MessageDate<,omitempty"` + // Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. + MessageDateAfter *string `json:"MessageDate>,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListNotificationParams) SetPathAccountSid(PathAccountSid string) (*ListNotificationParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *ListNotificationParams) SetLog(Log int) (*ListNotificationParams){ + params.Log = &Log + return params +} +func (params *ListNotificationParams) SetMessageDate(MessageDate string) (*ListNotificationParams){ + params.MessageDate = &MessageDate + return params +} +func (params *ListNotificationParams) SetMessageDateBefore(MessageDateBefore string) (*ListNotificationParams){ + params.MessageDateBefore = &MessageDateBefore + return params +} +func (params *ListNotificationParams) SetMessageDateAfter(MessageDateAfter string) (*ListNotificationParams){ + params.MessageDateAfter = &MessageDateAfter + return params +} +func (params *ListNotificationParams) SetPageSize(PageSize int) (*ListNotificationParams){ + params.PageSize = &PageSize + return params +} +func (params *ListNotificationParams) SetLimit(Limit int) (*ListNotificationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Notification records from the API. Request is executed immediately. -func (c *ApiService) PageNotification(params *ListNotificationParams, pageToken, pageNumber string) (*ListNotificationResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Notifications.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Log != nil { - data.Set("Log", fmt.Sprint(*params.Log)) - } - if params != nil && params.MessageDate != nil { - data.Set("MessageDate", fmt.Sprint(*params.MessageDate)) - } - if params != nil && params.MessageDateBefore != nil { - data.Set("MessageDate<", fmt.Sprint(*params.MessageDateBefore)) - } - if params != nil && params.MessageDateAfter != nil { - data.Set("MessageDate>", fmt.Sprint(*params.MessageDateAfter)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListNotificationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err +func (c *ApiService) PageNotification(params *ListNotificationParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Notifications.json" + + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Log != nil { + data.Set("Log", fmt.Sprint(*params.Log)) + } + if params != nil && params.MessageDate != nil { + data.Set("MessageDate", fmt.Sprint(*params.MessageDate)) + } + if params != nil && params.MessageDateBefore != nil { + data.Set("MessageDate<", fmt.Sprint(*params.MessageDateBefore)) + } + if params != nil && params.MessageDateAfter != nil { + data.Set("MessageDate>", fmt.Sprint(*params.MessageDateAfter)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Notification records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListNotification(params *ListNotificationParams) ([]ApiV2010Notification, error) { +func (c *ApiService) ListNotification(params *ListNotificationParams) (ListNotification200Response, error) { response, errors := c.StreamNotification(params) - records := make([]ApiV2010Notification, 0) + records := make(ListNotification200Response, 0) for record := range response { records = append(records, record) } @@ -177,13 +179,13 @@ func (c *ApiService) ListNotification(params *ListNotificationParams) ([]ApiV201 } // Streams Notification records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamNotification(params *ListNotificationParams) (chan ApiV2010Notification, chan error) { +func (c *ApiService) StreamNotification(params *ListNotificationParams) (chan ListNotification200Response, chan error) { if params == nil { params = &ListNotificationParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Notification, 1) + recordChannel := make(chan ListNotification200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageNotification(params, "", "") @@ -198,11 +200,12 @@ func (c *ApiService) StreamNotification(params *ListNotificationParams) (chan Ap return recordChannel, errorChannel } -func (c *ApiService) streamNotification(response *ListNotificationResponse, params *ListNotificationParams, recordChannel chan ApiV2010Notification, errorChannel chan error) { + +func (c *ApiService) streamNotification(response *, params *ListNotificationParams, recordChannel chan ListNotification200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Notifications + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -213,7 +216,7 @@ func (c *ApiService) streamNotification(response *ListNotificationResponse, para } } - record, err := client.GetNext(c.baseURL, response, c.getNextListNotificationResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -221,27 +224,28 @@ func (c *ApiService) streamNotification(response *ListNotificationResponse, para break } - response = record.(*ListNotificationResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListNotificationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListNotificationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_outgoing_caller_ids.go b/rest/api/v2010/accounts_outgoing_caller_ids.go index 1d91a9389..35f8a566f 100644 --- a/rest/api/v2010/accounts_outgoing_caller_ids.go +++ b/rest/api/v2010/accounts_outgoing_caller_ids.go @@ -18,262 +18,267 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateValidationRequest' type CreateValidationRequestParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the new caller ID resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // A descriptive string that you create to describe the new caller ID resource. It can be up to 64 characters long. The default value is a formatted version of the phone number. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The number of seconds to delay before initiating the verification call. Can be an integer between `0` and `60`, inclusive. The default is `0`. - CallDelay *int `json:"CallDelay,omitempty"` - // The digits to dial after connecting the verification call. - Extension *string `json:"Extension,omitempty"` - // The URL we should call using the `status_callback_method` to send status information about the verification process to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`, and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` -} - -func (params *CreateValidationRequestParams) SetPathAccountSid(PathAccountSid string) *CreateValidationRequestParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateValidationRequestParams) SetPhoneNumber(PhoneNumber string) *CreateValidationRequestParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *CreateValidationRequestParams) SetFriendlyName(FriendlyName string) *CreateValidationRequestParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateValidationRequestParams) SetCallDelay(CallDelay int) *CreateValidationRequestParams { - params.CallDelay = &CallDelay - return params -} -func (params *CreateValidationRequestParams) SetExtension(Extension string) *CreateValidationRequestParams { - params.Extension = &Extension - return params -} -func (params *CreateValidationRequestParams) SetStatusCallback(StatusCallback string) *CreateValidationRequestParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateValidationRequestParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateValidationRequestParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} - -// -func (c *ApiService) CreateValidationRequest(params *CreateValidationRequestParams) (*ApiV2010ValidationRequest, error) { - path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CallDelay != nil { - data.Set("CallDelay", fmt.Sprint(*params.CallDelay)) - } - if params != nil && params.Extension != nil { - data.Set("Extension", *params.Extension) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the new caller ID resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // A descriptive string that you create to describe the new caller ID resource. It can be up to 64 characters long. The default value is a formatted version of the phone number. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The number of seconds to delay before initiating the verification call. Can be an integer between `0` and `60`, inclusive. The default is `0`. + CallDelay *int `json:"CallDelay,omitempty"` + // The digits to dial after connecting the verification call. + Extension *string `json:"Extension,omitempty"` + // The URL we should call using the `status_callback_method` to send status information about the verification process to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`, and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` +} - defer resp.Body.Close() +func (params *CreateValidationRequestParams) SetPathAccountSid(PathAccountSid string) (*CreateValidationRequestParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateValidationRequestParams) SetPhoneNumber(PhoneNumber string) (*CreateValidationRequestParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *CreateValidationRequestParams) SetFriendlyName(FriendlyName string) (*CreateValidationRequestParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateValidationRequestParams) SetCallDelay(CallDelay int) (*CreateValidationRequestParams){ + params.CallDelay = &CallDelay + return params +} +func (params *CreateValidationRequestParams) SetExtension(Extension string) (*CreateValidationRequestParams){ + params.Extension = &Extension + return params +} +func (params *CreateValidationRequestParams) SetStatusCallback(StatusCallback string) (*CreateValidationRequestParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateValidationRequestParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateValidationRequestParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} - ps := &ApiV2010ValidationRequest{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } +// +func (c *ApiService) CreateValidationRequest(params *CreateValidationRequestParams) (*ApiV2010ValidationRequest, error) { + path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CallDelay != nil { + data.Set("CallDelay", fmt.Sprint(*params.CallDelay)) + } + if params != nil && params.Extension != nil { + data.Set("Extension", *params.Extension) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010ValidationRequest{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteOutgoingCallerId' type DeleteOutgoingCallerIdParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) *DeleteOutgoingCallerIdParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) (*DeleteOutgoingCallerIdParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete the caller-id specified from the account -func (c *ApiService) DeleteOutgoingCallerId(Sid string, params *DeleteOutgoingCallerIdParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteOutgoingCallerId(Sid string, params *DeleteOutgoingCallerIdParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchOutgoingCallerId' type FetchOutgoingCallerIdParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) *FetchOutgoingCallerIdParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) (*FetchOutgoingCallerIdParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an outgoing-caller-id belonging to the account used to make the request func (c *ApiService) FetchOutgoingCallerId(Sid string, params *FetchOutgoingCallerIdParams) (*ApiV2010OutgoingCallerId, error) { - path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010OutgoingCallerId{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010OutgoingCallerId{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListOutgoingCallerId' type ListOutgoingCallerIdParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The phone number of the OutgoingCallerId resources to read. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // The string that identifies the OutgoingCallerId resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The phone number of the OutgoingCallerId resources to read. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The string that identifies the OutgoingCallerId resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) *ListOutgoingCallerIdParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) (*ListOutgoingCallerIdParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListOutgoingCallerIdParams) SetPhoneNumber(PhoneNumber string) *ListOutgoingCallerIdParams { - params.PhoneNumber = &PhoneNumber - return params +func (params *ListOutgoingCallerIdParams) SetPhoneNumber(PhoneNumber string) (*ListOutgoingCallerIdParams){ + params.PhoneNumber = &PhoneNumber + return params } -func (params *ListOutgoingCallerIdParams) SetFriendlyName(FriendlyName string) *ListOutgoingCallerIdParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListOutgoingCallerIdParams) SetFriendlyName(FriendlyName string) (*ListOutgoingCallerIdParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListOutgoingCallerIdParams) SetPageSize(PageSize int) *ListOutgoingCallerIdParams { - params.PageSize = &PageSize - return params +func (params *ListOutgoingCallerIdParams) SetPageSize(PageSize int) (*ListOutgoingCallerIdParams){ + params.PageSize = &PageSize + return params } -func (params *ListOutgoingCallerIdParams) SetLimit(Limit int) *ListOutgoingCallerIdParams { - params.Limit = &Limit - return params +func (params *ListOutgoingCallerIdParams) SetLimit(Limit int) (*ListOutgoingCallerIdParams){ + params.Limit = &Limit + return params } // Retrieve a single page of OutgoingCallerId records from the API. Request is executed immediately. -func (c *ApiService) PageOutgoingCallerId(params *ListOutgoingCallerIdParams, pageToken, pageNumber string) (*ListOutgoingCallerIdResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } +func (c *ApiService) PageOutgoingCallerId(params *ListOutgoingCallerIdParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds.json" - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListOutgoingCallerIdResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists OutgoingCallerId records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListOutgoingCallerId(params *ListOutgoingCallerIdParams) ([]ApiV2010OutgoingCallerId, error) { +func (c *ApiService) ListOutgoingCallerId(params *ListOutgoingCallerIdParams) (ListOutgoingCallerId200Response, error) { response, errors := c.StreamOutgoingCallerId(params) - records := make([]ApiV2010OutgoingCallerId, 0) + records := make(ListOutgoingCallerId200Response, 0) for record := range response { records = append(records, record) } @@ -286,13 +291,13 @@ func (c *ApiService) ListOutgoingCallerId(params *ListOutgoingCallerIdParams) ([ } // Streams OutgoingCallerId records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamOutgoingCallerId(params *ListOutgoingCallerIdParams) (chan ApiV2010OutgoingCallerId, chan error) { +func (c *ApiService) StreamOutgoingCallerId(params *ListOutgoingCallerIdParams) (chan ListOutgoingCallerId200Response, chan error) { if params == nil { params = &ListOutgoingCallerIdParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010OutgoingCallerId, 1) + recordChannel := make(chan ListOutgoingCallerId200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageOutgoingCallerId(params, "", "") @@ -307,11 +312,12 @@ func (c *ApiService) StreamOutgoingCallerId(params *ListOutgoingCallerIdParams) return recordChannel, errorChannel } -func (c *ApiService) streamOutgoingCallerId(response *ListOutgoingCallerIdResponse, params *ListOutgoingCallerIdParams, recordChannel chan ApiV2010OutgoingCallerId, errorChannel chan error) { + +func (c *ApiService) streamOutgoingCallerId(response *, params *ListOutgoingCallerIdParams, recordChannel chan ListOutgoingCallerId200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.OutgoingCallerIds + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -322,7 +328,7 @@ func (c *ApiService) streamOutgoingCallerId(response *ListOutgoingCallerIdRespon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListOutgoingCallerIdResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -330,76 +336,78 @@ func (c *ApiService) streamOutgoingCallerId(response *ListOutgoingCallerIdRespon break } - response = record.(*ListOutgoingCallerIdResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListOutgoingCallerIdResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListOutgoingCallerIdResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateOutgoingCallerId' type UpdateOutgoingCallerIdParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) *UpdateOutgoingCallerIdParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateOutgoingCallerIdParams) SetPathAccountSid(PathAccountSid string) (*UpdateOutgoingCallerIdParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateOutgoingCallerIdParams) SetFriendlyName(FriendlyName string) *UpdateOutgoingCallerIdParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateOutgoingCallerIdParams) SetFriendlyName(FriendlyName string) (*UpdateOutgoingCallerIdParams){ + params.FriendlyName = &FriendlyName + return params } // Updates the caller-id func (c *ApiService) UpdateOutgoingCallerId(Sid string, params *UpdateOutgoingCallerIdParams) (*ApiV2010OutgoingCallerId, error) { - path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010OutgoingCallerId{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010OutgoingCallerId{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_queues.go b/rest/api/v2010/accounts_queues.go index 9f6c3e7b2..acbcb68ac 100644 --- a/rest/api/v2010/accounts_queues.go +++ b/rest/api/v2010/accounts_queues.go @@ -18,208 +18,213 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateQueue' type CreateQueueParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you created to describe this resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000. - MaxSize *int `json:"MaxSize,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you created to describe this resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000. + MaxSize *int `json:"MaxSize,omitempty"` } -func (params *CreateQueueParams) SetPathAccountSid(PathAccountSid string) *CreateQueueParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateQueueParams) SetPathAccountSid(PathAccountSid string) (*CreateQueueParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateQueueParams) SetFriendlyName(FriendlyName string) *CreateQueueParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateQueueParams) SetFriendlyName(FriendlyName string) (*CreateQueueParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateQueueParams) SetMaxSize(MaxSize int) *CreateQueueParams { - params.MaxSize = &MaxSize - return params +func (params *CreateQueueParams) SetMaxSize(MaxSize int) (*CreateQueueParams){ + params.MaxSize = &MaxSize + return params } // Create a queue func (c *ApiService) CreateQueue(params *CreateQueueParams) (*ApiV2010Queue, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/Queues.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.MaxSize != nil { - data.Set("MaxSize", fmt.Sprint(*params.MaxSize)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.MaxSize != nil { + data.Set("MaxSize", fmt.Sprint(*params.MaxSize)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Queue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Queue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteQueue' type DeleteQueueParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resource to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resource to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteQueueParams) SetPathAccountSid(PathAccountSid string) *DeleteQueueParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteQueueParams) SetPathAccountSid(PathAccountSid string) (*DeleteQueueParams){ + params.PathAccountSid = &PathAccountSid + return params } // Remove an empty queue -func (c *ApiService) DeleteQueue(Sid string, params *DeleteQueueParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteQueue(Sid string, params *DeleteQueueParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchQueue' type FetchQueueParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchQueueParams) SetPathAccountSid(PathAccountSid string) *FetchQueueParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchQueueParams) SetPathAccountSid(PathAccountSid string) (*FetchQueueParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a queue identified by the QueueSid func (c *ApiService) FetchQueue(Sid string, params *FetchQueueParams) (*ApiV2010Queue, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Queue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Queue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListQueue' type ListQueueParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListQueueParams) SetPathAccountSid(PathAccountSid string) *ListQueueParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListQueueParams) SetPathAccountSid(PathAccountSid string) (*ListQueueParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListQueueParams) SetPageSize(PageSize int) *ListQueueParams { - params.PageSize = &PageSize - return params +func (params *ListQueueParams) SetPageSize(PageSize int) (*ListQueueParams){ + params.PageSize = &PageSize + return params } -func (params *ListQueueParams) SetLimit(Limit int) *ListQueueParams { - params.Limit = &Limit - return params +func (params *ListQueueParams) SetLimit(Limit int) (*ListQueueParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Queue records from the API. Request is executed immediately. -func (c *ApiService) PageQueue(params *ListQueueParams, pageToken, pageNumber string) (*ListQueueResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues.json" +func (c *ApiService) PageQueue(params *ListQueueParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Queues.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListQueueResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Queue records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListQueue(params *ListQueueParams) ([]ApiV2010Queue, error) { +func (c *ApiService) ListQueue(params *ListQueueParams) (ListQueue200Response, error) { response, errors := c.StreamQueue(params) - records := make([]ApiV2010Queue, 0) + records := make(ListQueue200Response, 0) for record := range response { records = append(records, record) } @@ -232,13 +237,13 @@ func (c *ApiService) ListQueue(params *ListQueueParams) ([]ApiV2010Queue, error) } // Streams Queue records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamQueue(params *ListQueueParams) (chan ApiV2010Queue, chan error) { +func (c *ApiService) StreamQueue(params *ListQueueParams) (chan ListQueue200Response, chan error) { if params == nil { params = &ListQueueParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Queue, 1) + recordChannel := make(chan ListQueue200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageQueue(params, "", "") @@ -253,11 +258,12 @@ func (c *ApiService) StreamQueue(params *ListQueueParams) (chan ApiV2010Queue, c return recordChannel, errorChannel } -func (c *ApiService) streamQueue(response *ListQueueResponse, params *ListQueueParams, recordChannel chan ApiV2010Queue, errorChannel chan error) { + +func (c *ApiService) streamQueue(response *, params *ListQueueParams, recordChannel chan ListQueue200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Queues + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -268,7 +274,7 @@ func (c *ApiService) streamQueue(response *ListQueueResponse, params *ListQueueP } } - record, err := client.GetNext(c.baseURL, response, c.getNextListQueueResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -276,85 +282,87 @@ func (c *ApiService) streamQueue(response *ListQueueResponse, params *ListQueueP break } - response = record.(*ListQueueResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListQueueResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListQueueResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateQueue' type UpdateQueueParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resource to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you created to describe this resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000. - MaxSize *int `json:"MaxSize,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Queue resource to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you created to describe this resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000. + MaxSize *int `json:"MaxSize,omitempty"` } -func (params *UpdateQueueParams) SetPathAccountSid(PathAccountSid string) *UpdateQueueParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateQueueParams) SetPathAccountSid(PathAccountSid string) (*UpdateQueueParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateQueueParams) SetFriendlyName(FriendlyName string) *UpdateQueueParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateQueueParams) SetFriendlyName(FriendlyName string) (*UpdateQueueParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateQueueParams) SetMaxSize(MaxSize int) *UpdateQueueParams { - params.MaxSize = &MaxSize - return params +func (params *UpdateQueueParams) SetMaxSize(MaxSize int) (*UpdateQueueParams){ + params.MaxSize = &MaxSize + return params } // Update the queue with the new parameters func (c *ApiService) UpdateQueue(Sid string, params *UpdateQueueParams) (*ApiV2010Queue, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.MaxSize != nil { - data.Set("MaxSize", fmt.Sprint(*params.MaxSize)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.MaxSize != nil { + data.Set("MaxSize", fmt.Sprint(*params.MaxSize)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Queue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Queue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_queues_members.go b/rest/api/v2010/accounts_queues_members.go index 93a3f0b24..719d29bfd 100644 --- a/rest/api/v2010/accounts_queues_members.go +++ b/rest/api/v2010/accounts_queues_members.go @@ -18,119 +18,121 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchMember' type FetchMemberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchMemberParams) SetPathAccountSid(PathAccountSid string) *FetchMemberParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchMemberParams) SetPathAccountSid(PathAccountSid string) (*FetchMemberParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a specific member from the queue func (c *ApiService) FetchMember(QueueSid string, CallSid string, params *FetchMemberParams) (*ApiV2010Member, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members/{CallSid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"QueueSid"+"}", QueueSid, -1) - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members/{CallSid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"QueueSid"+"}", QueueSid, -1) + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListMember' type ListMemberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMemberParams) SetPathAccountSid(PathAccountSid string) *ListMemberParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListMemberParams) SetPathAccountSid(PathAccountSid string) (*ListMemberParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListMemberParams) SetPageSize(PageSize int) *ListMemberParams { - params.PageSize = &PageSize - return params +func (params *ListMemberParams) SetPageSize(PageSize int) (*ListMemberParams){ + params.PageSize = &PageSize + return params } -func (params *ListMemberParams) SetLimit(Limit int) *ListMemberParams { - params.Limit = &Limit - return params +func (params *ListMemberParams) SetLimit(Limit int) (*ListMemberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Member records from the API. Request is executed immediately. -func (c *ApiService) PageMember(QueueSid string, params *ListMemberParams, pageToken, pageNumber string) (*ListMemberResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members.json" +func (c *ApiService) PageMember(QueueSid string, params *ListMemberParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"QueueSid"+"}", QueueSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"QueueSid"+"}", QueueSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Member records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListMember(QueueSid string, params *ListMemberParams) ([]ApiV2010Member, error) { +func (c *ApiService) ListMember(QueueSid string, params *ListMemberParams) (ListMember200Response, error) { response, errors := c.StreamMember(QueueSid, params) - records := make([]ApiV2010Member, 0) + records := make(ListMember200Response, 0) for record := range response { records = append(records, record) } @@ -143,13 +145,13 @@ func (c *ApiService) ListMember(QueueSid string, params *ListMemberParams) ([]Ap } // Streams Member records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamMember(QueueSid string, params *ListMemberParams) (chan ApiV2010Member, chan error) { +func (c *ApiService) StreamMember(QueueSid string, params *ListMemberParams) (chan ListMember200Response, chan error) { if params == nil { params = &ListMemberParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Member, 1) + recordChannel := make(chan ListMember200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageMember(QueueSid, params, "", "") @@ -164,11 +166,12 @@ func (c *ApiService) StreamMember(QueueSid string, params *ListMemberParams) (ch return recordChannel, errorChannel } -func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemberParams, recordChannel chan ApiV2010Member, errorChannel chan error) { + +func (c *ApiService) streamMember(response *, params *ListMemberParams, recordChannel chan ListMember200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.QueueMembers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -179,7 +182,7 @@ func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemb } } - record, err := client.GetNext(c.baseURL, response, c.getNextListMemberResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -187,86 +190,88 @@ func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemb break } - response = record.(*ListMemberResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListMemberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMember' type UpdateMemberParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The absolute URL of the Queue resource. - Url *string `json:"Url,omitempty"` - // How to pass the update request data. Can be `GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters. - Method *string `json:"Method,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The absolute URL of the Queue resource. + Url *string `json:"Url,omitempty"` + // How to pass the update request data. Can be `GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters. + Method *string `json:"Method,omitempty"` } -func (params *UpdateMemberParams) SetPathAccountSid(PathAccountSid string) *UpdateMemberParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateMemberParams) SetPathAccountSid(PathAccountSid string) (*UpdateMemberParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateMemberParams) SetUrl(Url string) *UpdateMemberParams { - params.Url = &Url - return params +func (params *UpdateMemberParams) SetUrl(Url string) (*UpdateMemberParams){ + params.Url = &Url + return params } -func (params *UpdateMemberParams) SetMethod(Method string) *UpdateMemberParams { - params.Method = &Method - return params +func (params *UpdateMemberParams) SetMethod(Method string) (*UpdateMemberParams){ + params.Method = &Method + return params } // Dequeue a member from a queue and have the member's call begin executing the TwiML document at that URL func (c *ApiService) UpdateMember(QueueSid string, CallSid string, params *UpdateMemberParams) (*ApiV2010Member, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members/{CallSid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"QueueSid"+"}", QueueSid, -1) - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members/{CallSid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"QueueSid"+"}", QueueSid, -1) + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Url != nil { - data.Set("Url", *params.Url) - } - if params != nil && params.Method != nil { - data.Set("Method", *params.Method) - } + if params != nil && params.Url != nil { + data.Set("Url", *params.Url) + } + if params != nil && params.Method != nil { + data.Set("Method", *params.Method) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_recordings.go b/rest/api/v2010/accounts_recordings.go index cae717617..d60a954f1 100644 --- a/rest/api/v2010/accounts_recordings.go +++ b/rest/api/v2010/accounts_recordings.go @@ -18,216 +18,218 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteRecording' type DeleteRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteRecordingParams) SetPathAccountSid(PathAccountSid string) *DeleteRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteRecordingParams) SetPathAccountSid(PathAccountSid string) (*DeleteRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a recording from your account -func (c *ApiService) DeleteRecording(Sid string, params *DeleteRecordingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteRecording(Sid string, params *DeleteRecordingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchRecording' type FetchRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. - IncludeSoftDeleted *bool `json:"IncludeSoftDeleted,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. + IncludeSoftDeleted *bool `json:"IncludeSoftDeleted,omitempty"` } -func (params *FetchRecordingParams) SetPathAccountSid(PathAccountSid string) *FetchRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchRecordingParams) SetPathAccountSid(PathAccountSid string) (*FetchRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *FetchRecordingParams) SetIncludeSoftDeleted(IncludeSoftDeleted bool) *FetchRecordingParams { - params.IncludeSoftDeleted = &IncludeSoftDeleted - return params +func (params *FetchRecordingParams) SetIncludeSoftDeleted(IncludeSoftDeleted bool) (*FetchRecordingParams){ + params.IncludeSoftDeleted = &IncludeSoftDeleted + return params } // Fetch an instance of a recording func (c *ApiService) FetchRecording(Sid string, params *FetchRecordingParams) (*ApiV2010Recording, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IncludeSoftDeleted != nil { - data.Set("IncludeSoftDeleted", fmt.Sprint(*params.IncludeSoftDeleted)) - } + if params != nil && params.IncludeSoftDeleted != nil { + data.Set("IncludeSoftDeleted", fmt.Sprint(*params.IncludeSoftDeleted)) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010Recording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010Recording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRecording' type ListRecordingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. - DateCreatedBefore *time.Time `json:"DateCreated<,omitempty"` - // Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. - DateCreatedAfter *time.Time `json:"DateCreated>,omitempty"` - // The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resources to read. - CallSid *string `json:"CallSid,omitempty"` - // The Conference SID that identifies the conference associated with the recording to read. - ConferenceSid *string `json:"ConferenceSid,omitempty"` - // A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. - IncludeSoftDeleted *bool `json:"IncludeSoftDeleted,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. + DateCreatedBefore *time.Time `json:"DateCreated<,omitempty"` + // Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. + DateCreatedAfter *time.Time `json:"DateCreated>,omitempty"` + // The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resources to read. + CallSid *string `json:"CallSid,omitempty"` + // The Conference SID that identifies the conference associated with the recording to read. + ConferenceSid *string `json:"ConferenceSid,omitempty"` + // A boolean parameter indicating whether to retrieve soft deleted recordings or not. Recordings metadata are kept after deletion for a retention period of 40 days. + IncludeSoftDeleted *bool `json:"IncludeSoftDeleted,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRecordingParams) SetPathAccountSid(PathAccountSid string) *ListRecordingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListRecordingParams) SetPathAccountSid(PathAccountSid string) (*ListRecordingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListRecordingParams) SetDateCreated(DateCreated time.Time) *ListRecordingParams { - params.DateCreated = &DateCreated - return params +func (params *ListRecordingParams) SetDateCreated(DateCreated time.Time) (*ListRecordingParams){ + params.DateCreated = &DateCreated + return params } -func (params *ListRecordingParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListRecordingParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListRecordingParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListRecordingParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListRecordingParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListRecordingParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListRecordingParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListRecordingParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListRecordingParams) SetCallSid(CallSid string) *ListRecordingParams { - params.CallSid = &CallSid - return params +func (params *ListRecordingParams) SetCallSid(CallSid string) (*ListRecordingParams){ + params.CallSid = &CallSid + return params } -func (params *ListRecordingParams) SetConferenceSid(ConferenceSid string) *ListRecordingParams { - params.ConferenceSid = &ConferenceSid - return params +func (params *ListRecordingParams) SetConferenceSid(ConferenceSid string) (*ListRecordingParams){ + params.ConferenceSid = &ConferenceSid + return params } -func (params *ListRecordingParams) SetIncludeSoftDeleted(IncludeSoftDeleted bool) *ListRecordingParams { - params.IncludeSoftDeleted = &IncludeSoftDeleted - return params +func (params *ListRecordingParams) SetIncludeSoftDeleted(IncludeSoftDeleted bool) (*ListRecordingParams){ + params.IncludeSoftDeleted = &IncludeSoftDeleted + return params } -func (params *ListRecordingParams) SetPageSize(PageSize int) *ListRecordingParams { - params.PageSize = &PageSize - return params +func (params *ListRecordingParams) SetPageSize(PageSize int) (*ListRecordingParams){ + params.PageSize = &PageSize + return params } -func (params *ListRecordingParams) SetLimit(Limit int) *ListRecordingParams { - params.Limit = &Limit - return params +func (params *ListRecordingParams) SetLimit(Limit int) (*ListRecordingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Recording records from the API. Request is executed immediately. -func (c *ApiService) PageRecording(params *ListRecordingParams, pageToken, pageNumber string) (*ListRecordingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings.json" +func (c *ApiService) PageRecording(params *ListRecordingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreated<", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreated>", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.CallSid != nil { - data.Set("CallSid", *params.CallSid) - } - if params != nil && params.ConferenceSid != nil { - data.Set("ConferenceSid", *params.ConferenceSid) - } - if params != nil && params.IncludeSoftDeleted != nil { - data.Set("IncludeSoftDeleted", fmt.Sprint(*params.IncludeSoftDeleted)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreated<", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreated>", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.CallSid != nil { + data.Set("CallSid", *params.CallSid) + } + if params != nil && params.ConferenceSid != nil { + data.Set("ConferenceSid", *params.ConferenceSid) + } + if params != nil && params.IncludeSoftDeleted != nil { + data.Set("IncludeSoftDeleted", fmt.Sprint(*params.IncludeSoftDeleted)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Recording records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListRecording(params *ListRecordingParams) ([]ApiV2010Recording, error) { +func (c *ApiService) ListRecording(params *ListRecordingParams) (ListRecording200Response, error) { response, errors := c.StreamRecording(params) - records := make([]ApiV2010Recording, 0) + records := make(ListRecording200Response, 0) for record := range response { records = append(records, record) } @@ -240,13 +242,13 @@ func (c *ApiService) ListRecording(params *ListRecordingParams) ([]ApiV2010Recor } // Streams Recording records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamRecording(params *ListRecordingParams) (chan ApiV2010Recording, chan error) { +func (c *ApiService) StreamRecording(params *ListRecordingParams) (chan ListRecording200Response, chan error) { if params == nil { params = &ListRecordingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Recording, 1) + recordChannel := make(chan ListRecording200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageRecording(params, "", "") @@ -261,11 +263,12 @@ func (c *ApiService) StreamRecording(params *ListRecordingParams) (chan ApiV2010 return recordChannel, errorChannel } -func (c *ApiService) streamRecording(response *ListRecordingResponse, params *ListRecordingParams, recordChannel chan ApiV2010Recording, errorChannel chan error) { + +func (c *ApiService) streamRecording(response *, params *ListRecordingParams, recordChannel chan ListRecording200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Recordings + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -276,7 +279,7 @@ func (c *ApiService) streamRecording(response *ListRecordingResponse, params *Li } } - record, err := client.GetNext(c.baseURL, response, c.getNextListRecordingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -284,27 +287,28 @@ func (c *ApiService) streamRecording(response *ListRecordingResponse, params *Li break } - response = record.(*ListRecordingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListRecordingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_recordings_add_on_results.go b/rest/api/v2010/accounts_recordings_add_on_results.go index 69857f08e..e466b069f 100644 --- a/rest/api/v2010/accounts_recordings_add_on_results.go +++ b/rest/api/v2010/accounts_recordings_add_on_results.go @@ -18,154 +18,158 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteRecordingAddOnResult' type DeleteRecordingAddOnResultParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteRecordingAddOnResultParams) SetPathAccountSid(PathAccountSid string) *DeleteRecordingAddOnResultParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteRecordingAddOnResultParams) SetPathAccountSid(PathAccountSid string) (*DeleteRecordingAddOnResultParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a result and purge all associated Payloads -func (c *ApiService) DeleteRecordingAddOnResult(ReferenceSid string, Sid string, params *DeleteRecordingAddOnResultParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteRecordingAddOnResult(ReferenceSid string, Sid string, params *DeleteRecordingAddOnResultParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchRecordingAddOnResult' type FetchRecordingAddOnResultParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchRecordingAddOnResultParams) SetPathAccountSid(PathAccountSid string) *FetchRecordingAddOnResultParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchRecordingAddOnResultParams) SetPathAccountSid(PathAccountSid string) (*FetchRecordingAddOnResultParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of an AddOnResult func (c *ApiService) FetchRecordingAddOnResult(ReferenceSid string, Sid string, params *FetchRecordingAddOnResultParams) (*ApiV2010RecordingAddOnResult, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010RecordingAddOnResult{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010RecordingAddOnResult{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRecordingAddOnResult' type ListRecordingAddOnResultParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRecordingAddOnResultParams) SetPathAccountSid(PathAccountSid string) *ListRecordingAddOnResultParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListRecordingAddOnResultParams) SetPathAccountSid(PathAccountSid string) (*ListRecordingAddOnResultParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListRecordingAddOnResultParams) SetPageSize(PageSize int) *ListRecordingAddOnResultParams { - params.PageSize = &PageSize - return params +func (params *ListRecordingAddOnResultParams) SetPageSize(PageSize int) (*ListRecordingAddOnResultParams){ + params.PageSize = &PageSize + return params } -func (params *ListRecordingAddOnResultParams) SetLimit(Limit int) *ListRecordingAddOnResultParams { - params.Limit = &Limit - return params +func (params *ListRecordingAddOnResultParams) SetLimit(Limit int) (*ListRecordingAddOnResultParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RecordingAddOnResult records from the API. Request is executed immediately. -func (c *ApiService) PageRecordingAddOnResult(ReferenceSid string, params *ListRecordingAddOnResultParams, pageToken, pageNumber string) (*ListRecordingAddOnResultResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults.json" +func (c *ApiService) PageRecordingAddOnResult(ReferenceSid string, params *ListRecordingAddOnResultParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRecordingAddOnResultResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RecordingAddOnResult records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListRecordingAddOnResult(ReferenceSid string, params *ListRecordingAddOnResultParams) ([]ApiV2010RecordingAddOnResult, error) { +func (c *ApiService) ListRecordingAddOnResult(ReferenceSid string, params *ListRecordingAddOnResultParams) (ListRecordingAddOnResult200Response, error) { response, errors := c.StreamRecordingAddOnResult(ReferenceSid, params) - records := make([]ApiV2010RecordingAddOnResult, 0) + records := make(ListRecordingAddOnResult200Response, 0) for record := range response { records = append(records, record) } @@ -178,13 +182,13 @@ func (c *ApiService) ListRecordingAddOnResult(ReferenceSid string, params *ListR } // Streams RecordingAddOnResult records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamRecordingAddOnResult(ReferenceSid string, params *ListRecordingAddOnResultParams) (chan ApiV2010RecordingAddOnResult, chan error) { +func (c *ApiService) StreamRecordingAddOnResult(ReferenceSid string, params *ListRecordingAddOnResultParams) (chan ListRecordingAddOnResult200Response, chan error) { if params == nil { params = &ListRecordingAddOnResultParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010RecordingAddOnResult, 1) + recordChannel := make(chan ListRecordingAddOnResult200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageRecordingAddOnResult(ReferenceSid, params, "", "") @@ -199,11 +203,12 @@ func (c *ApiService) StreamRecordingAddOnResult(ReferenceSid string, params *Lis return recordChannel, errorChannel } -func (c *ApiService) streamRecordingAddOnResult(response *ListRecordingAddOnResultResponse, params *ListRecordingAddOnResultParams, recordChannel chan ApiV2010RecordingAddOnResult, errorChannel chan error) { + +func (c *ApiService) streamRecordingAddOnResult(response *, params *ListRecordingAddOnResultParams, recordChannel chan ListRecordingAddOnResult200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.AddOnResults + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -214,7 +219,7 @@ func (c *ApiService) streamRecordingAddOnResult(response *ListRecordingAddOnResu } } - record, err := client.GetNext(c.baseURL, response, c.getNextListRecordingAddOnResultResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -222,27 +227,28 @@ func (c *ApiService) streamRecordingAddOnResult(response *ListRecordingAddOnResu break } - response = record.(*ListRecordingAddOnResultResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListRecordingAddOnResultResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingAddOnResultResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_recordings_add_on_results_payloads.go b/rest/api/v2010/accounts_recordings_add_on_results_payloads.go index e9738d49a..af800b7bd 100644 --- a/rest/api/v2010/accounts_recordings_add_on_results_payloads.go +++ b/rest/api/v2010/accounts_recordings_add_on_results_payloads.go @@ -18,157 +18,161 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteRecordingAddOnResultPayload' type DeleteRecordingAddOnResultPayloadParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteRecordingAddOnResultPayloadParams) SetPathAccountSid(PathAccountSid string) *DeleteRecordingAddOnResultPayloadParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteRecordingAddOnResultPayloadParams) SetPathAccountSid(PathAccountSid string) (*DeleteRecordingAddOnResultPayloadParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a payload from the result along with all associated Data -func (c *ApiService) DeleteRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, Sid string, params *DeleteRecordingAddOnResultPayloadParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{AddOnResultSid}/Payloads/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) - path = strings.Replace(path, "{"+"AddOnResultSid"+"}", AddOnResultSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, Sid string, params *DeleteRecordingAddOnResultPayloadParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{AddOnResultSid}/Payloads/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) + path = strings.Replace(path, "{"+"AddOnResultSid"+"}", AddOnResultSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchRecordingAddOnResultPayload' type FetchRecordingAddOnResultPayloadParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchRecordingAddOnResultPayloadParams) SetPathAccountSid(PathAccountSid string) *FetchRecordingAddOnResultPayloadParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchRecordingAddOnResultPayloadParams) SetPathAccountSid(PathAccountSid string) (*FetchRecordingAddOnResultPayloadParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a result payload func (c *ApiService) FetchRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, Sid string, params *FetchRecordingAddOnResultPayloadParams) (*ApiV2010RecordingAddOnResultPayload, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{AddOnResultSid}/Payloads/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) - path = strings.Replace(path, "{"+"AddOnResultSid"+"}", AddOnResultSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{AddOnResultSid}/Payloads/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) + path = strings.Replace(path, "{"+"AddOnResultSid"+"}", AddOnResultSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010RecordingAddOnResultPayload{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010RecordingAddOnResultPayload{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRecordingAddOnResultPayload' type ListRecordingAddOnResultPayloadParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRecordingAddOnResultPayloadParams) SetPathAccountSid(PathAccountSid string) *ListRecordingAddOnResultPayloadParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListRecordingAddOnResultPayloadParams) SetPathAccountSid(PathAccountSid string) (*ListRecordingAddOnResultPayloadParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListRecordingAddOnResultPayloadParams) SetPageSize(PageSize int) *ListRecordingAddOnResultPayloadParams { - params.PageSize = &PageSize - return params +func (params *ListRecordingAddOnResultPayloadParams) SetPageSize(PageSize int) (*ListRecordingAddOnResultPayloadParams){ + params.PageSize = &PageSize + return params } -func (params *ListRecordingAddOnResultPayloadParams) SetLimit(Limit int) *ListRecordingAddOnResultPayloadParams { - params.Limit = &Limit - return params +func (params *ListRecordingAddOnResultPayloadParams) SetLimit(Limit int) (*ListRecordingAddOnResultPayloadParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RecordingAddOnResultPayload records from the API. Request is executed immediately. -func (c *ApiService) PageRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, params *ListRecordingAddOnResultPayloadParams, pageToken, pageNumber string) (*ListRecordingAddOnResultPayloadResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{AddOnResultSid}/Payloads.json" +func (c *ApiService) PageRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, params *ListRecordingAddOnResultPayloadParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{ReferenceSid}/AddOnResults/{AddOnResultSid}/Payloads.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) - path = strings.Replace(path, "{"+"AddOnResultSid"+"}", AddOnResultSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"ReferenceSid"+"}", ReferenceSid, -1) + path = strings.Replace(path, "{"+"AddOnResultSid"+"}", AddOnResultSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRecordingAddOnResultPayloadResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RecordingAddOnResultPayload records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, params *ListRecordingAddOnResultPayloadParams) ([]ApiV2010RecordingAddOnResultPayload, error) { +func (c *ApiService) ListRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, params *ListRecordingAddOnResultPayloadParams) (ListRecordingAddOnResultPayload200Response, error) { response, errors := c.StreamRecordingAddOnResultPayload(ReferenceSid, AddOnResultSid, params) - records := make([]ApiV2010RecordingAddOnResultPayload, 0) + records := make(ListRecordingAddOnResultPayload200Response, 0) for record := range response { records = append(records, record) } @@ -181,13 +185,13 @@ func (c *ApiService) ListRecordingAddOnResultPayload(ReferenceSid string, AddOnR } // Streams RecordingAddOnResultPayload records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, params *ListRecordingAddOnResultPayloadParams) (chan ApiV2010RecordingAddOnResultPayload, chan error) { +func (c *ApiService) StreamRecordingAddOnResultPayload(ReferenceSid string, AddOnResultSid string, params *ListRecordingAddOnResultPayloadParams) (chan ListRecordingAddOnResultPayload200Response, chan error) { if params == nil { params = &ListRecordingAddOnResultPayloadParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010RecordingAddOnResultPayload, 1) + recordChannel := make(chan ListRecordingAddOnResultPayload200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageRecordingAddOnResultPayload(ReferenceSid, AddOnResultSid, params, "", "") @@ -202,11 +206,12 @@ func (c *ApiService) StreamRecordingAddOnResultPayload(ReferenceSid string, AddO return recordChannel, errorChannel } -func (c *ApiService) streamRecordingAddOnResultPayload(response *ListRecordingAddOnResultPayloadResponse, params *ListRecordingAddOnResultPayloadParams, recordChannel chan ApiV2010RecordingAddOnResultPayload, errorChannel chan error) { + +func (c *ApiService) streamRecordingAddOnResultPayload(response *, params *ListRecordingAddOnResultPayloadParams, recordChannel chan ListRecordingAddOnResultPayload200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Payloads + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -217,7 +222,7 @@ func (c *ApiService) streamRecordingAddOnResultPayload(response *ListRecordingAd } } - record, err := client.GetNext(c.baseURL, response, c.getNextListRecordingAddOnResultPayloadResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -225,27 +230,28 @@ func (c *ApiService) streamRecordingAddOnResultPayload(response *ListRecordingAd break } - response = record.(*ListRecordingAddOnResultPayloadResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListRecordingAddOnResultPayloadResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingAddOnResultPayloadResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_recordings_transcriptions.go b/rest/api/v2010/accounts_recordings_transcriptions.go index c1ca8d02e..8cfd6a3aa 100644 --- a/rest/api/v2010/accounts_recordings_transcriptions.go +++ b/rest/api/v2010/accounts_recordings_transcriptions.go @@ -18,154 +18,158 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteRecordingTranscription' type DeleteRecordingTranscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteRecordingTranscriptionParams) SetPathAccountSid(PathAccountSid string) *DeleteRecordingTranscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteRecordingTranscriptionParams) SetPathAccountSid(PathAccountSid string) (*DeleteRecordingTranscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } -// -func (c *ApiService) DeleteRecordingTranscription(RecordingSid string, Sid string, params *DeleteRecordingTranscriptionParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"RecordingSid"+"}", RecordingSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteRecordingTranscription(RecordingSid string, Sid string, params *DeleteRecordingTranscriptionParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"RecordingSid"+"}", RecordingSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchRecordingTranscription' type FetchRecordingTranscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchRecordingTranscriptionParams) SetPathAccountSid(PathAccountSid string) *FetchRecordingTranscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchRecordingTranscriptionParams) SetPathAccountSid(PathAccountSid string) (*FetchRecordingTranscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } -// +// func (c *ApiService) FetchRecordingTranscription(RecordingSid string, Sid string, params *FetchRecordingTranscriptionParams) (*ApiV2010RecordingTranscription, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"RecordingSid"+"}", RecordingSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"RecordingSid"+"}", RecordingSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010RecordingTranscription{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010RecordingTranscription{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRecordingTranscription' type ListRecordingTranscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRecordingTranscriptionParams) SetPathAccountSid(PathAccountSid string) *ListRecordingTranscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListRecordingTranscriptionParams) SetPathAccountSid(PathAccountSid string) (*ListRecordingTranscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListRecordingTranscriptionParams) SetPageSize(PageSize int) *ListRecordingTranscriptionParams { - params.PageSize = &PageSize - return params +func (params *ListRecordingTranscriptionParams) SetPageSize(PageSize int) (*ListRecordingTranscriptionParams){ + params.PageSize = &PageSize + return params } -func (params *ListRecordingTranscriptionParams) SetLimit(Limit int) *ListRecordingTranscriptionParams { - params.Limit = &Limit - return params +func (params *ListRecordingTranscriptionParams) SetLimit(Limit int) (*ListRecordingTranscriptionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RecordingTranscription records from the API. Request is executed immediately. -func (c *ApiService) PageRecordingTranscription(RecordingSid string, params *ListRecordingTranscriptionParams, pageToken, pageNumber string) (*ListRecordingTranscriptionResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions.json" +func (c *ApiService) PageRecordingTranscription(RecordingSid string, params *ListRecordingTranscriptionParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Recordings/{RecordingSid}/Transcriptions.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"RecordingSid"+"}", RecordingSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"RecordingSid"+"}", RecordingSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRecordingTranscriptionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RecordingTranscription records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListRecordingTranscription(RecordingSid string, params *ListRecordingTranscriptionParams) ([]ApiV2010RecordingTranscription, error) { +func (c *ApiService) ListRecordingTranscription(RecordingSid string, params *ListRecordingTranscriptionParams) (ListRecordingTranscription200Response, error) { response, errors := c.StreamRecordingTranscription(RecordingSid, params) - records := make([]ApiV2010RecordingTranscription, 0) + records := make(ListRecordingTranscription200Response, 0) for record := range response { records = append(records, record) } @@ -178,13 +182,13 @@ func (c *ApiService) ListRecordingTranscription(RecordingSid string, params *Lis } // Streams RecordingTranscription records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamRecordingTranscription(RecordingSid string, params *ListRecordingTranscriptionParams) (chan ApiV2010RecordingTranscription, chan error) { +func (c *ApiService) StreamRecordingTranscription(RecordingSid string, params *ListRecordingTranscriptionParams) (chan ListRecordingTranscription200Response, chan error) { if params == nil { params = &ListRecordingTranscriptionParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010RecordingTranscription, 1) + recordChannel := make(chan ListRecordingTranscription200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageRecordingTranscription(RecordingSid, params, "", "") @@ -199,11 +203,12 @@ func (c *ApiService) StreamRecordingTranscription(RecordingSid string, params *L return recordChannel, errorChannel } -func (c *ApiService) streamRecordingTranscription(response *ListRecordingTranscriptionResponse, params *ListRecordingTranscriptionParams, recordChannel chan ApiV2010RecordingTranscription, errorChannel chan error) { + +func (c *ApiService) streamRecordingTranscription(response *, params *ListRecordingTranscriptionParams, recordChannel chan ListRecordingTranscription200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Transcriptions + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -214,7 +219,7 @@ func (c *ApiService) streamRecordingTranscription(response *ListRecordingTranscr } } - record, err := client.GetNext(c.baseURL, response, c.getNextListRecordingTranscriptionResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -222,27 +227,28 @@ func (c *ApiService) streamRecordingTranscription(response *ListRecordingTranscr break } - response = record.(*ListRecordingTranscriptionResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListRecordingTranscriptionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingTranscriptionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_signing_keys.go b/rest/api/v2010/accounts_signing_keys.go index dd1b18853..025634996 100644 --- a/rest/api/v2010/accounts_signing_keys.go +++ b/rest/api/v2010/accounts_signing_keys.go @@ -18,199 +18,204 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNewSigningKey' type CreateNewSigningKeyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will be responsible for the new Key resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will be responsible for the new Key resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateNewSigningKeyParams) SetPathAccountSid(PathAccountSid string) *CreateNewSigningKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateNewSigningKeyParams) SetPathAccountSid(PathAccountSid string) (*CreateNewSigningKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateNewSigningKeyParams) SetFriendlyName(FriendlyName string) *CreateNewSigningKeyParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateNewSigningKeyParams) SetFriendlyName(FriendlyName string) (*CreateNewSigningKeyParams){ + params.FriendlyName = &FriendlyName + return params } // Create a new Signing Key for the account making the request. func (c *ApiService) CreateNewSigningKey(params *CreateNewSigningKeyParams) (*ApiV2010NewSigningKey, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010NewSigningKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010NewSigningKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSigningKey' type DeleteSigningKeyParams struct { - // - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSigningKeyParams) SetPathAccountSid(PathAccountSid string) *DeleteSigningKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSigningKeyParams) SetPathAccountSid(PathAccountSid string) (*DeleteSigningKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -// -func (c *ApiService) DeleteSigningKey(Sid string, params *DeleteSigningKeyParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteSigningKey(Sid string, params *DeleteSigningKeyParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSigningKey' type FetchSigningKeyParams struct { - // - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSigningKeyParams) SetPathAccountSid(PathAccountSid string) *FetchSigningKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSigningKeyParams) SetPathAccountSid(PathAccountSid string) (*FetchSigningKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -// +// func (c *ApiService) FetchSigningKey(Sid string, params *FetchSigningKeyParams) (*ApiV2010SigningKey, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SigningKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SigningKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSigningKey' type ListSigningKeyParams struct { - // - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSigningKeyParams) SetPathAccountSid(PathAccountSid string) *ListSigningKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSigningKeyParams) SetPathAccountSid(PathAccountSid string) (*ListSigningKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSigningKeyParams) SetPageSize(PageSize int) *ListSigningKeyParams { - params.PageSize = &PageSize - return params +func (params *ListSigningKeyParams) SetPageSize(PageSize int) (*ListSigningKeyParams){ + params.PageSize = &PageSize + return params } -func (params *ListSigningKeyParams) SetLimit(Limit int) *ListSigningKeyParams { - params.Limit = &Limit - return params +func (params *ListSigningKeyParams) SetLimit(Limit int) (*ListSigningKeyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SigningKey records from the API. Request is executed immediately. -func (c *ApiService) PageSigningKey(params *ListSigningKeyParams, pageToken, pageNumber string) (*ListSigningKeyResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys.json" +func (c *ApiService) PageSigningKey(params *ListSigningKeyParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSigningKeyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SigningKey records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSigningKey(params *ListSigningKeyParams) ([]ApiV2010SigningKey, error) { +func (c *ApiService) ListSigningKey(params *ListSigningKeyParams) (ListSigningKey200Response, error) { response, errors := c.StreamSigningKey(params) - records := make([]ApiV2010SigningKey, 0) + records := make(ListSigningKey200Response, 0) for record := range response { records = append(records, record) } @@ -223,13 +228,13 @@ func (c *ApiService) ListSigningKey(params *ListSigningKeyParams) ([]ApiV2010Sig } // Streams SigningKey records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSigningKey(params *ListSigningKeyParams) (chan ApiV2010SigningKey, chan error) { +func (c *ApiService) StreamSigningKey(params *ListSigningKeyParams) (chan ListSigningKey200Response, chan error) { if params == nil { params = &ListSigningKeyParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SigningKey, 1) + recordChannel := make(chan ListSigningKey200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSigningKey(params, "", "") @@ -244,11 +249,12 @@ func (c *ApiService) StreamSigningKey(params *ListSigningKeyParams) (chan ApiV20 return recordChannel, errorChannel } -func (c *ApiService) streamSigningKey(response *ListSigningKeyResponse, params *ListSigningKeyParams, recordChannel chan ApiV2010SigningKey, errorChannel chan error) { + +func (c *ApiService) streamSigningKey(response *, params *ListSigningKeyParams, recordChannel chan ListSigningKey200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.SigningKeys + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -259,7 +265,7 @@ func (c *ApiService) streamSigningKey(response *ListSigningKeyResponse, params * } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSigningKeyResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -267,76 +273,78 @@ func (c *ApiService) streamSigningKey(response *ListSigningKeyResponse, params * break } - response = record.(*ListSigningKeyResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSigningKeyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSigningKeyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSigningKey' type UpdateSigningKeyParams struct { - // - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateSigningKeyParams) SetPathAccountSid(PathAccountSid string) *UpdateSigningKeyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateSigningKeyParams) SetPathAccountSid(PathAccountSid string) (*UpdateSigningKeyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateSigningKeyParams) SetFriendlyName(FriendlyName string) *UpdateSigningKeyParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSigningKeyParams) SetFriendlyName(FriendlyName string) (*UpdateSigningKeyParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateSigningKey(Sid string, params *UpdateSigningKeyParams) (*ApiV2010SigningKey, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SigningKeys/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SigningKey{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010SigningKey{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_sip_credential_lists.go b/rest/api/v2010/accounts_sip_credential_lists.go index 17a523bc0..12164e40c 100644 --- a/rest/api/v2010/accounts_sip_credential_lists.go +++ b/rest/api/v2010/accounts_sip_credential_lists.go @@ -18,199 +18,204 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipCredentialList' type CreateSipCredentialListParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A human readable descriptive text that describes the CredentialList, up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A human readable descriptive text that describes the CredentialList, up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateSipCredentialListParams) SetPathAccountSid(PathAccountSid string) *CreateSipCredentialListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipCredentialListParams) SetPathAccountSid(PathAccountSid string) (*CreateSipCredentialListParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipCredentialListParams) SetFriendlyName(FriendlyName string) *CreateSipCredentialListParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateSipCredentialListParams) SetFriendlyName(FriendlyName string) (*CreateSipCredentialListParams){ + params.FriendlyName = &FriendlyName + return params } // Create a Credential List func (c *ApiService) CreateSipCredentialList(params *CreateSipCredentialListParams) (*ApiV2010SipCredentialList, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipCredentialList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipCredentialList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipCredentialList' type DeleteSipCredentialListParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipCredentialListParams) SetPathAccountSid(PathAccountSid string) *DeleteSipCredentialListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipCredentialListParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipCredentialListParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a Credential List -func (c *ApiService) DeleteSipCredentialList(Sid string, params *DeleteSipCredentialListParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipCredentialList(Sid string, params *DeleteSipCredentialListParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipCredentialList' type FetchSipCredentialListParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipCredentialListParams) SetPathAccountSid(PathAccountSid string) *FetchSipCredentialListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipCredentialListParams) SetPathAccountSid(PathAccountSid string) (*FetchSipCredentialListParams){ + params.PathAccountSid = &PathAccountSid + return params } // Get a Credential List func (c *ApiService) FetchSipCredentialList(Sid string, params *FetchSipCredentialListParams) (*ApiV2010SipCredentialList, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipCredentialList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipCredentialList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSipCredentialList' type ListSipCredentialListParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipCredentialListParams) SetPathAccountSid(PathAccountSid string) *ListSipCredentialListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipCredentialListParams) SetPathAccountSid(PathAccountSid string) (*ListSipCredentialListParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipCredentialListParams) SetPageSize(PageSize int) *ListSipCredentialListParams { - params.PageSize = &PageSize - return params +func (params *ListSipCredentialListParams) SetPageSize(PageSize int) (*ListSipCredentialListParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipCredentialListParams) SetLimit(Limit int) *ListSipCredentialListParams { - params.Limit = &Limit - return params +func (params *ListSipCredentialListParams) SetLimit(Limit int) (*ListSipCredentialListParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipCredentialList records from the API. Request is executed immediately. -func (c *ApiService) PageSipCredentialList(params *ListSipCredentialListParams, pageToken, pageNumber string) (*ListSipCredentialListResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists.json" +func (c *ApiService) PageSipCredentialList(params *ListSipCredentialListParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipCredentialListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipCredentialList records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipCredentialList(params *ListSipCredentialListParams) ([]ApiV2010SipCredentialList, error) { +func (c *ApiService) ListSipCredentialList(params *ListSipCredentialListParams) (ListSipCredentialList200Response, error) { response, errors := c.StreamSipCredentialList(params) - records := make([]ApiV2010SipCredentialList, 0) + records := make(ListSipCredentialList200Response, 0) for record := range response { records = append(records, record) } @@ -223,13 +228,13 @@ func (c *ApiService) ListSipCredentialList(params *ListSipCredentialListParams) } // Streams SipCredentialList records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipCredentialList(params *ListSipCredentialListParams) (chan ApiV2010SipCredentialList, chan error) { +func (c *ApiService) StreamSipCredentialList(params *ListSipCredentialListParams) (chan ListSipCredentialList200Response, chan error) { if params == nil { params = &ListSipCredentialListParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipCredentialList, 1) + recordChannel := make(chan ListSipCredentialList200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipCredentialList(params, "", "") @@ -244,11 +249,12 @@ func (c *ApiService) StreamSipCredentialList(params *ListSipCredentialListParams return recordChannel, errorChannel } -func (c *ApiService) streamSipCredentialList(response *ListSipCredentialListResponse, params *ListSipCredentialListParams, recordChannel chan ApiV2010SipCredentialList, errorChannel chan error) { + +func (c *ApiService) streamSipCredentialList(response *, params *ListSipCredentialListParams, recordChannel chan ListSipCredentialList200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.CredentialLists + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -259,7 +265,7 @@ func (c *ApiService) streamSipCredentialList(response *ListSipCredentialListResp } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipCredentialListResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -267,76 +273,78 @@ func (c *ApiService) streamSipCredentialList(response *ListSipCredentialListResp break } - response = record.(*ListSipCredentialListResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipCredentialListResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipCredentialListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSipCredentialList' type UpdateSipCredentialListParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A human readable descriptive text for a CredentialList, up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A human readable descriptive text for a CredentialList, up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateSipCredentialListParams) SetPathAccountSid(PathAccountSid string) *UpdateSipCredentialListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateSipCredentialListParams) SetPathAccountSid(PathAccountSid string) (*UpdateSipCredentialListParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateSipCredentialListParams) SetFriendlyName(FriendlyName string) *UpdateSipCredentialListParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSipCredentialListParams) SetFriendlyName(FriendlyName string) (*UpdateSipCredentialListParams){ + params.FriendlyName = &FriendlyName + return params } // Update a Credential List func (c *ApiService) UpdateSipCredentialList(Sid string, params *UpdateSipCredentialListParams) (*ApiV2010SipCredentialList, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipCredentialList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010SipCredentialList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_sip_credential_lists_credentials.go b/rest/api/v2010/accounts_sip_credential_lists_credentials.go index e82f254f2..64f9f1ca0 100644 --- a/rest/api/v2010/accounts_sip_credential_lists_credentials.go +++ b/rest/api/v2010/accounts_sip_credential_lists_credentials.go @@ -18,212 +18,217 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipCredential' type CreateSipCredentialParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The username that will be passed when authenticating SIP requests. The username should be sent in response to Twilio's challenge of the initial INVITE. It can be up to 32 characters long. - Username *string `json:"Username,omitempty"` - // The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) - Password *string `json:"Password,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The username that will be passed when authenticating SIP requests. The username should be sent in response to Twilio's challenge of the initial INVITE. It can be up to 32 characters long. + Username *string `json:"Username,omitempty"` + // The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) + Password *string `json:"Password,omitempty"` } -func (params *CreateSipCredentialParams) SetPathAccountSid(PathAccountSid string) *CreateSipCredentialParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipCredentialParams) SetPathAccountSid(PathAccountSid string) (*CreateSipCredentialParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipCredentialParams) SetUsername(Username string) *CreateSipCredentialParams { - params.Username = &Username - return params +func (params *CreateSipCredentialParams) SetUsername(Username string) (*CreateSipCredentialParams){ + params.Username = &Username + return params } -func (params *CreateSipCredentialParams) SetPassword(Password string) *CreateSipCredentialParams { - params.Password = &Password - return params +func (params *CreateSipCredentialParams) SetPassword(Password string) (*CreateSipCredentialParams){ + params.Password = &Password + return params } // Create a new credential resource. func (c *ApiService) CreateSipCredential(CredentialListSid string, params *CreateSipCredentialParams) (*ApiV2010SipCredential, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Username != nil { - data.Set("Username", *params.Username) - } - if params != nil && params.Password != nil { - data.Set("Password", *params.Password) - } + if params != nil && params.Username != nil { + data.Set("Username", *params.Username) + } + if params != nil && params.Password != nil { + data.Set("Password", *params.Password) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipCredential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010SipCredential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteSipCredential' type DeleteSipCredentialParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipCredentialParams) SetPathAccountSid(PathAccountSid string) *DeleteSipCredentialParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipCredentialParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipCredentialParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a credential resource. -func (c *ApiService) DeleteSipCredential(CredentialListSid string, Sid string, params *DeleteSipCredentialParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipCredential(CredentialListSid string, Sid string, params *DeleteSipCredentialParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipCredential' type FetchSipCredentialParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipCredentialParams) SetPathAccountSid(PathAccountSid string) *FetchSipCredentialParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipCredentialParams) SetPathAccountSid(PathAccountSid string) (*FetchSipCredentialParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a single credential. func (c *ApiService) FetchSipCredential(CredentialListSid string, Sid string, params *FetchSipCredentialParams) (*ApiV2010SipCredential, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipCredential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ApiV2010SipCredential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSipCredential' type ListSipCredentialParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipCredentialParams) SetPathAccountSid(PathAccountSid string) *ListSipCredentialParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipCredentialParams) SetPathAccountSid(PathAccountSid string) (*ListSipCredentialParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipCredentialParams) SetPageSize(PageSize int) *ListSipCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListSipCredentialParams) SetPageSize(PageSize int) (*ListSipCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipCredentialParams) SetLimit(Limit int) *ListSipCredentialParams { - params.Limit = &Limit - return params +func (params *ListSipCredentialParams) SetLimit(Limit int) (*ListSipCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipCredential records from the API. Request is executed immediately. -func (c *ApiService) PageSipCredential(CredentialListSid string, params *ListSipCredentialParams, pageToken, pageNumber string) (*ListSipCredentialResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials.json" +func (c *ApiService) PageSipCredential(CredentialListSid string, params *ListSipCredentialParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipCredential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipCredential(CredentialListSid string, params *ListSipCredentialParams) ([]ApiV2010SipCredential, error) { +func (c *ApiService) ListSipCredential(CredentialListSid string, params *ListSipCredentialParams) (ListSipCredential200Response, error) { response, errors := c.StreamSipCredential(CredentialListSid, params) - records := make([]ApiV2010SipCredential, 0) + records := make(ListSipCredential200Response, 0) for record := range response { records = append(records, record) } @@ -236,13 +241,13 @@ func (c *ApiService) ListSipCredential(CredentialListSid string, params *ListSip } // Streams SipCredential records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipCredential(CredentialListSid string, params *ListSipCredentialParams) (chan ApiV2010SipCredential, chan error) { +func (c *ApiService) StreamSipCredential(CredentialListSid string, params *ListSipCredentialParams) (chan ListSipCredential200Response, chan error) { if params == nil { params = &ListSipCredentialParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipCredential, 1) + recordChannel := make(chan ListSipCredential200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipCredential(CredentialListSid, params, "", "") @@ -257,11 +262,12 @@ func (c *ApiService) StreamSipCredential(CredentialListSid string, params *ListS return recordChannel, errorChannel } -func (c *ApiService) streamSipCredential(response *ListSipCredentialResponse, params *ListSipCredentialParams, recordChannel chan ApiV2010SipCredential, errorChannel chan error) { + +func (c *ApiService) streamSipCredential(response *, params *ListSipCredentialParams, recordChannel chan ListSipCredential200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Credentials + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -272,7 +278,7 @@ func (c *ApiService) streamSipCredential(response *ListSipCredentialResponse, pa } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipCredentialResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -280,77 +286,79 @@ func (c *ApiService) streamSipCredential(response *ListSipCredentialResponse, pa break } - response = record.(*ListSipCredentialResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSipCredential' type UpdateSipCredentialParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) - Password *string `json:"Password,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) + Password *string `json:"Password,omitempty"` } -func (params *UpdateSipCredentialParams) SetPathAccountSid(PathAccountSid string) *UpdateSipCredentialParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateSipCredentialParams) SetPathAccountSid(PathAccountSid string) (*UpdateSipCredentialParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateSipCredentialParams) SetPassword(Password string) *UpdateSipCredentialParams { - params.Password = &Password - return params +func (params *UpdateSipCredentialParams) SetPassword(Password string) (*UpdateSipCredentialParams){ + params.Password = &Password + return params } // Update a credential resource. func (c *ApiService) UpdateSipCredential(CredentialListSid string, Sid string, params *UpdateSipCredentialParams) (*ApiV2010SipCredential, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/CredentialLists/{CredentialListSid}/Credentials/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"CredentialListSid"+"}", CredentialListSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Password != nil { - data.Set("Password", *params.Password) - } + if params != nil && params.Password != nil { + data.Set("Password", *params.Password) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipCredential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010SipCredential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_sip_domains.go b/rest/api/v2010/accounts_sip_domains.go index e0868c6f0..369c19e20 100644 --- a/rest/api/v2010/accounts_sip_domains.go +++ b/rest/api/v2010/accounts_sip_domains.go @@ -18,307 +18,312 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipDomain' type CreateSipDomainParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \\\"-\\\" and must end with `sip.twilio.com`. - DomainName *string `json:"DomainName,omitempty"` - // A descriptive string that you created to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we should when the domain receives a call. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call to pass status parameters (such as call ended) to your application. - VoiceStatusCallbackUrl *string `json:"VoiceStatusCallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. - VoiceStatusCallbackMethod *string `json:"VoiceStatusCallbackMethod,omitempty"` - // Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. - SipRegistration *bool `json:"SipRegistration,omitempty"` - // Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. - EmergencyCallingEnabled *bool `json:"EmergencyCallingEnabled,omitempty"` - // Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. - Secure *bool `json:"Secure,omitempty"` - // The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. - ByocTrunkSid *string `json:"ByocTrunkSid,omitempty"` - // Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. - EmergencyCallerSid *string `json:"EmergencyCallerSid,omitempty"` -} - -func (params *CreateSipDomainParams) SetPathAccountSid(PathAccountSid string) *CreateSipDomainParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateSipDomainParams) SetDomainName(DomainName string) *CreateSipDomainParams { - params.DomainName = &DomainName - return params -} -func (params *CreateSipDomainParams) SetFriendlyName(FriendlyName string) *CreateSipDomainParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateSipDomainParams) SetVoiceUrl(VoiceUrl string) *CreateSipDomainParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateSipDomainParams) SetVoiceMethod(VoiceMethod string) *CreateSipDomainParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateSipDomainParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateSipDomainParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateSipDomainParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateSipDomainParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateSipDomainParams) SetVoiceStatusCallbackUrl(VoiceStatusCallbackUrl string) *CreateSipDomainParams { - params.VoiceStatusCallbackUrl = &VoiceStatusCallbackUrl - return params -} -func (params *CreateSipDomainParams) SetVoiceStatusCallbackMethod(VoiceStatusCallbackMethod string) *CreateSipDomainParams { - params.VoiceStatusCallbackMethod = &VoiceStatusCallbackMethod - return params -} -func (params *CreateSipDomainParams) SetSipRegistration(SipRegistration bool) *CreateSipDomainParams { - params.SipRegistration = &SipRegistration - return params -} -func (params *CreateSipDomainParams) SetEmergencyCallingEnabled(EmergencyCallingEnabled bool) *CreateSipDomainParams { - params.EmergencyCallingEnabled = &EmergencyCallingEnabled - return params -} -func (params *CreateSipDomainParams) SetSecure(Secure bool) *CreateSipDomainParams { - params.Secure = &Secure - return params -} -func (params *CreateSipDomainParams) SetByocTrunkSid(ByocTrunkSid string) *CreateSipDomainParams { - params.ByocTrunkSid = &ByocTrunkSid - return params -} -func (params *CreateSipDomainParams) SetEmergencyCallerSid(EmergencyCallerSid string) *CreateSipDomainParams { - params.EmergencyCallerSid = &EmergencyCallerSid - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \\\"-\\\" and must end with `sip.twilio.com`. + DomainName *string `json:"DomainName,omitempty"` + // A descriptive string that you created to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we should when the domain receives a call. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call to pass status parameters (such as call ended) to your application. + VoiceStatusCallbackUrl *string `json:"VoiceStatusCallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. + VoiceStatusCallbackMethod *string `json:"VoiceStatusCallbackMethod,omitempty"` + // Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. + SipRegistration *bool `json:"SipRegistration,omitempty"` + // Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. + EmergencyCallingEnabled *bool `json:"EmergencyCallingEnabled,omitempty"` + // Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. + Secure *bool `json:"Secure,omitempty"` + // The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. + ByocTrunkSid *string `json:"ByocTrunkSid,omitempty"` + // Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. + EmergencyCallerSid *string `json:"EmergencyCallerSid,omitempty"` +} + +func (params *CreateSipDomainParams) SetPathAccountSid(PathAccountSid string) (*CreateSipDomainParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateSipDomainParams) SetDomainName(DomainName string) (*CreateSipDomainParams){ + params.DomainName = &DomainName + return params +} +func (params *CreateSipDomainParams) SetFriendlyName(FriendlyName string) (*CreateSipDomainParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateSipDomainParams) SetVoiceUrl(VoiceUrl string) (*CreateSipDomainParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateSipDomainParams) SetVoiceMethod(VoiceMethod string) (*CreateSipDomainParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateSipDomainParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateSipDomainParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateSipDomainParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateSipDomainParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateSipDomainParams) SetVoiceStatusCallbackUrl(VoiceStatusCallbackUrl string) (*CreateSipDomainParams){ + params.VoiceStatusCallbackUrl = &VoiceStatusCallbackUrl + return params +} +func (params *CreateSipDomainParams) SetVoiceStatusCallbackMethod(VoiceStatusCallbackMethod string) (*CreateSipDomainParams){ + params.VoiceStatusCallbackMethod = &VoiceStatusCallbackMethod + return params +} +func (params *CreateSipDomainParams) SetSipRegistration(SipRegistration bool) (*CreateSipDomainParams){ + params.SipRegistration = &SipRegistration + return params +} +func (params *CreateSipDomainParams) SetEmergencyCallingEnabled(EmergencyCallingEnabled bool) (*CreateSipDomainParams){ + params.EmergencyCallingEnabled = &EmergencyCallingEnabled + return params +} +func (params *CreateSipDomainParams) SetSecure(Secure bool) (*CreateSipDomainParams){ + params.Secure = &Secure + return params +} +func (params *CreateSipDomainParams) SetByocTrunkSid(ByocTrunkSid string) (*CreateSipDomainParams){ + params.ByocTrunkSid = &ByocTrunkSid + return params +} +func (params *CreateSipDomainParams) SetEmergencyCallerSid(EmergencyCallerSid string) (*CreateSipDomainParams){ + params.EmergencyCallerSid = &EmergencyCallerSid + return params } // Create a new Domain func (c *ApiService) CreateSipDomain(params *CreateSipDomainParams) (*ApiV2010SipDomain, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DomainName != nil { - data.Set("DomainName", *params.DomainName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceStatusCallbackUrl != nil { - data.Set("VoiceStatusCallbackUrl", *params.VoiceStatusCallbackUrl) - } - if params != nil && params.VoiceStatusCallbackMethod != nil { - data.Set("VoiceStatusCallbackMethod", *params.VoiceStatusCallbackMethod) - } - if params != nil && params.SipRegistration != nil { - data.Set("SipRegistration", fmt.Sprint(*params.SipRegistration)) - } - if params != nil && params.EmergencyCallingEnabled != nil { - data.Set("EmergencyCallingEnabled", fmt.Sprint(*params.EmergencyCallingEnabled)) - } - if params != nil && params.Secure != nil { - data.Set("Secure", fmt.Sprint(*params.Secure)) - } - if params != nil && params.ByocTrunkSid != nil { - data.Set("ByocTrunkSid", *params.ByocTrunkSid) - } - if params != nil && params.EmergencyCallerSid != nil { - data.Set("EmergencyCallerSid", *params.EmergencyCallerSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010SipDomain{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DomainName != nil { + data.Set("DomainName", *params.DomainName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceStatusCallbackUrl != nil { + data.Set("VoiceStatusCallbackUrl", *params.VoiceStatusCallbackUrl) + } + if params != nil && params.VoiceStatusCallbackMethod != nil { + data.Set("VoiceStatusCallbackMethod", *params.VoiceStatusCallbackMethod) + } + if params != nil && params.SipRegistration != nil { + data.Set("SipRegistration", fmt.Sprint(*params.SipRegistration)) + } + if params != nil && params.EmergencyCallingEnabled != nil { + data.Set("EmergencyCallingEnabled", fmt.Sprint(*params.EmergencyCallingEnabled)) + } + if params != nil && params.Secure != nil { + data.Set("Secure", fmt.Sprint(*params.Secure)) + } + if params != nil && params.ByocTrunkSid != nil { + data.Set("ByocTrunkSid", *params.ByocTrunkSid) + } + if params != nil && params.EmergencyCallerSid != nil { + data.Set("EmergencyCallerSid", *params.EmergencyCallerSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipDomain{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipDomain' type DeleteSipDomainParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipDomainParams) SetPathAccountSid(PathAccountSid string) *DeleteSipDomainParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipDomainParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipDomainParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete an instance of a Domain -func (c *ApiService) DeleteSipDomain(Sid string, params *DeleteSipDomainParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipDomain(Sid string, params *DeleteSipDomainParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipDomain' type FetchSipDomainParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipDomainParams) SetPathAccountSid(PathAccountSid string) *FetchSipDomainParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipDomainParams) SetPathAccountSid(PathAccountSid string) (*FetchSipDomainParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a Domain func (c *ApiService) FetchSipDomain(Sid string, params *FetchSipDomainParams) (*ApiV2010SipDomain, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipDomain{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipDomain{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSipDomain' type ListSipDomainParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipDomainParams) SetPathAccountSid(PathAccountSid string) *ListSipDomainParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipDomainParams) SetPathAccountSid(PathAccountSid string) (*ListSipDomainParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipDomainParams) SetPageSize(PageSize int) *ListSipDomainParams { - params.PageSize = &PageSize - return params +func (params *ListSipDomainParams) SetPageSize(PageSize int) (*ListSipDomainParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipDomainParams) SetLimit(Limit int) *ListSipDomainParams { - params.Limit = &Limit - return params +func (params *ListSipDomainParams) SetLimit(Limit int) (*ListSipDomainParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipDomain records from the API. Request is executed immediately. -func (c *ApiService) PageSipDomain(params *ListSipDomainParams, pageToken, pageNumber string) (*ListSipDomainResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains.json" +func (c *ApiService) PageSipDomain(params *ListSipDomainParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipDomainResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipDomain records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipDomain(params *ListSipDomainParams) ([]ApiV2010SipDomain, error) { +func (c *ApiService) ListSipDomain(params *ListSipDomainParams) (ListSipDomain200Response, error) { response, errors := c.StreamSipDomain(params) - records := make([]ApiV2010SipDomain, 0) + records := make(ListSipDomain200Response, 0) for record := range response { records = append(records, record) } @@ -331,13 +336,13 @@ func (c *ApiService) ListSipDomain(params *ListSipDomainParams) ([]ApiV2010SipDo } // Streams SipDomain records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipDomain(params *ListSipDomainParams) (chan ApiV2010SipDomain, chan error) { +func (c *ApiService) StreamSipDomain(params *ListSipDomainParams) (chan ListSipDomain200Response, chan error) { if params == nil { params = &ListSipDomainParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipDomain, 1) + recordChannel := make(chan ListSipDomain200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipDomain(params, "", "") @@ -352,11 +357,12 @@ func (c *ApiService) StreamSipDomain(params *ListSipDomainParams) (chan ApiV2010 return recordChannel, errorChannel } -func (c *ApiService) streamSipDomain(response *ListSipDomainResponse, params *ListSipDomainParams, recordChannel chan ApiV2010SipDomain, errorChannel chan error) { + +func (c *ApiService) streamSipDomain(response *, params *ListSipDomainParams, recordChannel chan ListSipDomain200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Domains + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -367,7 +373,7 @@ func (c *ApiService) streamSipDomain(response *ListSipDomainResponse, params *Li } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipDomainResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -375,184 +381,186 @@ func (c *ApiService) streamSipDomain(response *ListSipDomainResponse, params *Li break } - response = record.(*ListSipDomainResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipDomainResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipDomainResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSipDomain' type UpdateSipDomainParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you created to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_url` - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. - VoiceStatusCallbackMethod *string `json:"VoiceStatusCallbackMethod,omitempty"` - // The URL that we should call to pass status parameters (such as call ended) to your application. - VoiceStatusCallbackUrl *string `json:"VoiceStatusCallbackUrl,omitempty"` - // The URL we should call when the domain receives a call. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. - SipRegistration *bool `json:"SipRegistration,omitempty"` - // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \\\"-\\\" and must end with `sip.twilio.com`. - DomainName *string `json:"DomainName,omitempty"` - // Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. - EmergencyCallingEnabled *bool `json:"EmergencyCallingEnabled,omitempty"` - // Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. - Secure *bool `json:"Secure,omitempty"` - // The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. - ByocTrunkSid *string `json:"ByocTrunkSid,omitempty"` - // Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. - EmergencyCallerSid *string `json:"EmergencyCallerSid,omitempty"` -} - -func (params *UpdateSipDomainParams) SetPathAccountSid(PathAccountSid string) *UpdateSipDomainParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *UpdateSipDomainParams) SetFriendlyName(FriendlyName string) *UpdateSipDomainParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateSipDomainParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *UpdateSipDomainParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *UpdateSipDomainParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *UpdateSipDomainParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *UpdateSipDomainParams) SetVoiceMethod(VoiceMethod string) *UpdateSipDomainParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *UpdateSipDomainParams) SetVoiceStatusCallbackMethod(VoiceStatusCallbackMethod string) *UpdateSipDomainParams { - params.VoiceStatusCallbackMethod = &VoiceStatusCallbackMethod - return params -} -func (params *UpdateSipDomainParams) SetVoiceStatusCallbackUrl(VoiceStatusCallbackUrl string) *UpdateSipDomainParams { - params.VoiceStatusCallbackUrl = &VoiceStatusCallbackUrl - return params -} -func (params *UpdateSipDomainParams) SetVoiceUrl(VoiceUrl string) *UpdateSipDomainParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *UpdateSipDomainParams) SetSipRegistration(SipRegistration bool) *UpdateSipDomainParams { - params.SipRegistration = &SipRegistration - return params -} -func (params *UpdateSipDomainParams) SetDomainName(DomainName string) *UpdateSipDomainParams { - params.DomainName = &DomainName - return params -} -func (params *UpdateSipDomainParams) SetEmergencyCallingEnabled(EmergencyCallingEnabled bool) *UpdateSipDomainParams { - params.EmergencyCallingEnabled = &EmergencyCallingEnabled - return params -} -func (params *UpdateSipDomainParams) SetSecure(Secure bool) *UpdateSipDomainParams { - params.Secure = &Secure - return params -} -func (params *UpdateSipDomainParams) SetByocTrunkSid(ByocTrunkSid string) *UpdateSipDomainParams { - params.ByocTrunkSid = &ByocTrunkSid - return params -} -func (params *UpdateSipDomainParams) SetEmergencyCallerSid(EmergencyCallerSid string) *UpdateSipDomainParams { - params.EmergencyCallerSid = &EmergencyCallerSid - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you created to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_url` + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. + VoiceStatusCallbackMethod *string `json:"VoiceStatusCallbackMethod,omitempty"` + // The URL that we should call to pass status parameters (such as call ended) to your application. + VoiceStatusCallbackUrl *string `json:"VoiceStatusCallbackUrl,omitempty"` + // The URL we should call when the domain receives a call. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. + SipRegistration *bool `json:"SipRegistration,omitempty"` + // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \\\"-\\\" and must end with `sip.twilio.com`. + DomainName *string `json:"DomainName,omitempty"` + // Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. + EmergencyCallingEnabled *bool `json:"EmergencyCallingEnabled,omitempty"` + // Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. + Secure *bool `json:"Secure,omitempty"` + // The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. + ByocTrunkSid *string `json:"ByocTrunkSid,omitempty"` + // Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. + EmergencyCallerSid *string `json:"EmergencyCallerSid,omitempty"` +} + +func (params *UpdateSipDomainParams) SetPathAccountSid(PathAccountSid string) (*UpdateSipDomainParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *UpdateSipDomainParams) SetFriendlyName(FriendlyName string) (*UpdateSipDomainParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateSipDomainParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*UpdateSipDomainParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *UpdateSipDomainParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*UpdateSipDomainParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *UpdateSipDomainParams) SetVoiceMethod(VoiceMethod string) (*UpdateSipDomainParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *UpdateSipDomainParams) SetVoiceStatusCallbackMethod(VoiceStatusCallbackMethod string) (*UpdateSipDomainParams){ + params.VoiceStatusCallbackMethod = &VoiceStatusCallbackMethod + return params +} +func (params *UpdateSipDomainParams) SetVoiceStatusCallbackUrl(VoiceStatusCallbackUrl string) (*UpdateSipDomainParams){ + params.VoiceStatusCallbackUrl = &VoiceStatusCallbackUrl + return params +} +func (params *UpdateSipDomainParams) SetVoiceUrl(VoiceUrl string) (*UpdateSipDomainParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *UpdateSipDomainParams) SetSipRegistration(SipRegistration bool) (*UpdateSipDomainParams){ + params.SipRegistration = &SipRegistration + return params +} +func (params *UpdateSipDomainParams) SetDomainName(DomainName string) (*UpdateSipDomainParams){ + params.DomainName = &DomainName + return params +} +func (params *UpdateSipDomainParams) SetEmergencyCallingEnabled(EmergencyCallingEnabled bool) (*UpdateSipDomainParams){ + params.EmergencyCallingEnabled = &EmergencyCallingEnabled + return params +} +func (params *UpdateSipDomainParams) SetSecure(Secure bool) (*UpdateSipDomainParams){ + params.Secure = &Secure + return params +} +func (params *UpdateSipDomainParams) SetByocTrunkSid(ByocTrunkSid string) (*UpdateSipDomainParams){ + params.ByocTrunkSid = &ByocTrunkSid + return params +} +func (params *UpdateSipDomainParams) SetEmergencyCallerSid(EmergencyCallerSid string) (*UpdateSipDomainParams){ + params.EmergencyCallerSid = &EmergencyCallerSid + return params } // Update the attributes of a domain func (c *ApiService) UpdateSipDomain(Sid string, params *UpdateSipDomainParams) (*ApiV2010SipDomain, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceStatusCallbackMethod != nil { - data.Set("VoiceStatusCallbackMethod", *params.VoiceStatusCallbackMethod) - } - if params != nil && params.VoiceStatusCallbackUrl != nil { - data.Set("VoiceStatusCallbackUrl", *params.VoiceStatusCallbackUrl) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.SipRegistration != nil { - data.Set("SipRegistration", fmt.Sprint(*params.SipRegistration)) - } - if params != nil && params.DomainName != nil { - data.Set("DomainName", *params.DomainName) - } - if params != nil && params.EmergencyCallingEnabled != nil { - data.Set("EmergencyCallingEnabled", fmt.Sprint(*params.EmergencyCallingEnabled)) - } - if params != nil && params.Secure != nil { - data.Set("Secure", fmt.Sprint(*params.Secure)) - } - if params != nil && params.ByocTrunkSid != nil { - data.Set("ByocTrunkSid", *params.ByocTrunkSid) - } - if params != nil && params.EmergencyCallerSid != nil { - data.Set("EmergencyCallerSid", *params.EmergencyCallerSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010SipDomain{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceStatusCallbackMethod != nil { + data.Set("VoiceStatusCallbackMethod", *params.VoiceStatusCallbackMethod) + } + if params != nil && params.VoiceStatusCallbackUrl != nil { + data.Set("VoiceStatusCallbackUrl", *params.VoiceStatusCallbackUrl) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.SipRegistration != nil { + data.Set("SipRegistration", fmt.Sprint(*params.SipRegistration)) + } + if params != nil && params.DomainName != nil { + data.Set("DomainName", *params.DomainName) + } + if params != nil && params.EmergencyCallingEnabled != nil { + data.Set("EmergencyCallingEnabled", fmt.Sprint(*params.EmergencyCallingEnabled)) + } + if params != nil && params.Secure != nil { + data.Set("Secure", fmt.Sprint(*params.Secure)) + } + if params != nil && params.ByocTrunkSid != nil { + data.Set("ByocTrunkSid", *params.ByocTrunkSid) + } + if params != nil && params.EmergencyCallerSid != nil { + data.Set("EmergencyCallerSid", *params.EmergencyCallerSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipDomain{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_sip_domains_auth_calls_credential_list_mappings.go b/rest/api/v2010/accounts_sip_domains_auth_calls_credential_list_mappings.go index f3d34690e..bac3b680a 100644 --- a/rest/api/v2010/accounts_sip_domains_auth_calls_credential_list_mappings.go +++ b/rest/api/v2010/accounts_sip_domains_auth_calls_credential_list_mappings.go @@ -18,203 +18,208 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipAuthCallsCredentialListMapping' type CreateSipAuthCallsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The SID of the CredentialList resource to map to the SIP domain. - CredentialListSid *string `json:"CredentialListSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the CredentialList resource to map to the SIP domain. + CredentialListSid *string `json:"CredentialListSid,omitempty"` } -func (params *CreateSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *CreateSipAuthCallsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*CreateSipAuthCallsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipAuthCallsCredentialListMappingParams) SetCredentialListSid(CredentialListSid string) *CreateSipAuthCallsCredentialListMappingParams { - params.CredentialListSid = &CredentialListSid - return params +func (params *CreateSipAuthCallsCredentialListMappingParams) SetCredentialListSid(CredentialListSid string) (*CreateSipAuthCallsCredentialListMappingParams){ + params.CredentialListSid = &CredentialListSid + return params } // Create a new credential list mapping resource func (c *ApiService) CreateSipAuthCallsCredentialListMapping(DomainSid string, params *CreateSipAuthCallsCredentialListMappingParams) (*ApiV2010SipAuthCallsCredentialListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.CredentialListSid != nil { - data.Set("CredentialListSid", *params.CredentialListSid) - } + if params != nil && params.CredentialListSid != nil { + data.Set("CredentialListSid", *params.CredentialListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipAuthCallsCredentialListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipAuthCallsCredentialListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipAuthCallsCredentialListMapping' type DeleteSipAuthCallsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *DeleteSipAuthCallsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipAuthCallsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a credential list mapping from the requested domain -func (c *ApiService) DeleteSipAuthCallsCredentialListMapping(DomainSid string, Sid string, params *DeleteSipAuthCallsCredentialListMappingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipAuthCallsCredentialListMapping(DomainSid string, Sid string, params *DeleteSipAuthCallsCredentialListMappingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipAuthCallsCredentialListMapping' type FetchSipAuthCallsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *FetchSipAuthCallsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*FetchSipAuthCallsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a specific instance of a credential list mapping func (c *ApiService) FetchSipAuthCallsCredentialListMapping(DomainSid string, Sid string, params *FetchSipAuthCallsCredentialListMappingParams) (*ApiV2010SipAuthCallsCredentialListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipAuthCallsCredentialListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipAuthCallsCredentialListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSipAuthCallsCredentialListMapping' type ListSipAuthCallsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *ListSipAuthCallsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipAuthCallsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*ListSipAuthCallsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipAuthCallsCredentialListMappingParams) SetPageSize(PageSize int) *ListSipAuthCallsCredentialListMappingParams { - params.PageSize = &PageSize - return params +func (params *ListSipAuthCallsCredentialListMappingParams) SetPageSize(PageSize int) (*ListSipAuthCallsCredentialListMappingParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipAuthCallsCredentialListMappingParams) SetLimit(Limit int) *ListSipAuthCallsCredentialListMappingParams { - params.Limit = &Limit - return params +func (params *ListSipAuthCallsCredentialListMappingParams) SetLimit(Limit int) (*ListSipAuthCallsCredentialListMappingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipAuthCallsCredentialListMapping records from the API. Request is executed immediately. -func (c *ApiService) PageSipAuthCallsCredentialListMapping(DomainSid string, params *ListSipAuthCallsCredentialListMappingParams, pageToken, pageNumber string) (*ListSipAuthCallsCredentialListMappingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings.json" +func (c *ApiService) PageSipAuthCallsCredentialListMapping(DomainSid string, params *ListSipAuthCallsCredentialListMappingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/CredentialListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipAuthCallsCredentialListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipAuthCallsCredentialListMapping records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipAuthCallsCredentialListMapping(DomainSid string, params *ListSipAuthCallsCredentialListMappingParams) ([]ApiV2010SipAuthCallsCredentialListMapping, error) { +func (c *ApiService) ListSipAuthCallsCredentialListMapping(DomainSid string, params *ListSipAuthCallsCredentialListMappingParams) (ListSipAuthCallsCredentialListMapping200Response, error) { response, errors := c.StreamSipAuthCallsCredentialListMapping(DomainSid, params) - records := make([]ApiV2010SipAuthCallsCredentialListMapping, 0) + records := make(ListSipAuthCallsCredentialListMapping200Response, 0) for record := range response { records = append(records, record) } @@ -227,13 +232,13 @@ func (c *ApiService) ListSipAuthCallsCredentialListMapping(DomainSid string, par } // Streams SipAuthCallsCredentialListMapping records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipAuthCallsCredentialListMapping(DomainSid string, params *ListSipAuthCallsCredentialListMappingParams) (chan ApiV2010SipAuthCallsCredentialListMapping, chan error) { +func (c *ApiService) StreamSipAuthCallsCredentialListMapping(DomainSid string, params *ListSipAuthCallsCredentialListMappingParams) (chan ListSipAuthCallsCredentialListMapping200Response, chan error) { if params == nil { params = &ListSipAuthCallsCredentialListMappingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipAuthCallsCredentialListMapping, 1) + recordChannel := make(chan ListSipAuthCallsCredentialListMapping200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipAuthCallsCredentialListMapping(DomainSid, params, "", "") @@ -248,11 +253,12 @@ func (c *ApiService) StreamSipAuthCallsCredentialListMapping(DomainSid string, p return recordChannel, errorChannel } -func (c *ApiService) streamSipAuthCallsCredentialListMapping(response *ListSipAuthCallsCredentialListMappingResponse, params *ListSipAuthCallsCredentialListMappingParams, recordChannel chan ApiV2010SipAuthCallsCredentialListMapping, errorChannel chan error) { + +func (c *ApiService) streamSipAuthCallsCredentialListMapping(response *, params *ListSipAuthCallsCredentialListMappingParams, recordChannel chan ListSipAuthCallsCredentialListMapping200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Contents + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -263,7 +269,7 @@ func (c *ApiService) streamSipAuthCallsCredentialListMapping(response *ListSipAu } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipAuthCallsCredentialListMappingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -271,27 +277,28 @@ func (c *ApiService) streamSipAuthCallsCredentialListMapping(response *ListSipAu break } - response = record.(*ListSipAuthCallsCredentialListMappingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipAuthCallsCredentialListMappingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipAuthCallsCredentialListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_sip_domains_auth_calls_ip_access_control_list_mappings.go b/rest/api/v2010/accounts_sip_domains_auth_calls_ip_access_control_list_mappings.go index 86daa24f0..67f8a6048 100644 --- a/rest/api/v2010/accounts_sip_domains_auth_calls_ip_access_control_list_mappings.go +++ b/rest/api/v2010/accounts_sip_domains_auth_calls_ip_access_control_list_mappings.go @@ -18,203 +18,208 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipAuthCallsIpAccessControlListMapping' type CreateSipAuthCallsIpAccessControlListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The SID of the IpAccessControlList resource to map to the SIP domain. - IpAccessControlListSid *string `json:"IpAccessControlListSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the IpAccessControlList resource to map to the SIP domain. + IpAccessControlListSid *string `json:"IpAccessControlListSid,omitempty"` } -func (params *CreateSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *CreateSipAuthCallsIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*CreateSipAuthCallsIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipAuthCallsIpAccessControlListMappingParams) SetIpAccessControlListSid(IpAccessControlListSid string) *CreateSipAuthCallsIpAccessControlListMappingParams { - params.IpAccessControlListSid = &IpAccessControlListSid - return params +func (params *CreateSipAuthCallsIpAccessControlListMappingParams) SetIpAccessControlListSid(IpAccessControlListSid string) (*CreateSipAuthCallsIpAccessControlListMappingParams){ + params.IpAccessControlListSid = &IpAccessControlListSid + return params } // Create a new IP Access Control List mapping func (c *ApiService) CreateSipAuthCallsIpAccessControlListMapping(DomainSid string, params *CreateSipAuthCallsIpAccessControlListMappingParams) (*ApiV2010SipAuthCallsIpAccessControlListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IpAccessControlListSid != nil { - data.Set("IpAccessControlListSid", *params.IpAccessControlListSid) - } + if params != nil && params.IpAccessControlListSid != nil { + data.Set("IpAccessControlListSid", *params.IpAccessControlListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipAuthCallsIpAccessControlListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipAuthCallsIpAccessControlListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipAuthCallsIpAccessControlListMapping' type DeleteSipAuthCallsIpAccessControlListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *DeleteSipAuthCallsIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipAuthCallsIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete an IP Access Control List mapping from the requested domain -func (c *ApiService) DeleteSipAuthCallsIpAccessControlListMapping(DomainSid string, Sid string, params *DeleteSipAuthCallsIpAccessControlListMappingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipAuthCallsIpAccessControlListMapping(DomainSid string, Sid string, params *DeleteSipAuthCallsIpAccessControlListMappingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipAuthCallsIpAccessControlListMapping' type FetchSipAuthCallsIpAccessControlListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *FetchSipAuthCallsIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*FetchSipAuthCallsIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a specific instance of an IP Access Control List mapping func (c *ApiService) FetchSipAuthCallsIpAccessControlListMapping(DomainSid string, Sid string, params *FetchSipAuthCallsIpAccessControlListMappingParams) (*ApiV2010SipAuthCallsIpAccessControlListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipAuthCallsIpAccessControlListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipAuthCallsIpAccessControlListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSipAuthCallsIpAccessControlListMapping' type ListSipAuthCallsIpAccessControlListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *ListSipAuthCallsIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipAuthCallsIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*ListSipAuthCallsIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipAuthCallsIpAccessControlListMappingParams) SetPageSize(PageSize int) *ListSipAuthCallsIpAccessControlListMappingParams { - params.PageSize = &PageSize - return params +func (params *ListSipAuthCallsIpAccessControlListMappingParams) SetPageSize(PageSize int) (*ListSipAuthCallsIpAccessControlListMappingParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipAuthCallsIpAccessControlListMappingParams) SetLimit(Limit int) *ListSipAuthCallsIpAccessControlListMappingParams { - params.Limit = &Limit - return params +func (params *ListSipAuthCallsIpAccessControlListMappingParams) SetLimit(Limit int) (*ListSipAuthCallsIpAccessControlListMappingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipAuthCallsIpAccessControlListMapping records from the API. Request is executed immediately. -func (c *ApiService) PageSipAuthCallsIpAccessControlListMapping(DomainSid string, params *ListSipAuthCallsIpAccessControlListMappingParams, pageToken, pageNumber string) (*ListSipAuthCallsIpAccessControlListMappingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings.json" +func (c *ApiService) PageSipAuthCallsIpAccessControlListMapping(DomainSid string, params *ListSipAuthCallsIpAccessControlListMappingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Calls/IpAccessControlListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipAuthCallsIpAccessControlListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipAuthCallsIpAccessControlListMapping records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipAuthCallsIpAccessControlListMapping(DomainSid string, params *ListSipAuthCallsIpAccessControlListMappingParams) ([]ApiV2010SipAuthCallsIpAccessControlListMapping, error) { +func (c *ApiService) ListSipAuthCallsIpAccessControlListMapping(DomainSid string, params *ListSipAuthCallsIpAccessControlListMappingParams) (ListSipAuthCallsIpAccessControlListMapping200Response, error) { response, errors := c.StreamSipAuthCallsIpAccessControlListMapping(DomainSid, params) - records := make([]ApiV2010SipAuthCallsIpAccessControlListMapping, 0) + records := make(ListSipAuthCallsIpAccessControlListMapping200Response, 0) for record := range response { records = append(records, record) } @@ -227,13 +232,13 @@ func (c *ApiService) ListSipAuthCallsIpAccessControlListMapping(DomainSid string } // Streams SipAuthCallsIpAccessControlListMapping records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipAuthCallsIpAccessControlListMapping(DomainSid string, params *ListSipAuthCallsIpAccessControlListMappingParams) (chan ApiV2010SipAuthCallsIpAccessControlListMapping, chan error) { +func (c *ApiService) StreamSipAuthCallsIpAccessControlListMapping(DomainSid string, params *ListSipAuthCallsIpAccessControlListMappingParams) (chan ListSipAuthCallsIpAccessControlListMapping200Response, chan error) { if params == nil { params = &ListSipAuthCallsIpAccessControlListMappingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipAuthCallsIpAccessControlListMapping, 1) + recordChannel := make(chan ListSipAuthCallsIpAccessControlListMapping200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipAuthCallsIpAccessControlListMapping(DomainSid, params, "", "") @@ -248,11 +253,12 @@ func (c *ApiService) StreamSipAuthCallsIpAccessControlListMapping(DomainSid stri return recordChannel, errorChannel } -func (c *ApiService) streamSipAuthCallsIpAccessControlListMapping(response *ListSipAuthCallsIpAccessControlListMappingResponse, params *ListSipAuthCallsIpAccessControlListMappingParams, recordChannel chan ApiV2010SipAuthCallsIpAccessControlListMapping, errorChannel chan error) { + +func (c *ApiService) streamSipAuthCallsIpAccessControlListMapping(response *, params *ListSipAuthCallsIpAccessControlListMappingParams, recordChannel chan ListSipAuthCallsIpAccessControlListMapping200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Contents + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -263,7 +269,7 @@ func (c *ApiService) streamSipAuthCallsIpAccessControlListMapping(response *List } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipAuthCallsIpAccessControlListMappingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -271,27 +277,28 @@ func (c *ApiService) streamSipAuthCallsIpAccessControlListMapping(response *List break } - response = record.(*ListSipAuthCallsIpAccessControlListMappingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipAuthCallsIpAccessControlListMappingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipAuthCallsIpAccessControlListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_sip_domains_auth_registrations_credential_list_mappings.go b/rest/api/v2010/accounts_sip_domains_auth_registrations_credential_list_mappings.go index 431e5099b..8d0e6b10b 100644 --- a/rest/api/v2010/accounts_sip_domains_auth_registrations_credential_list_mappings.go +++ b/rest/api/v2010/accounts_sip_domains_auth_registrations_credential_list_mappings.go @@ -18,203 +18,208 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipAuthRegistrationsCredentialListMapping' type CreateSipAuthRegistrationsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The SID of the CredentialList resource to map to the SIP domain. - CredentialListSid *string `json:"CredentialListSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the CredentialList resource to map to the SIP domain. + CredentialListSid *string `json:"CredentialListSid,omitempty"` } -func (params *CreateSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *CreateSipAuthRegistrationsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*CreateSipAuthRegistrationsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipAuthRegistrationsCredentialListMappingParams) SetCredentialListSid(CredentialListSid string) *CreateSipAuthRegistrationsCredentialListMappingParams { - params.CredentialListSid = &CredentialListSid - return params +func (params *CreateSipAuthRegistrationsCredentialListMappingParams) SetCredentialListSid(CredentialListSid string) (*CreateSipAuthRegistrationsCredentialListMappingParams){ + params.CredentialListSid = &CredentialListSid + return params } // Create a new credential list mapping resource func (c *ApiService) CreateSipAuthRegistrationsCredentialListMapping(DomainSid string, params *CreateSipAuthRegistrationsCredentialListMappingParams) (*ApiV2010SipAuthRegistrationsCredentialListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.CredentialListSid != nil { - data.Set("CredentialListSid", *params.CredentialListSid) - } + if params != nil && params.CredentialListSid != nil { + data.Set("CredentialListSid", *params.CredentialListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipAuthRegistrationsCredentialListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipAuthRegistrationsCredentialListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipAuthRegistrationsCredentialListMapping' type DeleteSipAuthRegistrationsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *DeleteSipAuthRegistrationsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipAuthRegistrationsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a credential list mapping from the requested domain -func (c *ApiService) DeleteSipAuthRegistrationsCredentialListMapping(DomainSid string, Sid string, params *DeleteSipAuthRegistrationsCredentialListMappingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipAuthRegistrationsCredentialListMapping(DomainSid string, Sid string, params *DeleteSipAuthRegistrationsCredentialListMappingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipAuthRegistrationsCredentialListMapping' type FetchSipAuthRegistrationsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *FetchSipAuthRegistrationsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*FetchSipAuthRegistrationsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a specific instance of a credential list mapping func (c *ApiService) FetchSipAuthRegistrationsCredentialListMapping(DomainSid string, Sid string, params *FetchSipAuthRegistrationsCredentialListMappingParams) (*ApiV2010SipAuthRegistrationsCredentialListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipAuthRegistrationsCredentialListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipAuthRegistrationsCredentialListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSipAuthRegistrationsCredentialListMapping' type ListSipAuthRegistrationsCredentialListMappingParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *ListSipAuthRegistrationsCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipAuthRegistrationsCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*ListSipAuthRegistrationsCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipAuthRegistrationsCredentialListMappingParams) SetPageSize(PageSize int) *ListSipAuthRegistrationsCredentialListMappingParams { - params.PageSize = &PageSize - return params +func (params *ListSipAuthRegistrationsCredentialListMappingParams) SetPageSize(PageSize int) (*ListSipAuthRegistrationsCredentialListMappingParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipAuthRegistrationsCredentialListMappingParams) SetLimit(Limit int) *ListSipAuthRegistrationsCredentialListMappingParams { - params.Limit = &Limit - return params +func (params *ListSipAuthRegistrationsCredentialListMappingParams) SetLimit(Limit int) (*ListSipAuthRegistrationsCredentialListMappingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipAuthRegistrationsCredentialListMapping records from the API. Request is executed immediately. -func (c *ApiService) PageSipAuthRegistrationsCredentialListMapping(DomainSid string, params *ListSipAuthRegistrationsCredentialListMappingParams, pageToken, pageNumber string) (*ListSipAuthRegistrationsCredentialListMappingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings.json" +func (c *ApiService) PageSipAuthRegistrationsCredentialListMapping(DomainSid string, params *ListSipAuthRegistrationsCredentialListMappingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/Auth/Registrations/CredentialListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipAuthRegistrationsCredentialListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipAuthRegistrationsCredentialListMapping records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipAuthRegistrationsCredentialListMapping(DomainSid string, params *ListSipAuthRegistrationsCredentialListMappingParams) ([]ApiV2010SipAuthRegistrationsCredentialListMapping, error) { +func (c *ApiService) ListSipAuthRegistrationsCredentialListMapping(DomainSid string, params *ListSipAuthRegistrationsCredentialListMappingParams) (ListSipAuthRegistrationsCredentialListMapping200Response, error) { response, errors := c.StreamSipAuthRegistrationsCredentialListMapping(DomainSid, params) - records := make([]ApiV2010SipAuthRegistrationsCredentialListMapping, 0) + records := make(ListSipAuthRegistrationsCredentialListMapping200Response, 0) for record := range response { records = append(records, record) } @@ -227,13 +232,13 @@ func (c *ApiService) ListSipAuthRegistrationsCredentialListMapping(DomainSid str } // Streams SipAuthRegistrationsCredentialListMapping records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipAuthRegistrationsCredentialListMapping(DomainSid string, params *ListSipAuthRegistrationsCredentialListMappingParams) (chan ApiV2010SipAuthRegistrationsCredentialListMapping, chan error) { +func (c *ApiService) StreamSipAuthRegistrationsCredentialListMapping(DomainSid string, params *ListSipAuthRegistrationsCredentialListMappingParams) (chan ListSipAuthRegistrationsCredentialListMapping200Response, chan error) { if params == nil { params = &ListSipAuthRegistrationsCredentialListMappingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipAuthRegistrationsCredentialListMapping, 1) + recordChannel := make(chan ListSipAuthRegistrationsCredentialListMapping200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipAuthRegistrationsCredentialListMapping(DomainSid, params, "", "") @@ -248,11 +253,12 @@ func (c *ApiService) StreamSipAuthRegistrationsCredentialListMapping(DomainSid s return recordChannel, errorChannel } -func (c *ApiService) streamSipAuthRegistrationsCredentialListMapping(response *ListSipAuthRegistrationsCredentialListMappingResponse, params *ListSipAuthRegistrationsCredentialListMappingParams, recordChannel chan ApiV2010SipAuthRegistrationsCredentialListMapping, errorChannel chan error) { + +func (c *ApiService) streamSipAuthRegistrationsCredentialListMapping(response *, params *ListSipAuthRegistrationsCredentialListMappingParams, recordChannel chan ListSipAuthRegistrationsCredentialListMapping200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Contents + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -263,7 +269,7 @@ func (c *ApiService) streamSipAuthRegistrationsCredentialListMapping(response *L } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipAuthRegistrationsCredentialListMappingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -271,27 +277,28 @@ func (c *ApiService) streamSipAuthRegistrationsCredentialListMapping(response *L break } - response = record.(*ListSipAuthRegistrationsCredentialListMappingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipAuthRegistrationsCredentialListMappingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipAuthRegistrationsCredentialListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_sip_domains_credential_list_mappings.go b/rest/api/v2010/accounts_sip_domains_credential_list_mappings.go index 09ac9162e..c5f804536 100644 --- a/rest/api/v2010/accounts_sip_domains_credential_list_mappings.go +++ b/rest/api/v2010/accounts_sip_domains_credential_list_mappings.go @@ -18,203 +18,208 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipCredentialListMapping' type CreateSipCredentialListMappingParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A 34 character string that uniquely identifies the CredentialList resource to map to the SIP domain. - CredentialListSid *string `json:"CredentialListSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A 34 character string that uniquely identifies the CredentialList resource to map to the SIP domain. + CredentialListSid *string `json:"CredentialListSid,omitempty"` } -func (params *CreateSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *CreateSipCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*CreateSipCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipCredentialListMappingParams) SetCredentialListSid(CredentialListSid string) *CreateSipCredentialListMappingParams { - params.CredentialListSid = &CredentialListSid - return params +func (params *CreateSipCredentialListMappingParams) SetCredentialListSid(CredentialListSid string) (*CreateSipCredentialListMappingParams){ + params.CredentialListSid = &CredentialListSid + return params } // Create a CredentialListMapping resource for an account. func (c *ApiService) CreateSipCredentialListMapping(DomainSid string, params *CreateSipCredentialListMappingParams) (*ApiV2010SipCredentialListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.CredentialListSid != nil { - data.Set("CredentialListSid", *params.CredentialListSid) - } + if params != nil && params.CredentialListSid != nil { + data.Set("CredentialListSid", *params.CredentialListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipCredentialListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipCredentialListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipCredentialListMapping' type DeleteSipCredentialListMappingParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *DeleteSipCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a CredentialListMapping resource from an account. -func (c *ApiService) DeleteSipCredentialListMapping(DomainSid string, Sid string, params *DeleteSipCredentialListMappingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipCredentialListMapping(DomainSid string, Sid string, params *DeleteSipCredentialListMappingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipCredentialListMapping' type FetchSipCredentialListMappingParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *FetchSipCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*FetchSipCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a single CredentialListMapping resource from an account. func (c *ApiService) FetchSipCredentialListMapping(DomainSid string, Sid string, params *FetchSipCredentialListMappingParams) (*ApiV2010SipCredentialListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipCredentialListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipCredentialListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSipCredentialListMapping' type ListSipCredentialListMappingParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) *ListSipCredentialListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipCredentialListMappingParams) SetPathAccountSid(PathAccountSid string) (*ListSipCredentialListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipCredentialListMappingParams) SetPageSize(PageSize int) *ListSipCredentialListMappingParams { - params.PageSize = &PageSize - return params +func (params *ListSipCredentialListMappingParams) SetPageSize(PageSize int) (*ListSipCredentialListMappingParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipCredentialListMappingParams) SetLimit(Limit int) *ListSipCredentialListMappingParams { - params.Limit = &Limit - return params +func (params *ListSipCredentialListMappingParams) SetLimit(Limit int) (*ListSipCredentialListMappingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipCredentialListMapping records from the API. Request is executed immediately. -func (c *ApiService) PageSipCredentialListMapping(DomainSid string, params *ListSipCredentialListMappingParams, pageToken, pageNumber string) (*ListSipCredentialListMappingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings.json" +func (c *ApiService) PageSipCredentialListMapping(DomainSid string, params *ListSipCredentialListMappingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/CredentialListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipCredentialListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipCredentialListMapping records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipCredentialListMapping(DomainSid string, params *ListSipCredentialListMappingParams) ([]ApiV2010SipCredentialListMapping, error) { +func (c *ApiService) ListSipCredentialListMapping(DomainSid string, params *ListSipCredentialListMappingParams) (ListSipCredentialListMapping200Response, error) { response, errors := c.StreamSipCredentialListMapping(DomainSid, params) - records := make([]ApiV2010SipCredentialListMapping, 0) + records := make(ListSipCredentialListMapping200Response, 0) for record := range response { records = append(records, record) } @@ -227,13 +232,13 @@ func (c *ApiService) ListSipCredentialListMapping(DomainSid string, params *List } // Streams SipCredentialListMapping records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipCredentialListMapping(DomainSid string, params *ListSipCredentialListMappingParams) (chan ApiV2010SipCredentialListMapping, chan error) { +func (c *ApiService) StreamSipCredentialListMapping(DomainSid string, params *ListSipCredentialListMappingParams) (chan ListSipCredentialListMapping200Response, chan error) { if params == nil { params = &ListSipCredentialListMappingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipCredentialListMapping, 1) + recordChannel := make(chan ListSipCredentialListMapping200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipCredentialListMapping(DomainSid, params, "", "") @@ -248,11 +253,12 @@ func (c *ApiService) StreamSipCredentialListMapping(DomainSid string, params *Li return recordChannel, errorChannel } -func (c *ApiService) streamSipCredentialListMapping(response *ListSipCredentialListMappingResponse, params *ListSipCredentialListMappingParams, recordChannel chan ApiV2010SipCredentialListMapping, errorChannel chan error) { + +func (c *ApiService) streamSipCredentialListMapping(response *, params *ListSipCredentialListMappingParams, recordChannel chan ListSipCredentialListMapping200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.CredentialListMappings + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -263,7 +269,7 @@ func (c *ApiService) streamSipCredentialListMapping(response *ListSipCredentialL } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipCredentialListMappingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -271,27 +277,28 @@ func (c *ApiService) streamSipCredentialListMapping(response *ListSipCredentialL break } - response = record.(*ListSipCredentialListMappingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipCredentialListMappingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipCredentialListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_sip_domains_ip_access_control_list_mappings.go b/rest/api/v2010/accounts_sip_domains_ip_access_control_list_mappings.go index e42334eb7..d3f4d2fe4 100644 --- a/rest/api/v2010/accounts_sip_domains_ip_access_control_list_mappings.go +++ b/rest/api/v2010/accounts_sip_domains_ip_access_control_list_mappings.go @@ -18,203 +18,208 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipIpAccessControlListMapping' type CreateSipIpAccessControlListMappingParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The unique id of the IP access control list to map to the SIP domain. - IpAccessControlListSid *string `json:"IpAccessControlListSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the IP access control list to map to the SIP domain. + IpAccessControlListSid *string `json:"IpAccessControlListSid,omitempty"` } -func (params *CreateSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *CreateSipIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*CreateSipIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipIpAccessControlListMappingParams) SetIpAccessControlListSid(IpAccessControlListSid string) *CreateSipIpAccessControlListMappingParams { - params.IpAccessControlListSid = &IpAccessControlListSid - return params +func (params *CreateSipIpAccessControlListMappingParams) SetIpAccessControlListSid(IpAccessControlListSid string) (*CreateSipIpAccessControlListMappingParams){ + params.IpAccessControlListSid = &IpAccessControlListSid + return params } // Create a new IpAccessControlListMapping resource. func (c *ApiService) CreateSipIpAccessControlListMapping(DomainSid string, params *CreateSipIpAccessControlListMappingParams) (*ApiV2010SipIpAccessControlListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IpAccessControlListSid != nil { - data.Set("IpAccessControlListSid", *params.IpAccessControlListSid) - } + if params != nil && params.IpAccessControlListSid != nil { + data.Set("IpAccessControlListSid", *params.IpAccessControlListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipIpAccessControlListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipIpAccessControlListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipIpAccessControlListMapping' type DeleteSipIpAccessControlListMappingParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *DeleteSipIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete an IpAccessControlListMapping resource. -func (c *ApiService) DeleteSipIpAccessControlListMapping(DomainSid string, Sid string, params *DeleteSipIpAccessControlListMappingParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipIpAccessControlListMapping(DomainSid string, Sid string, params *DeleteSipIpAccessControlListMappingParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipIpAccessControlListMapping' type FetchSipIpAccessControlListMappingParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *FetchSipIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*FetchSipIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an IpAccessControlListMapping resource. func (c *ApiService) FetchSipIpAccessControlListMapping(DomainSid string, Sid string, params *FetchSipIpAccessControlListMappingParams) (*ApiV2010SipIpAccessControlListMapping, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipIpAccessControlListMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010SipIpAccessControlListMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSipIpAccessControlListMapping' type ListSipIpAccessControlListMappingParams struct { - // The unique id of the Account that is responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique id of the Account that is responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) *ListSipIpAccessControlListMappingParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipIpAccessControlListMappingParams) SetPathAccountSid(PathAccountSid string) (*ListSipIpAccessControlListMappingParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipIpAccessControlListMappingParams) SetPageSize(PageSize int) *ListSipIpAccessControlListMappingParams { - params.PageSize = &PageSize - return params +func (params *ListSipIpAccessControlListMappingParams) SetPageSize(PageSize int) (*ListSipIpAccessControlListMappingParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipIpAccessControlListMappingParams) SetLimit(Limit int) *ListSipIpAccessControlListMappingParams { - params.Limit = &Limit - return params +func (params *ListSipIpAccessControlListMappingParams) SetLimit(Limit int) (*ListSipIpAccessControlListMappingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipIpAccessControlListMapping records from the API. Request is executed immediately. -func (c *ApiService) PageSipIpAccessControlListMapping(DomainSid string, params *ListSipIpAccessControlListMappingParams, pageToken, pageNumber string) (*ListSipIpAccessControlListMappingResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings.json" +func (c *ApiService) PageSipIpAccessControlListMapping(DomainSid string, params *ListSipIpAccessControlListMappingParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/Domains/{DomainSid}/IpAccessControlListMappings.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipIpAccessControlListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipIpAccessControlListMapping records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipIpAccessControlListMapping(DomainSid string, params *ListSipIpAccessControlListMappingParams) ([]ApiV2010SipIpAccessControlListMapping, error) { +func (c *ApiService) ListSipIpAccessControlListMapping(DomainSid string, params *ListSipIpAccessControlListMappingParams) (ListSipIpAccessControlListMapping200Response, error) { response, errors := c.StreamSipIpAccessControlListMapping(DomainSid, params) - records := make([]ApiV2010SipIpAccessControlListMapping, 0) + records := make(ListSipIpAccessControlListMapping200Response, 0) for record := range response { records = append(records, record) } @@ -227,13 +232,13 @@ func (c *ApiService) ListSipIpAccessControlListMapping(DomainSid string, params } // Streams SipIpAccessControlListMapping records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipIpAccessControlListMapping(DomainSid string, params *ListSipIpAccessControlListMappingParams) (chan ApiV2010SipIpAccessControlListMapping, chan error) { +func (c *ApiService) StreamSipIpAccessControlListMapping(DomainSid string, params *ListSipIpAccessControlListMappingParams) (chan ListSipIpAccessControlListMapping200Response, chan error) { if params == nil { params = &ListSipIpAccessControlListMappingParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipIpAccessControlListMapping, 1) + recordChannel := make(chan ListSipIpAccessControlListMapping200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipIpAccessControlListMapping(DomainSid, params, "", "") @@ -248,11 +253,12 @@ func (c *ApiService) StreamSipIpAccessControlListMapping(DomainSid string, param return recordChannel, errorChannel } -func (c *ApiService) streamSipIpAccessControlListMapping(response *ListSipIpAccessControlListMappingResponse, params *ListSipIpAccessControlListMappingParams, recordChannel chan ApiV2010SipIpAccessControlListMapping, errorChannel chan error) { + +func (c *ApiService) streamSipIpAccessControlListMapping(response *, params *ListSipIpAccessControlListMappingParams, recordChannel chan ListSipIpAccessControlListMapping200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IpAccessControlListMappings + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -263,7 +269,7 @@ func (c *ApiService) streamSipIpAccessControlListMapping(response *ListSipIpAcce } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipIpAccessControlListMappingResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -271,27 +277,28 @@ func (c *ApiService) streamSipIpAccessControlListMapping(response *ListSipIpAcce break } - response = record.(*ListSipIpAccessControlListMappingResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipIpAccessControlListMappingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipIpAccessControlListMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_sipip_access_control_lists.go b/rest/api/v2010/accounts_sipip_access_control_lists.go index 390bcfa25..4f60c5ec0 100644 --- a/rest/api/v2010/accounts_sipip_access_control_lists.go +++ b/rest/api/v2010/accounts_sipip_access_control_lists.go @@ -18,199 +18,204 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipIpAccessControlList' type CreateSipIpAccessControlListParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A human readable descriptive text that describes the IpAccessControlList, up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A human readable descriptive text that describes the IpAccessControlList, up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) *CreateSipIpAccessControlListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) (*CreateSipIpAccessControlListParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipIpAccessControlListParams) SetFriendlyName(FriendlyName string) *CreateSipIpAccessControlListParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateSipIpAccessControlListParams) SetFriendlyName(FriendlyName string) (*CreateSipIpAccessControlListParams){ + params.FriendlyName = &FriendlyName + return params } // Create a new IpAccessControlList resource func (c *ApiService) CreateSipIpAccessControlList(params *CreateSipIpAccessControlListParams) (*ApiV2010SipIpAccessControlList, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipIpAccessControlList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipIpAccessControlList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipIpAccessControlList' type DeleteSipIpAccessControlListParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) *DeleteSipIpAccessControlListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipIpAccessControlListParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete an IpAccessControlList from the requested account -func (c *ApiService) DeleteSipIpAccessControlList(Sid string, params *DeleteSipIpAccessControlListParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipIpAccessControlList(Sid string, params *DeleteSipIpAccessControlListParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipIpAccessControlList' type FetchSipIpAccessControlListParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) *FetchSipIpAccessControlListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) (*FetchSipIpAccessControlListParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch a specific instance of an IpAccessControlList func (c *ApiService) FetchSipIpAccessControlList(Sid string, params *FetchSipIpAccessControlListParams) (*ApiV2010SipIpAccessControlList, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipIpAccessControlList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipIpAccessControlList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSipIpAccessControlList' type ListSipIpAccessControlListParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) *ListSipIpAccessControlListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) (*ListSipIpAccessControlListParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipIpAccessControlListParams) SetPageSize(PageSize int) *ListSipIpAccessControlListParams { - params.PageSize = &PageSize - return params +func (params *ListSipIpAccessControlListParams) SetPageSize(PageSize int) (*ListSipIpAccessControlListParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipIpAccessControlListParams) SetLimit(Limit int) *ListSipIpAccessControlListParams { - params.Limit = &Limit - return params +func (params *ListSipIpAccessControlListParams) SetLimit(Limit int) (*ListSipIpAccessControlListParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipIpAccessControlList records from the API. Request is executed immediately. -func (c *ApiService) PageSipIpAccessControlList(params *ListSipIpAccessControlListParams, pageToken, pageNumber string) (*ListSipIpAccessControlListResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists.json" +func (c *ApiService) PageSipIpAccessControlList(params *ListSipIpAccessControlListParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipIpAccessControlListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipIpAccessControlList records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipIpAccessControlList(params *ListSipIpAccessControlListParams) ([]ApiV2010SipIpAccessControlList, error) { +func (c *ApiService) ListSipIpAccessControlList(params *ListSipIpAccessControlListParams) (ListSipIpAccessControlList200Response, error) { response, errors := c.StreamSipIpAccessControlList(params) - records := make([]ApiV2010SipIpAccessControlList, 0) + records := make(ListSipIpAccessControlList200Response, 0) for record := range response { records = append(records, record) } @@ -223,13 +228,13 @@ func (c *ApiService) ListSipIpAccessControlList(params *ListSipIpAccessControlLi } // Streams SipIpAccessControlList records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipIpAccessControlList(params *ListSipIpAccessControlListParams) (chan ApiV2010SipIpAccessControlList, chan error) { +func (c *ApiService) StreamSipIpAccessControlList(params *ListSipIpAccessControlListParams) (chan ListSipIpAccessControlList200Response, chan error) { if params == nil { params = &ListSipIpAccessControlListParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipIpAccessControlList, 1) + recordChannel := make(chan ListSipIpAccessControlList200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipIpAccessControlList(params, "", "") @@ -244,11 +249,12 @@ func (c *ApiService) StreamSipIpAccessControlList(params *ListSipIpAccessControl return recordChannel, errorChannel } -func (c *ApiService) streamSipIpAccessControlList(response *ListSipIpAccessControlListResponse, params *ListSipIpAccessControlListParams, recordChannel chan ApiV2010SipIpAccessControlList, errorChannel chan error) { + +func (c *ApiService) streamSipIpAccessControlList(response *, params *ListSipIpAccessControlListParams, recordChannel chan ListSipIpAccessControlList200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IpAccessControlLists + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -259,7 +265,7 @@ func (c *ApiService) streamSipIpAccessControlList(response *ListSipIpAccessContr } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipIpAccessControlListResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -267,76 +273,78 @@ func (c *ApiService) streamSipIpAccessControlList(response *ListSipIpAccessContr break } - response = record.(*ListSipIpAccessControlListResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipIpAccessControlListResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipIpAccessControlListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSipIpAccessControlList' type UpdateSipIpAccessControlListParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A human readable descriptive text, up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A human readable descriptive text, up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) *UpdateSipIpAccessControlListParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateSipIpAccessControlListParams) SetPathAccountSid(PathAccountSid string) (*UpdateSipIpAccessControlListParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateSipIpAccessControlListParams) SetFriendlyName(FriendlyName string) *UpdateSipIpAccessControlListParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSipIpAccessControlListParams) SetFriendlyName(FriendlyName string) (*UpdateSipIpAccessControlListParams){ + params.FriendlyName = &FriendlyName + return params } // Rename an IpAccessControlList func (c *ApiService) UpdateSipIpAccessControlList(Sid string, params *UpdateSipIpAccessControlListParams) (*ApiV2010SipIpAccessControlList, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipIpAccessControlList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010SipIpAccessControlList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_sipip_access_control_lists_ip_addresses.go b/rest/api/v2010/accounts_sipip_access_control_lists_ip_addresses.go index 0d92df5e6..caa874b6b 100644 --- a/rest/api/v2010/accounts_sipip_access_control_lists_ip_addresses.go +++ b/rest/api/v2010/accounts_sipip_access_control_lists_ip_addresses.go @@ -18,221 +18,226 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSipIpAddress' type CreateSipIpAddressParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A human readable descriptive text for this resource, up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - IpAddress *string `json:"IpAddress,omitempty"` - // An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. - CidrPrefixLength *int `json:"CidrPrefixLength,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A human readable descriptive text for this resource, up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. + IpAddress *string `json:"IpAddress,omitempty"` + // An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. + CidrPrefixLength *int `json:"CidrPrefixLength,omitempty"` } -func (params *CreateSipIpAddressParams) SetPathAccountSid(PathAccountSid string) *CreateSipIpAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateSipIpAddressParams) SetPathAccountSid(PathAccountSid string) (*CreateSipIpAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateSipIpAddressParams) SetFriendlyName(FriendlyName string) *CreateSipIpAddressParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateSipIpAddressParams) SetFriendlyName(FriendlyName string) (*CreateSipIpAddressParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateSipIpAddressParams) SetIpAddress(IpAddress string) *CreateSipIpAddressParams { - params.IpAddress = &IpAddress - return params +func (params *CreateSipIpAddressParams) SetIpAddress(IpAddress string) (*CreateSipIpAddressParams){ + params.IpAddress = &IpAddress + return params } -func (params *CreateSipIpAddressParams) SetCidrPrefixLength(CidrPrefixLength int) *CreateSipIpAddressParams { - params.CidrPrefixLength = &CidrPrefixLength - return params +func (params *CreateSipIpAddressParams) SetCidrPrefixLength(CidrPrefixLength int) (*CreateSipIpAddressParams){ + params.CidrPrefixLength = &CidrPrefixLength + return params } // Create a new IpAddress resource. func (c *ApiService) CreateSipIpAddress(IpAccessControlListSid string, params *CreateSipIpAddressParams) (*ApiV2010SipIpAddress, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.IpAddress != nil { - data.Set("IpAddress", *params.IpAddress) - } - if params != nil && params.CidrPrefixLength != nil { - data.Set("CidrPrefixLength", fmt.Sprint(*params.CidrPrefixLength)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.IpAddress != nil { + data.Set("IpAddress", *params.IpAddress) + } + if params != nil && params.CidrPrefixLength != nil { + data.Set("CidrPrefixLength", fmt.Sprint(*params.CidrPrefixLength)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipIpAddress{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ApiV2010SipIpAddress{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSipIpAddress' type DeleteSipIpAddressParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteSipIpAddressParams) SetPathAccountSid(PathAccountSid string) *DeleteSipIpAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteSipIpAddressParams) SetPathAccountSid(PathAccountSid string) (*DeleteSipIpAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete an IpAddress resource. -func (c *ApiService) DeleteSipIpAddress(IpAccessControlListSid string, Sid string, params *DeleteSipIpAddressParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSipIpAddress(IpAccessControlListSid string, Sid string, params *DeleteSipIpAddressParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchSipIpAddress' type FetchSipIpAddressParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchSipIpAddressParams) SetPathAccountSid(PathAccountSid string) *FetchSipIpAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchSipIpAddressParams) SetPathAccountSid(PathAccountSid string) (*FetchSipIpAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } // Read one IpAddress resource. func (c *ApiService) FetchSipIpAddress(IpAccessControlListSid string, Sid string, params *FetchSipIpAddressParams) (*ApiV2010SipIpAddress, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010SipIpAddress{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ApiV2010SipIpAddress{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSipIpAddress' type ListSipIpAddressParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSipIpAddressParams) SetPathAccountSid(PathAccountSid string) *ListSipIpAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListSipIpAddressParams) SetPathAccountSid(PathAccountSid string) (*ListSipIpAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListSipIpAddressParams) SetPageSize(PageSize int) *ListSipIpAddressParams { - params.PageSize = &PageSize - return params +func (params *ListSipIpAddressParams) SetPageSize(PageSize int) (*ListSipIpAddressParams){ + params.PageSize = &PageSize + return params } -func (params *ListSipIpAddressParams) SetLimit(Limit int) *ListSipIpAddressParams { - params.Limit = &Limit - return params +func (params *ListSipIpAddressParams) SetLimit(Limit int) (*ListSipIpAddressParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SipIpAddress records from the API. Request is executed immediately. -func (c *ApiService) PageSipIpAddress(IpAccessControlListSid string, params *ListSipIpAddressParams, pageToken, pageNumber string) (*ListSipIpAddressResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses.json" +func (c *ApiService) PageSipIpAddress(IpAccessControlListSid string, params *ListSipIpAddressParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSipIpAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SipIpAddress records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListSipIpAddress(IpAccessControlListSid string, params *ListSipIpAddressParams) ([]ApiV2010SipIpAddress, error) { +func (c *ApiService) ListSipIpAddress(IpAccessControlListSid string, params *ListSipIpAddressParams) (ListSipIpAddress200Response, error) { response, errors := c.StreamSipIpAddress(IpAccessControlListSid, params) - records := make([]ApiV2010SipIpAddress, 0) + records := make(ListSipIpAddress200Response, 0) for record := range response { records = append(records, record) } @@ -245,13 +250,13 @@ func (c *ApiService) ListSipIpAddress(IpAccessControlListSid string, params *Lis } // Streams SipIpAddress records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamSipIpAddress(IpAccessControlListSid string, params *ListSipIpAddressParams) (chan ApiV2010SipIpAddress, chan error) { +func (c *ApiService) StreamSipIpAddress(IpAccessControlListSid string, params *ListSipIpAddressParams) (chan ListSipIpAddress200Response, chan error) { if params == nil { params = &ListSipIpAddressParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010SipIpAddress, 1) + recordChannel := make(chan ListSipIpAddress200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageSipIpAddress(IpAccessControlListSid, params, "", "") @@ -266,11 +271,12 @@ func (c *ApiService) StreamSipIpAddress(IpAccessControlListSid string, params *L return recordChannel, errorChannel } -func (c *ApiService) streamSipIpAddress(response *ListSipIpAddressResponse, params *ListSipIpAddressParams, recordChannel chan ApiV2010SipIpAddress, errorChannel chan error) { + +func (c *ApiService) streamSipIpAddress(response *, params *ListSipIpAddressParams, recordChannel chan ListSipIpAddress200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.IpAddresses + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -281,7 +287,7 @@ func (c *ApiService) streamSipIpAddress(response *ListSipIpAddressResponse, para } } - record, err := client.GetNext(c.baseURL, response, c.getNextListSipIpAddressResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -289,95 +295,97 @@ func (c *ApiService) streamSipIpAddress(response *ListSipIpAddressResponse, para break } - response = record.(*ListSipIpAddressResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListSipIpAddressResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSipIpAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSipIpAddress' type UpdateSipIpAddressParams struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - IpAddress *string `json:"IpAddress,omitempty"` - // A human readable descriptive text for this resource, up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. - CidrPrefixLength *int `json:"CidrPrefixLength,omitempty"` + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. + IpAddress *string `json:"IpAddress,omitempty"` + // A human readable descriptive text for this resource, up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. + CidrPrefixLength *int `json:"CidrPrefixLength,omitempty"` } -func (params *UpdateSipIpAddressParams) SetPathAccountSid(PathAccountSid string) *UpdateSipIpAddressParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateSipIpAddressParams) SetPathAccountSid(PathAccountSid string) (*UpdateSipIpAddressParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateSipIpAddressParams) SetIpAddress(IpAddress string) *UpdateSipIpAddressParams { - params.IpAddress = &IpAddress - return params +func (params *UpdateSipIpAddressParams) SetIpAddress(IpAddress string) (*UpdateSipIpAddressParams){ + params.IpAddress = &IpAddress + return params } -func (params *UpdateSipIpAddressParams) SetFriendlyName(FriendlyName string) *UpdateSipIpAddressParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSipIpAddressParams) SetFriendlyName(FriendlyName string) (*UpdateSipIpAddressParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateSipIpAddressParams) SetCidrPrefixLength(CidrPrefixLength int) *UpdateSipIpAddressParams { - params.CidrPrefixLength = &CidrPrefixLength - return params +func (params *UpdateSipIpAddressParams) SetCidrPrefixLength(CidrPrefixLength int) (*UpdateSipIpAddressParams){ + params.CidrPrefixLength = &CidrPrefixLength + return params } // Update an IpAddress resource. func (c *ApiService) UpdateSipIpAddress(IpAccessControlListSid string, Sid string, params *UpdateSipIpAddressParams) (*ApiV2010SipIpAddress, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SIP/IpAccessControlLists/{IpAccessControlListSid}/IpAddresses/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"IpAccessControlListSid"+"}", IpAccessControlListSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IpAddress != nil { - data.Set("IpAddress", *params.IpAddress) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CidrPrefixLength != nil { - data.Set("CidrPrefixLength", fmt.Sprint(*params.CidrPrefixLength)) - } + if params != nil && params.IpAddress != nil { + data.Set("IpAddress", *params.IpAddress) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CidrPrefixLength != nil { + data.Set("CidrPrefixLength", fmt.Sprint(*params.CidrPrefixLength)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010SipIpAddress{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010SipIpAddress{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_sms_short_codes.go b/rest/api/v2010/accounts_sms_short_codes.go index efac7d190..9ba5d2e8c 100644 --- a/rest/api/v2010/accounts_sms_short_codes.go +++ b/rest/api/v2010/accounts_sms_short_codes.go @@ -18,135 +18,137 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchShortCode' type FetchShortCodeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource(s) to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource(s) to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchShortCodeParams) SetPathAccountSid(PathAccountSid string) *FetchShortCodeParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchShortCodeParams) SetPathAccountSid(PathAccountSid string) (*FetchShortCodeParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a short code func (c *ApiService) FetchShortCode(Sid string, params *FetchShortCodeParams) (*ApiV2010ShortCode, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ApiV2010ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListShortCode' type ListShortCodeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource(s) to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The string that identifies the ShortCode resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit. - ShortCode *string `json:"ShortCode,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource(s) to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The string that identifies the ShortCode resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit. + ShortCode *string `json:"ShortCode,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListShortCodeParams) SetPathAccountSid(PathAccountSid string) *ListShortCodeParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListShortCodeParams) SetPathAccountSid(PathAccountSid string) (*ListShortCodeParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListShortCodeParams) SetFriendlyName(FriendlyName string) *ListShortCodeParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListShortCodeParams) SetFriendlyName(FriendlyName string) (*ListShortCodeParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListShortCodeParams) SetShortCode(ShortCode string) *ListShortCodeParams { - params.ShortCode = &ShortCode - return params +func (params *ListShortCodeParams) SetShortCode(ShortCode string) (*ListShortCodeParams){ + params.ShortCode = &ShortCode + return params } -func (params *ListShortCodeParams) SetPageSize(PageSize int) *ListShortCodeParams { - params.PageSize = &PageSize - return params +func (params *ListShortCodeParams) SetPageSize(PageSize int) (*ListShortCodeParams){ + params.PageSize = &PageSize + return params } -func (params *ListShortCodeParams) SetLimit(Limit int) *ListShortCodeParams { - params.Limit = &Limit - return params +func (params *ListShortCodeParams) SetLimit(Limit int) (*ListShortCodeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ShortCode records from the API. Request is executed immediately. -func (c *ApiService) PageShortCode(params *ListShortCodeParams, pageToken, pageNumber string) (*ListShortCodeResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) +func (c *ApiService) PageShortCode(params *ListShortCodeParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes.json" - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ShortCode != nil { - data.Set("ShortCode", *params.ShortCode) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListShortCodeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ShortCode != nil { + data.Set("ShortCode", *params.ShortCode) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists ShortCode records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListShortCode(params *ListShortCodeParams) ([]ApiV2010ShortCode, error) { +func (c *ApiService) ListShortCode(params *ListShortCodeParams) (ListShortCode200Response, error) { response, errors := c.StreamShortCode(params) - records := make([]ApiV2010ShortCode, 0) + records := make(ListShortCode200Response, 0) for record := range response { records = append(records, record) } @@ -159,13 +161,13 @@ func (c *ApiService) ListShortCode(params *ListShortCodeParams) ([]ApiV2010Short } // Streams ShortCode records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamShortCode(params *ListShortCodeParams) (chan ApiV2010ShortCode, chan error) { +func (c *ApiService) StreamShortCode(params *ListShortCodeParams) (chan ListShortCode200Response, chan error) { if params == nil { params = &ListShortCodeParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010ShortCode, 1) + recordChannel := make(chan ListShortCode200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageShortCode(params, "", "") @@ -180,11 +182,12 @@ func (c *ApiService) StreamShortCode(params *ListShortCodeParams) (chan ApiV2010 return recordChannel, errorChannel } -func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *ListShortCodeParams, recordChannel chan ApiV2010ShortCode, errorChannel chan error) { + +func (c *ApiService) streamShortCode(response *, params *ListShortCodeParams, recordChannel chan ListShortCode200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.ShortCodes + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -195,7 +198,7 @@ func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *Li } } - record, err := client.GetNext(c.baseURL, response, c.getNextListShortCodeResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -203,121 +206,123 @@ func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *Li break } - response = record.(*ListShortCodeResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListShortCodeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListShortCodeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateShortCode' type UpdateShortCodeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource(s) to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // A descriptive string that you created to describe this resource. It can be up to 64 characters long. By default, the `FriendlyName` is the short code. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. - ApiVersion *string `json:"ApiVersion,omitempty"` - // The URL we should call when receiving an incoming SMS message to this short code. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The HTTP method we should use when calling the `sms_url`. Can be: `GET` or `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL that we should call if an error occurs while retrieving or executing the TwiML from `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method that we should use to call the `sms_fallback_url`. Can be: `GET` or `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource(s) to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // A descriptive string that you created to describe this resource. It can be up to 64 characters long. By default, the `FriendlyName` is the short code. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. + ApiVersion *string `json:"ApiVersion,omitempty"` + // The URL we should call when receiving an incoming SMS message to this short code. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The HTTP method we should use when calling the `sms_url`. Can be: `GET` or `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL that we should call if an error occurs while retrieving or executing the TwiML from `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method that we should use to call the `sms_fallback_url`. Can be: `GET` or `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` } -func (params *UpdateShortCodeParams) SetPathAccountSid(PathAccountSid string) *UpdateShortCodeParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateShortCodeParams) SetPathAccountSid(PathAccountSid string) (*UpdateShortCodeParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateShortCodeParams) SetFriendlyName(FriendlyName string) *UpdateShortCodeParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateShortCodeParams) SetFriendlyName(FriendlyName string) (*UpdateShortCodeParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateShortCodeParams) SetApiVersion(ApiVersion string) *UpdateShortCodeParams { - params.ApiVersion = &ApiVersion - return params +func (params *UpdateShortCodeParams) SetApiVersion(ApiVersion string) (*UpdateShortCodeParams){ + params.ApiVersion = &ApiVersion + return params } -func (params *UpdateShortCodeParams) SetSmsUrl(SmsUrl string) *UpdateShortCodeParams { - params.SmsUrl = &SmsUrl - return params +func (params *UpdateShortCodeParams) SetSmsUrl(SmsUrl string) (*UpdateShortCodeParams){ + params.SmsUrl = &SmsUrl + return params } -func (params *UpdateShortCodeParams) SetSmsMethod(SmsMethod string) *UpdateShortCodeParams { - params.SmsMethod = &SmsMethod - return params +func (params *UpdateShortCodeParams) SetSmsMethod(SmsMethod string) (*UpdateShortCodeParams){ + params.SmsMethod = &SmsMethod + return params } -func (params *UpdateShortCodeParams) SetSmsFallbackUrl(SmsFallbackUrl string) *UpdateShortCodeParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params +func (params *UpdateShortCodeParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*UpdateShortCodeParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params } -func (params *UpdateShortCodeParams) SetSmsFallbackMethod(SmsFallbackMethod string) *UpdateShortCodeParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params +func (params *UpdateShortCodeParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*UpdateShortCodeParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params } // Update a short code with the following parameters func (c *ApiService) UpdateShortCode(Sid string, params *UpdateShortCodeParams) (*ApiV2010ShortCode, error) { - path := "/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ApiVersion != nil { - data.Set("ApiVersion", *params.ApiVersion) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ApiVersion != nil { + data.Set("ApiVersion", *params.ApiVersion) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/api/v2010/accounts_tokens.go b/rest/api/v2010/accounts_tokens.go index 1784876d1..712201927 100644 --- a/rest/api/v2010/accounts_tokens.go +++ b/rest/api/v2010/accounts_tokens.go @@ -18,53 +18,56 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateToken' type CreateTokenParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The duration in seconds for which the generated credentials are valid. The default value is 86400 (24 hours). - Ttl *int `json:"Ttl,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The duration in seconds for which the generated credentials are valid. The default value is 86400 (24 hours). + Ttl *int `json:"Ttl,omitempty"` } -func (params *CreateTokenParams) SetPathAccountSid(PathAccountSid string) *CreateTokenParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *CreateTokenParams) SetPathAccountSid(PathAccountSid string) (*CreateTokenParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *CreateTokenParams) SetTtl(Ttl int) *CreateTokenParams { - params.Ttl = &Ttl - return params +func (params *CreateTokenParams) SetTtl(Ttl int) (*CreateTokenParams){ + params.Ttl = &Ttl + return params } // Create a new token for ICE servers func (c *ApiService) CreateToken(params *CreateTokenParams) (*ApiV2010Token, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Tokens.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + path := "/2010-04-01/Accounts/{AccountSid}/Tokens.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ApiV2010Token{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ApiV2010Token{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/accounts_transcriptions.go b/rest/api/v2010/accounts_transcriptions.go index c62183a14..7910f1ea4 100644 --- a/rest/api/v2010/accounts_transcriptions.go +++ b/rest/api/v2010/accounts_transcriptions.go @@ -18,151 +18,155 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteTranscription' type DeleteTranscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteTranscriptionParams) SetPathAccountSid(PathAccountSid string) *DeleteTranscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteTranscriptionParams) SetPathAccountSid(PathAccountSid string) (*DeleteTranscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } // Delete a transcription from the account used to make the request -func (c *ApiService) DeleteTranscription(Sid string, params *DeleteTranscriptionParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteTranscription(Sid string, params *DeleteTranscriptionParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchTranscription' type FetchTranscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchTranscriptionParams) SetPathAccountSid(PathAccountSid string) *FetchTranscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchTranscriptionParams) SetPathAccountSid(PathAccountSid string) (*FetchTranscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch an instance of a Transcription func (c *ApiService) FetchTranscription(Sid string, params *FetchTranscriptionParams) (*ApiV2010Transcription, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Transcriptions/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010Transcription{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010Transcription{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTranscription' type ListTranscriptionParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTranscriptionParams) SetPathAccountSid(PathAccountSid string) *ListTranscriptionParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListTranscriptionParams) SetPathAccountSid(PathAccountSid string) (*ListTranscriptionParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListTranscriptionParams) SetPageSize(PageSize int) *ListTranscriptionParams { - params.PageSize = &PageSize - return params +func (params *ListTranscriptionParams) SetPageSize(PageSize int) (*ListTranscriptionParams){ + params.PageSize = &PageSize + return params } -func (params *ListTranscriptionParams) SetLimit(Limit int) *ListTranscriptionParams { - params.Limit = &Limit - return params +func (params *ListTranscriptionParams) SetLimit(Limit int) (*ListTranscriptionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Transcription records from the API. Request is executed immediately. -func (c *ApiService) PageTranscription(params *ListTranscriptionParams, pageToken, pageNumber string) (*ListTranscriptionResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Transcriptions.json" +func (c *ApiService) PageTranscription(params *ListTranscriptionParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Transcriptions.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTranscriptionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Transcription records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListTranscription(params *ListTranscriptionParams) ([]ApiV2010Transcription, error) { +func (c *ApiService) ListTranscription(params *ListTranscriptionParams) (ListTranscription200Response, error) { response, errors := c.StreamTranscription(params) - records := make([]ApiV2010Transcription, 0) + records := make(ListTranscription200Response, 0) for record := range response { records = append(records, record) } @@ -175,13 +179,13 @@ func (c *ApiService) ListTranscription(params *ListTranscriptionParams) ([]ApiV2 } // Streams Transcription records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamTranscription(params *ListTranscriptionParams) (chan ApiV2010Transcription, chan error) { +func (c *ApiService) StreamTranscription(params *ListTranscriptionParams) (chan ListTranscription200Response, chan error) { if params == nil { params = &ListTranscriptionParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010Transcription, 1) + recordChannel := make(chan ListTranscription200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageTranscription(params, "", "") @@ -196,11 +200,12 @@ func (c *ApiService) StreamTranscription(params *ListTranscriptionParams) (chan return recordChannel, errorChannel } -func (c *ApiService) streamTranscription(response *ListTranscriptionResponse, params *ListTranscriptionParams, recordChannel chan ApiV2010Transcription, errorChannel chan error) { + +func (c *ApiService) streamTranscription(response *, params *ListTranscriptionParams, recordChannel chan ListTranscription200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.Transcriptions + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -211,7 +216,7 @@ func (c *ApiService) streamTranscription(response *ListTranscriptionResponse, pa } } - record, err := client.GetNext(c.baseURL, response, c.getNextListTranscriptionResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -219,27 +224,28 @@ func (c *ApiService) streamTranscription(response *ListTranscriptionResponse, pa break } - response = record.(*ListTranscriptionResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListTranscriptionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTranscriptionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records.go b/rest/api/v2010/accounts_usage_records.go index d5ed51a3d..c585da68d 100644 --- a/rest/api/v2010/accounts_usage_records.go +++ b/rest/api/v2010/accounts_usage_records.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecord' type ListUsageRecordParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordParams) SetCategory(Category string) *ListUsageRecordParams { - params.Category = &Category - return params +func (params *ListUsageRecordParams) SetCategory(Category string) (*ListUsageRecordParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordParams) SetStartDate(StartDate string) *ListUsageRecordParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordParams) SetStartDate(StartDate string) (*ListUsageRecordParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordParams) SetEndDate(EndDate string) *ListUsageRecordParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordParams) SetEndDate(EndDate string) (*ListUsageRecordParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordParams) SetPageSize(PageSize int) *ListUsageRecordParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordParams) SetPageSize(PageSize int) (*ListUsageRecordParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordParams) SetLimit(Limit int) *ListUsageRecordParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordParams) SetLimit(Limit int) (*ListUsageRecordParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecord records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecord(params *ListUsageRecordParams, pageToken, pageNumber string) (*ListUsageRecordResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecord(params *ListUsageRecordParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records.json" - defer resp.Body.Close() - - ps := &ListUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecord records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecord(params *ListUsageRecordParams) ([]ApiV2010UsageRecord, error) { +func (c *ApiService) ListUsageRecord(params *ListUsageRecordParams) (ListUsageRecord200Response, error) { response, errors := c.StreamUsageRecord(params) - records := make([]ApiV2010UsageRecord, 0) + records := make(ListUsageRecord200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecord(params *ListUsageRecordParams) ([]ApiV2010U } // Streams UsageRecord records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecord(params *ListUsageRecordParams) (chan ApiV2010UsageRecord, chan error) { +func (c *ApiService) StreamUsageRecord(params *ListUsageRecordParams) (chan ListUsageRecord200Response, chan error) { if params == nil { params = &ListUsageRecordParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecord, 1) + recordChannel := make(chan ListUsageRecord200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecord(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecord(params *ListUsageRecordParams) (chan ApiV return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params *ListUsageRecordParams, recordChannel chan ApiV2010UsageRecord, errorChannel chan error) { + +func (c *ApiService) streamUsageRecord(response *, params *ListUsageRecordParams, recordChannel chan ListUsageRecord200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params break } - response = record.(*ListUsageRecordResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_all_time.go b/rest/api/v2010/accounts_usage_records_all_time.go index 2719f2426..3e8e7c63b 100644 --- a/rest/api/v2010/accounts_usage_records_all_time.go +++ b/rest/api/v2010/accounts_usage_records_all_time.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordAllTime' type ListUsageRecordAllTimeParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordAllTimeParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordAllTimeParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordAllTimeParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordAllTimeParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordAllTimeParams) SetCategory(Category string) *ListUsageRecordAllTimeParams { - params.Category = &Category - return params +func (params *ListUsageRecordAllTimeParams) SetCategory(Category string) (*ListUsageRecordAllTimeParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordAllTimeParams) SetStartDate(StartDate string) *ListUsageRecordAllTimeParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordAllTimeParams) SetStartDate(StartDate string) (*ListUsageRecordAllTimeParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordAllTimeParams) SetEndDate(EndDate string) *ListUsageRecordAllTimeParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordAllTimeParams) SetEndDate(EndDate string) (*ListUsageRecordAllTimeParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordAllTimeParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordAllTimeParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordAllTimeParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordAllTimeParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordAllTimeParams) SetPageSize(PageSize int) *ListUsageRecordAllTimeParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordAllTimeParams) SetPageSize(PageSize int) (*ListUsageRecordAllTimeParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordAllTimeParams) SetLimit(Limit int) *ListUsageRecordAllTimeParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordAllTimeParams) SetLimit(Limit int) (*ListUsageRecordAllTimeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordAllTime records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordAllTime(params *ListUsageRecordAllTimeParams, pageToken, pageNumber string) (*ListUsageRecordAllTimeResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/AllTime.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordAllTime(params *ListUsageRecordAllTimeParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/AllTime.json" - defer resp.Body.Close() - - ps := &ListUsageRecordAllTimeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordAllTime records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordAllTime(params *ListUsageRecordAllTimeParams) ([]ApiV2010UsageRecordAllTime, error) { +func (c *ApiService) ListUsageRecordAllTime(params *ListUsageRecordAllTimeParams) (ListUsageRecordAllTime200Response, error) { response, errors := c.StreamUsageRecordAllTime(params) - records := make([]ApiV2010UsageRecordAllTime, 0) + records := make(ListUsageRecordAllTime200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordAllTime(params *ListUsageRecordAllTimeParams } // Streams UsageRecordAllTime records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordAllTime(params *ListUsageRecordAllTimeParams) (chan ApiV2010UsageRecordAllTime, chan error) { +func (c *ApiService) StreamUsageRecordAllTime(params *ListUsageRecordAllTimeParams) (chan ListUsageRecordAllTime200Response, chan error) { if params == nil { params = &ListUsageRecordAllTimeParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordAllTime, 1) + recordChannel := make(chan ListUsageRecordAllTime200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordAllTime(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordAllTime(params *ListUsageRecordAllTimePara return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordAllTime(response *ListUsageRecordAllTimeResponse, params *ListUsageRecordAllTimeParams, recordChannel chan ApiV2010UsageRecordAllTime, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordAllTime(response *, params *ListUsageRecordAllTimeParams, recordChannel chan ListUsageRecordAllTime200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordAllTime(response *ListUsageRecordAllTimeRe } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordAllTimeResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordAllTime(response *ListUsageRecordAllTimeRe break } - response = record.(*ListUsageRecordAllTimeResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordAllTimeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordAllTimeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_daily.go b/rest/api/v2010/accounts_usage_records_daily.go index c27a64969..0625906fd 100644 --- a/rest/api/v2010/accounts_usage_records_daily.go +++ b/rest/api/v2010/accounts_usage_records_daily.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordDaily' type ListUsageRecordDailyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordDailyParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordDailyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordDailyParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordDailyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordDailyParams) SetCategory(Category string) *ListUsageRecordDailyParams { - params.Category = &Category - return params +func (params *ListUsageRecordDailyParams) SetCategory(Category string) (*ListUsageRecordDailyParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordDailyParams) SetStartDate(StartDate string) *ListUsageRecordDailyParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordDailyParams) SetStartDate(StartDate string) (*ListUsageRecordDailyParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordDailyParams) SetEndDate(EndDate string) *ListUsageRecordDailyParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordDailyParams) SetEndDate(EndDate string) (*ListUsageRecordDailyParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordDailyParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordDailyParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordDailyParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordDailyParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordDailyParams) SetPageSize(PageSize int) *ListUsageRecordDailyParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordDailyParams) SetPageSize(PageSize int) (*ListUsageRecordDailyParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordDailyParams) SetLimit(Limit int) *ListUsageRecordDailyParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordDailyParams) SetLimit(Limit int) (*ListUsageRecordDailyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordDaily records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordDaily(params *ListUsageRecordDailyParams, pageToken, pageNumber string) (*ListUsageRecordDailyResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Daily.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordDaily(params *ListUsageRecordDailyParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Daily.json" - defer resp.Body.Close() - - ps := &ListUsageRecordDailyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordDaily records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordDaily(params *ListUsageRecordDailyParams) ([]ApiV2010UsageRecordDaily, error) { +func (c *ApiService) ListUsageRecordDaily(params *ListUsageRecordDailyParams) (ListUsageRecordDaily200Response, error) { response, errors := c.StreamUsageRecordDaily(params) - records := make([]ApiV2010UsageRecordDaily, 0) + records := make(ListUsageRecordDaily200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordDaily(params *ListUsageRecordDailyParams) ([ } // Streams UsageRecordDaily records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordDaily(params *ListUsageRecordDailyParams) (chan ApiV2010UsageRecordDaily, chan error) { +func (c *ApiService) StreamUsageRecordDaily(params *ListUsageRecordDailyParams) (chan ListUsageRecordDaily200Response, chan error) { if params == nil { params = &ListUsageRecordDailyParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordDaily, 1) + recordChannel := make(chan ListUsageRecordDaily200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordDaily(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordDaily(params *ListUsageRecordDailyParams) return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordDaily(response *ListUsageRecordDailyResponse, params *ListUsageRecordDailyParams, recordChannel chan ApiV2010UsageRecordDaily, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordDaily(response *, params *ListUsageRecordDailyParams, recordChannel chan ListUsageRecordDaily200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordDaily(response *ListUsageRecordDailyRespon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordDailyResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordDaily(response *ListUsageRecordDailyRespon break } - response = record.(*ListUsageRecordDailyResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordDailyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordDailyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_last_month.go b/rest/api/v2010/accounts_usage_records_last_month.go index 23ec9b62d..590e06b9e 100644 --- a/rest/api/v2010/accounts_usage_records_last_month.go +++ b/rest/api/v2010/accounts_usage_records_last_month.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordLastMonth' type ListUsageRecordLastMonthParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordLastMonthParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordLastMonthParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordLastMonthParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordLastMonthParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordLastMonthParams) SetCategory(Category string) *ListUsageRecordLastMonthParams { - params.Category = &Category - return params +func (params *ListUsageRecordLastMonthParams) SetCategory(Category string) (*ListUsageRecordLastMonthParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordLastMonthParams) SetStartDate(StartDate string) *ListUsageRecordLastMonthParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordLastMonthParams) SetStartDate(StartDate string) (*ListUsageRecordLastMonthParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordLastMonthParams) SetEndDate(EndDate string) *ListUsageRecordLastMonthParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordLastMonthParams) SetEndDate(EndDate string) (*ListUsageRecordLastMonthParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordLastMonthParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordLastMonthParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordLastMonthParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordLastMonthParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordLastMonthParams) SetPageSize(PageSize int) *ListUsageRecordLastMonthParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordLastMonthParams) SetPageSize(PageSize int) (*ListUsageRecordLastMonthParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordLastMonthParams) SetLimit(Limit int) *ListUsageRecordLastMonthParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordLastMonthParams) SetLimit(Limit int) (*ListUsageRecordLastMonthParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordLastMonth records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordLastMonth(params *ListUsageRecordLastMonthParams, pageToken, pageNumber string) (*ListUsageRecordLastMonthResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/LastMonth.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordLastMonth(params *ListUsageRecordLastMonthParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/LastMonth.json" - defer resp.Body.Close() - - ps := &ListUsageRecordLastMonthResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordLastMonth records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordLastMonth(params *ListUsageRecordLastMonthParams) ([]ApiV2010UsageRecordLastMonth, error) { +func (c *ApiService) ListUsageRecordLastMonth(params *ListUsageRecordLastMonthParams) (ListUsageRecordLastMonth200Response, error) { response, errors := c.StreamUsageRecordLastMonth(params) - records := make([]ApiV2010UsageRecordLastMonth, 0) + records := make(ListUsageRecordLastMonth200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordLastMonth(params *ListUsageRecordLastMonthPa } // Streams UsageRecordLastMonth records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordLastMonth(params *ListUsageRecordLastMonthParams) (chan ApiV2010UsageRecordLastMonth, chan error) { +func (c *ApiService) StreamUsageRecordLastMonth(params *ListUsageRecordLastMonthParams) (chan ListUsageRecordLastMonth200Response, chan error) { if params == nil { params = &ListUsageRecordLastMonthParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordLastMonth, 1) + recordChannel := make(chan ListUsageRecordLastMonth200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordLastMonth(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordLastMonth(params *ListUsageRecordLastMonth return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordLastMonth(response *ListUsageRecordLastMonthResponse, params *ListUsageRecordLastMonthParams, recordChannel chan ApiV2010UsageRecordLastMonth, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordLastMonth(response *, params *ListUsageRecordLastMonthParams, recordChannel chan ListUsageRecordLastMonth200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordLastMonth(response *ListUsageRecordLastMon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordLastMonthResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordLastMonth(response *ListUsageRecordLastMon break } - response = record.(*ListUsageRecordLastMonthResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordLastMonthResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordLastMonthResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_monthly.go b/rest/api/v2010/accounts_usage_records_monthly.go index 82dc2e4ec..d9fd7570b 100644 --- a/rest/api/v2010/accounts_usage_records_monthly.go +++ b/rest/api/v2010/accounts_usage_records_monthly.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordMonthly' type ListUsageRecordMonthlyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordMonthlyParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordMonthlyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordMonthlyParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordMonthlyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordMonthlyParams) SetCategory(Category string) *ListUsageRecordMonthlyParams { - params.Category = &Category - return params +func (params *ListUsageRecordMonthlyParams) SetCategory(Category string) (*ListUsageRecordMonthlyParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordMonthlyParams) SetStartDate(StartDate string) *ListUsageRecordMonthlyParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordMonthlyParams) SetStartDate(StartDate string) (*ListUsageRecordMonthlyParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordMonthlyParams) SetEndDate(EndDate string) *ListUsageRecordMonthlyParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordMonthlyParams) SetEndDate(EndDate string) (*ListUsageRecordMonthlyParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordMonthlyParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordMonthlyParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordMonthlyParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordMonthlyParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordMonthlyParams) SetPageSize(PageSize int) *ListUsageRecordMonthlyParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordMonthlyParams) SetPageSize(PageSize int) (*ListUsageRecordMonthlyParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordMonthlyParams) SetLimit(Limit int) *ListUsageRecordMonthlyParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordMonthlyParams) SetLimit(Limit int) (*ListUsageRecordMonthlyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordMonthly records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordMonthly(params *ListUsageRecordMonthlyParams, pageToken, pageNumber string) (*ListUsageRecordMonthlyResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Monthly.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordMonthly(params *ListUsageRecordMonthlyParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Monthly.json" - defer resp.Body.Close() - - ps := &ListUsageRecordMonthlyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordMonthly records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordMonthly(params *ListUsageRecordMonthlyParams) ([]ApiV2010UsageRecordMonthly, error) { +func (c *ApiService) ListUsageRecordMonthly(params *ListUsageRecordMonthlyParams) (ListUsageRecordMonthly200Response, error) { response, errors := c.StreamUsageRecordMonthly(params) - records := make([]ApiV2010UsageRecordMonthly, 0) + records := make(ListUsageRecordMonthly200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordMonthly(params *ListUsageRecordMonthlyParams } // Streams UsageRecordMonthly records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordMonthly(params *ListUsageRecordMonthlyParams) (chan ApiV2010UsageRecordMonthly, chan error) { +func (c *ApiService) StreamUsageRecordMonthly(params *ListUsageRecordMonthlyParams) (chan ListUsageRecordMonthly200Response, chan error) { if params == nil { params = &ListUsageRecordMonthlyParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordMonthly, 1) + recordChannel := make(chan ListUsageRecordMonthly200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordMonthly(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordMonthly(params *ListUsageRecordMonthlyPara return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordMonthly(response *ListUsageRecordMonthlyResponse, params *ListUsageRecordMonthlyParams, recordChannel chan ApiV2010UsageRecordMonthly, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordMonthly(response *, params *ListUsageRecordMonthlyParams, recordChannel chan ListUsageRecordMonthly200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordMonthly(response *ListUsageRecordMonthlyRe } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordMonthlyResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordMonthly(response *ListUsageRecordMonthlyRe break } - response = record.(*ListUsageRecordMonthlyResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordMonthlyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordMonthlyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_this_month.go b/rest/api/v2010/accounts_usage_records_this_month.go index b3b79e816..36d262304 100644 --- a/rest/api/v2010/accounts_usage_records_this_month.go +++ b/rest/api/v2010/accounts_usage_records_this_month.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordThisMonth' type ListUsageRecordThisMonthParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordThisMonthParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordThisMonthParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordThisMonthParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordThisMonthParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordThisMonthParams) SetCategory(Category string) *ListUsageRecordThisMonthParams { - params.Category = &Category - return params +func (params *ListUsageRecordThisMonthParams) SetCategory(Category string) (*ListUsageRecordThisMonthParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordThisMonthParams) SetStartDate(StartDate string) *ListUsageRecordThisMonthParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordThisMonthParams) SetStartDate(StartDate string) (*ListUsageRecordThisMonthParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordThisMonthParams) SetEndDate(EndDate string) *ListUsageRecordThisMonthParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordThisMonthParams) SetEndDate(EndDate string) (*ListUsageRecordThisMonthParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordThisMonthParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordThisMonthParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordThisMonthParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordThisMonthParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordThisMonthParams) SetPageSize(PageSize int) *ListUsageRecordThisMonthParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordThisMonthParams) SetPageSize(PageSize int) (*ListUsageRecordThisMonthParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordThisMonthParams) SetLimit(Limit int) *ListUsageRecordThisMonthParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordThisMonthParams) SetLimit(Limit int) (*ListUsageRecordThisMonthParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordThisMonth records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordThisMonth(params *ListUsageRecordThisMonthParams, pageToken, pageNumber string) (*ListUsageRecordThisMonthResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/ThisMonth.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordThisMonth(params *ListUsageRecordThisMonthParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/ThisMonth.json" - defer resp.Body.Close() - - ps := &ListUsageRecordThisMonthResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordThisMonth records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordThisMonth(params *ListUsageRecordThisMonthParams) ([]ApiV2010UsageRecordThisMonth, error) { +func (c *ApiService) ListUsageRecordThisMonth(params *ListUsageRecordThisMonthParams) (ListUsageRecordThisMonth200Response, error) { response, errors := c.StreamUsageRecordThisMonth(params) - records := make([]ApiV2010UsageRecordThisMonth, 0) + records := make(ListUsageRecordThisMonth200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordThisMonth(params *ListUsageRecordThisMonthPa } // Streams UsageRecordThisMonth records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordThisMonth(params *ListUsageRecordThisMonthParams) (chan ApiV2010UsageRecordThisMonth, chan error) { +func (c *ApiService) StreamUsageRecordThisMonth(params *ListUsageRecordThisMonthParams) (chan ListUsageRecordThisMonth200Response, chan error) { if params == nil { params = &ListUsageRecordThisMonthParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordThisMonth, 1) + recordChannel := make(chan ListUsageRecordThisMonth200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordThisMonth(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordThisMonth(params *ListUsageRecordThisMonth return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordThisMonth(response *ListUsageRecordThisMonthResponse, params *ListUsageRecordThisMonthParams, recordChannel chan ApiV2010UsageRecordThisMonth, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordThisMonth(response *, params *ListUsageRecordThisMonthParams, recordChannel chan ListUsageRecordThisMonth200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordThisMonth(response *ListUsageRecordThisMon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordThisMonthResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordThisMonth(response *ListUsageRecordThisMon break } - response = record.(*ListUsageRecordThisMonthResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordThisMonthResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordThisMonthResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_today.go b/rest/api/v2010/accounts_usage_records_today.go index f9ce2c74a..5ed169591 100644 --- a/rest/api/v2010/accounts_usage_records_today.go +++ b/rest/api/v2010/accounts_usage_records_today.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordToday' type ListUsageRecordTodayParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordTodayParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordTodayParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordTodayParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordTodayParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordTodayParams) SetCategory(Category string) *ListUsageRecordTodayParams { - params.Category = &Category - return params +func (params *ListUsageRecordTodayParams) SetCategory(Category string) (*ListUsageRecordTodayParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordTodayParams) SetStartDate(StartDate string) *ListUsageRecordTodayParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordTodayParams) SetStartDate(StartDate string) (*ListUsageRecordTodayParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordTodayParams) SetEndDate(EndDate string) *ListUsageRecordTodayParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordTodayParams) SetEndDate(EndDate string) (*ListUsageRecordTodayParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordTodayParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordTodayParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordTodayParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordTodayParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordTodayParams) SetPageSize(PageSize int) *ListUsageRecordTodayParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordTodayParams) SetPageSize(PageSize int) (*ListUsageRecordTodayParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordTodayParams) SetLimit(Limit int) *ListUsageRecordTodayParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordTodayParams) SetLimit(Limit int) (*ListUsageRecordTodayParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordToday records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordToday(params *ListUsageRecordTodayParams, pageToken, pageNumber string) (*ListUsageRecordTodayResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Today.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordToday(params *ListUsageRecordTodayParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Today.json" - defer resp.Body.Close() - - ps := &ListUsageRecordTodayResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordToday records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordToday(params *ListUsageRecordTodayParams) ([]ApiV2010UsageRecordToday, error) { +func (c *ApiService) ListUsageRecordToday(params *ListUsageRecordTodayParams) (ListUsageRecordToday200Response, error) { response, errors := c.StreamUsageRecordToday(params) - records := make([]ApiV2010UsageRecordToday, 0) + records := make(ListUsageRecordToday200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordToday(params *ListUsageRecordTodayParams) ([ } // Streams UsageRecordToday records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordToday(params *ListUsageRecordTodayParams) (chan ApiV2010UsageRecordToday, chan error) { +func (c *ApiService) StreamUsageRecordToday(params *ListUsageRecordTodayParams) (chan ListUsageRecordToday200Response, chan error) { if params == nil { params = &ListUsageRecordTodayParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordToday, 1) + recordChannel := make(chan ListUsageRecordToday200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordToday(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordToday(params *ListUsageRecordTodayParams) return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordToday(response *ListUsageRecordTodayResponse, params *ListUsageRecordTodayParams, recordChannel chan ApiV2010UsageRecordToday, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordToday(response *, params *ListUsageRecordTodayParams, recordChannel chan ListUsageRecordToday200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordToday(response *ListUsageRecordTodayRespon } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordTodayResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordToday(response *ListUsageRecordTodayRespon break } - response = record.(*ListUsageRecordTodayResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordTodayResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordTodayResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_yearly.go b/rest/api/v2010/accounts_usage_records_yearly.go index e601fd804..85886b1cf 100644 --- a/rest/api/v2010/accounts_usage_records_yearly.go +++ b/rest/api/v2010/accounts_usage_records_yearly.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordYearly' type ListUsageRecordYearlyParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordYearlyParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordYearlyParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordYearlyParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordYearlyParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordYearlyParams) SetCategory(Category string) *ListUsageRecordYearlyParams { - params.Category = &Category - return params +func (params *ListUsageRecordYearlyParams) SetCategory(Category string) (*ListUsageRecordYearlyParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordYearlyParams) SetStartDate(StartDate string) *ListUsageRecordYearlyParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordYearlyParams) SetStartDate(StartDate string) (*ListUsageRecordYearlyParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordYearlyParams) SetEndDate(EndDate string) *ListUsageRecordYearlyParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordYearlyParams) SetEndDate(EndDate string) (*ListUsageRecordYearlyParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordYearlyParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordYearlyParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordYearlyParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordYearlyParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordYearlyParams) SetPageSize(PageSize int) *ListUsageRecordYearlyParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordYearlyParams) SetPageSize(PageSize int) (*ListUsageRecordYearlyParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordYearlyParams) SetLimit(Limit int) *ListUsageRecordYearlyParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordYearlyParams) SetLimit(Limit int) (*ListUsageRecordYearlyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordYearly records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordYearly(params *ListUsageRecordYearlyParams, pageToken, pageNumber string) (*ListUsageRecordYearlyResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Yearly.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordYearly(params *ListUsageRecordYearlyParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Yearly.json" - defer resp.Body.Close() - - ps := &ListUsageRecordYearlyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordYearly records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordYearly(params *ListUsageRecordYearlyParams) ([]ApiV2010UsageRecordYearly, error) { +func (c *ApiService) ListUsageRecordYearly(params *ListUsageRecordYearlyParams) (ListUsageRecordYearly200Response, error) { response, errors := c.StreamUsageRecordYearly(params) - records := make([]ApiV2010UsageRecordYearly, 0) + records := make(ListUsageRecordYearly200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordYearly(params *ListUsageRecordYearlyParams) } // Streams UsageRecordYearly records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordYearly(params *ListUsageRecordYearlyParams) (chan ApiV2010UsageRecordYearly, chan error) { +func (c *ApiService) StreamUsageRecordYearly(params *ListUsageRecordYearlyParams) (chan ListUsageRecordYearly200Response, chan error) { if params == nil { params = &ListUsageRecordYearlyParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordYearly, 1) + recordChannel := make(chan ListUsageRecordYearly200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordYearly(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordYearly(params *ListUsageRecordYearlyParams return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordYearly(response *ListUsageRecordYearlyResponse, params *ListUsageRecordYearlyParams, recordChannel chan ApiV2010UsageRecordYearly, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordYearly(response *, params *ListUsageRecordYearlyParams, recordChannel chan ListUsageRecordYearly200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordYearly(response *ListUsageRecordYearlyResp } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordYearlyResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordYearly(response *ListUsageRecordYearlyResp break } - response = record.(*ListUsageRecordYearlyResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordYearlyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordYearlyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_records_yesterday.go b/rest/api/v2010/accounts_usage_records_yesterday.go index 5293f7a19..f078a3301 100644 --- a/rest/api/v2010/accounts_usage_records_yesterday.go +++ b/rest/api/v2010/accounts_usage_records_yesterday.go @@ -18,114 +18,114 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecordYesterday' type ListUsageRecordYesterdayParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. - Category *string `json:"Category,omitempty"` - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. - EndDate *string `json:"EndDate,omitempty"` - // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. - IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. + Category *string `json:"Category,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. + EndDate *string `json:"EndDate,omitempty"` + // Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. + IncludeSubaccounts *bool `json:"IncludeSubaccounts,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordYesterdayParams) SetPathAccountSid(PathAccountSid string) *ListUsageRecordYesterdayParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageRecordYesterdayParams) SetPathAccountSid(PathAccountSid string) (*ListUsageRecordYesterdayParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageRecordYesterdayParams) SetCategory(Category string) *ListUsageRecordYesterdayParams { - params.Category = &Category - return params +func (params *ListUsageRecordYesterdayParams) SetCategory(Category string) (*ListUsageRecordYesterdayParams){ + params.Category = &Category + return params } -func (params *ListUsageRecordYesterdayParams) SetStartDate(StartDate string) *ListUsageRecordYesterdayParams { - params.StartDate = &StartDate - return params +func (params *ListUsageRecordYesterdayParams) SetStartDate(StartDate string) (*ListUsageRecordYesterdayParams){ + params.StartDate = &StartDate + return params } -func (params *ListUsageRecordYesterdayParams) SetEndDate(EndDate string) *ListUsageRecordYesterdayParams { - params.EndDate = &EndDate - return params +func (params *ListUsageRecordYesterdayParams) SetEndDate(EndDate string) (*ListUsageRecordYesterdayParams){ + params.EndDate = &EndDate + return params } -func (params *ListUsageRecordYesterdayParams) SetIncludeSubaccounts(IncludeSubaccounts bool) *ListUsageRecordYesterdayParams { - params.IncludeSubaccounts = &IncludeSubaccounts - return params +func (params *ListUsageRecordYesterdayParams) SetIncludeSubaccounts(IncludeSubaccounts bool) (*ListUsageRecordYesterdayParams){ + params.IncludeSubaccounts = &IncludeSubaccounts + return params } -func (params *ListUsageRecordYesterdayParams) SetPageSize(PageSize int) *ListUsageRecordYesterdayParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordYesterdayParams) SetPageSize(PageSize int) (*ListUsageRecordYesterdayParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordYesterdayParams) SetLimit(Limit int) *ListUsageRecordYesterdayParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordYesterdayParams) SetLimit(Limit int) (*ListUsageRecordYesterdayParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecordYesterday records from the API. Request is executed immediately. -func (c *ApiService) PageUsageRecordYesterday(params *ListUsageRecordYesterdayParams, pageToken, pageNumber string) (*ListUsageRecordYesterdayResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Yesterday.json" - - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Category != nil { - data.Set("Category", *params.Category) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.IncludeSubaccounts != nil { - data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +func (c *ApiService) PageUsageRecordYesterday(params *ListUsageRecordYesterdayParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Records/Yesterday.json" - defer resp.Body.Close() - - ps := &ListUsageRecordYesterdayResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - return ps, err + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Category != nil { + data.Set("Category", *params.Category) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.IncludeSubaccounts != nil { + data.Set("IncludeSubaccounts", fmt.Sprint(*params.IncludeSubaccounts)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecordYesterday records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageRecordYesterday(params *ListUsageRecordYesterdayParams) ([]ApiV2010UsageRecordYesterday, error) { +func (c *ApiService) ListUsageRecordYesterday(params *ListUsageRecordYesterdayParams) (ListUsageRecordYesterday200Response, error) { response, errors := c.StreamUsageRecordYesterday(params) - records := make([]ApiV2010UsageRecordYesterday, 0) + records := make(ListUsageRecordYesterday200Response, 0) for record := range response { records = append(records, record) } @@ -138,13 +138,13 @@ func (c *ApiService) ListUsageRecordYesterday(params *ListUsageRecordYesterdayPa } // Streams UsageRecordYesterday records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageRecordYesterday(params *ListUsageRecordYesterdayParams) (chan ApiV2010UsageRecordYesterday, chan error) { +func (c *ApiService) StreamUsageRecordYesterday(params *ListUsageRecordYesterdayParams) (chan ListUsageRecordYesterday200Response, chan error) { if params == nil { params = &ListUsageRecordYesterdayParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageRecordYesterday, 1) + recordChannel := make(chan ListUsageRecordYesterday200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageRecordYesterday(params, "", "") @@ -159,11 +159,12 @@ func (c *ApiService) StreamUsageRecordYesterday(params *ListUsageRecordYesterday return recordChannel, errorChannel } -func (c *ApiService) streamUsageRecordYesterday(response *ListUsageRecordYesterdayResponse, params *ListUsageRecordYesterdayParams, recordChannel chan ApiV2010UsageRecordYesterday, errorChannel chan error) { + +func (c *ApiService) streamUsageRecordYesterday(response *, params *ListUsageRecordYesterdayParams, recordChannel chan ListUsageRecordYesterday200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageRecords + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -174,7 +175,7 @@ func (c *ApiService) streamUsageRecordYesterday(response *ListUsageRecordYesterd } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageRecordYesterdayResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -182,27 +183,28 @@ func (c *ApiService) streamUsageRecordYesterday(response *ListUsageRecordYesterd break } - response = record.(*ListUsageRecordYesterdayResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageRecordYesterdayResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordYesterdayResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/api/v2010/accounts_usage_triggers.go b/rest/api/v2010/accounts_usage_triggers.go index da4333b3a..e554f370b 100644 --- a/rest/api/v2010/accounts_usage_triggers.go +++ b/rest/api/v2010/accounts_usage_triggers.go @@ -18,280 +18,285 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUsageTrigger' type CreateUsageTriggerParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The URL we should call using `callback_method` when the trigger fires. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // The usage value at which the trigger should fire. For convenience, you can use an offset value such as `+30` to specify a trigger_value that is 30 units more than the current usage value. Be sure to urlencode a `+` as `%2B`. - TriggerValue *string `json:"TriggerValue,omitempty"` - // - UsageCategory *string `json:"UsageCategory,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Recurring *string `json:"Recurring,omitempty"` - // - TriggerBy *string `json:"TriggerBy,omitempty"` -} - -func (params *CreateUsageTriggerParams) SetPathAccountSid(PathAccountSid string) *CreateUsageTriggerParams { - params.PathAccountSid = &PathAccountSid - return params -} -func (params *CreateUsageTriggerParams) SetCallbackUrl(CallbackUrl string) *CreateUsageTriggerParams { - params.CallbackUrl = &CallbackUrl - return params -} -func (params *CreateUsageTriggerParams) SetTriggerValue(TriggerValue string) *CreateUsageTriggerParams { - params.TriggerValue = &TriggerValue - return params -} -func (params *CreateUsageTriggerParams) SetUsageCategory(UsageCategory string) *CreateUsageTriggerParams { - params.UsageCategory = &UsageCategory - return params -} -func (params *CreateUsageTriggerParams) SetCallbackMethod(CallbackMethod string) *CreateUsageTriggerParams { - params.CallbackMethod = &CallbackMethod - return params -} -func (params *CreateUsageTriggerParams) SetFriendlyName(FriendlyName string) *CreateUsageTriggerParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateUsageTriggerParams) SetRecurring(Recurring string) *CreateUsageTriggerParams { - params.Recurring = &Recurring - return params -} -func (params *CreateUsageTriggerParams) SetTriggerBy(TriggerBy string) *CreateUsageTriggerParams { - params.TriggerBy = &TriggerBy - return params + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that will create the resource. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The URL we should call using `callback_method` when the trigger fires. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // The usage value at which the trigger should fire. For convenience, you can use an offset value such as `+30` to specify a trigger_value that is 30 units more than the current usage value. Be sure to urlencode a `+` as `%2B`. + TriggerValue *string `json:"TriggerValue,omitempty"` + // + UsageCategory *string `json:"UsageCategory,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Recurring *string `json:"Recurring,omitempty"` + // + TriggerBy *string `json:"TriggerBy,omitempty"` +} + +func (params *CreateUsageTriggerParams) SetPathAccountSid(PathAccountSid string) (*CreateUsageTriggerParams){ + params.PathAccountSid = &PathAccountSid + return params +} +func (params *CreateUsageTriggerParams) SetCallbackUrl(CallbackUrl string) (*CreateUsageTriggerParams){ + params.CallbackUrl = &CallbackUrl + return params +} +func (params *CreateUsageTriggerParams) SetTriggerValue(TriggerValue string) (*CreateUsageTriggerParams){ + params.TriggerValue = &TriggerValue + return params +} +func (params *CreateUsageTriggerParams) SetUsageCategory(UsageCategory string) (*CreateUsageTriggerParams){ + params.UsageCategory = &UsageCategory + return params +} +func (params *CreateUsageTriggerParams) SetCallbackMethod(CallbackMethod string) (*CreateUsageTriggerParams){ + params.CallbackMethod = &CallbackMethod + return params +} +func (params *CreateUsageTriggerParams) SetFriendlyName(FriendlyName string) (*CreateUsageTriggerParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateUsageTriggerParams) SetRecurring(Recurring string) (*CreateUsageTriggerParams){ + params.Recurring = &Recurring + return params +} +func (params *CreateUsageTriggerParams) SetTriggerBy(TriggerBy string) (*CreateUsageTriggerParams){ + params.TriggerBy = &TriggerBy + return params } // Create a new UsageTrigger func (c *ApiService) CreateUsageTrigger(params *CreateUsageTriggerParams) (*ApiV2010UsageTrigger, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.TriggerValue != nil { - data.Set("TriggerValue", *params.TriggerValue) - } - if params != nil && params.UsageCategory != nil { - data.Set("UsageCategory", *params.UsageCategory) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Recurring != nil { - data.Set("Recurring", *params.Recurring) - } - if params != nil && params.TriggerBy != nil { - data.Set("TriggerBy", *params.TriggerBy) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ApiV2010UsageTrigger{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.TriggerValue != nil { + data.Set("TriggerValue", *params.TriggerValue) + } + if params != nil && params.UsageCategory != nil { + data.Set("UsageCategory", *params.UsageCategory) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Recurring != nil { + data.Set("Recurring", *params.Recurring) + } + if params != nil && params.TriggerBy != nil { + data.Set("TriggerBy", *params.TriggerBy) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ApiV2010UsageTrigger{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteUsageTrigger' type DeleteUsageTriggerParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to delete. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to delete. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *DeleteUsageTriggerParams) SetPathAccountSid(PathAccountSid string) *DeleteUsageTriggerParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *DeleteUsageTriggerParams) SetPathAccountSid(PathAccountSid string) (*DeleteUsageTriggerParams){ + params.PathAccountSid = &PathAccountSid + return params } -// -func (c *ApiService) DeleteUsageTrigger(Sid string, params *DeleteUsageTriggerParams) error { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteUsageTrigger(Sid string, params *DeleteUsageTriggerParams) (error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Optional parameters for the method 'FetchUsageTrigger' type FetchUsageTriggerParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resource to fetch. - PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resource to fetch. + PathAccountSid *string `json:"PathAccountSid,omitempty"` } -func (params *FetchUsageTriggerParams) SetPathAccountSid(PathAccountSid string) *FetchUsageTriggerParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *FetchUsageTriggerParams) SetPathAccountSid(PathAccountSid string) (*FetchUsageTriggerParams){ + params.PathAccountSid = &PathAccountSid + return params } // Fetch and instance of a usage-trigger func (c *ApiService) FetchUsageTrigger(Sid string, params *FetchUsageTriggerParams) (*ApiV2010UsageTrigger, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ApiV2010UsageTrigger{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ApiV2010UsageTrigger{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUsageTrigger' type ListUsageTriggerParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to read. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers. - Recurring *string `json:"Recurring,omitempty"` - // The trigger field of the UsageTriggers to read. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). - TriggerBy *string `json:"TriggerBy,omitempty"` - // The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories). - UsageCategory *string `json:"UsageCategory,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to read. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers. + Recurring *string `json:"Recurring,omitempty"` + // The trigger field of the UsageTriggers to read. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). + TriggerBy *string `json:"TriggerBy,omitempty"` + // The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories). + UsageCategory *string `json:"UsageCategory,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageTriggerParams) SetPathAccountSid(PathAccountSid string) *ListUsageTriggerParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *ListUsageTriggerParams) SetPathAccountSid(PathAccountSid string) (*ListUsageTriggerParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *ListUsageTriggerParams) SetRecurring(Recurring string) *ListUsageTriggerParams { - params.Recurring = &Recurring - return params +func (params *ListUsageTriggerParams) SetRecurring(Recurring string) (*ListUsageTriggerParams){ + params.Recurring = &Recurring + return params } -func (params *ListUsageTriggerParams) SetTriggerBy(TriggerBy string) *ListUsageTriggerParams { - params.TriggerBy = &TriggerBy - return params +func (params *ListUsageTriggerParams) SetTriggerBy(TriggerBy string) (*ListUsageTriggerParams){ + params.TriggerBy = &TriggerBy + return params } -func (params *ListUsageTriggerParams) SetUsageCategory(UsageCategory string) *ListUsageTriggerParams { - params.UsageCategory = &UsageCategory - return params +func (params *ListUsageTriggerParams) SetUsageCategory(UsageCategory string) (*ListUsageTriggerParams){ + params.UsageCategory = &UsageCategory + return params } -func (params *ListUsageTriggerParams) SetPageSize(PageSize int) *ListUsageTriggerParams { - params.PageSize = &PageSize - return params +func (params *ListUsageTriggerParams) SetPageSize(PageSize int) (*ListUsageTriggerParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageTriggerParams) SetLimit(Limit int) *ListUsageTriggerParams { - params.Limit = &Limit - return params +func (params *ListUsageTriggerParams) SetLimit(Limit int) (*ListUsageTriggerParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageTrigger records from the API. Request is executed immediately. -func (c *ApiService) PageUsageTrigger(params *ListUsageTriggerParams, pageToken, pageNumber string) (*ListUsageTriggerResponse, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json" +func (c *ApiService) PageUsageTrigger(params *ListUsageTriggerParams, pageToken, pageNumber string) (*, error) { + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Recurring != nil { - data.Set("Recurring", *params.Recurring) - } - if params != nil && params.TriggerBy != nil { - data.Set("TriggerBy", *params.TriggerBy) - } - if params != nil && params.UsageCategory != nil { - data.Set("UsageCategory", *params.UsageCategory) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Recurring != nil { + data.Set("Recurring", *params.Recurring) + } + if params != nil && params.TriggerBy != nil { + data.Set("TriggerBy", *params.TriggerBy) + } + if params != nil && params.UsageCategory != nil { + data.Set("UsageCategory", *params.UsageCategory) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUsageTriggerResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UsageTrigger records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. -func (c *ApiService) ListUsageTrigger(params *ListUsageTriggerParams) ([]ApiV2010UsageTrigger, error) { +func (c *ApiService) ListUsageTrigger(params *ListUsageTriggerParams) (ListUsageTrigger200Response, error) { response, errors := c.StreamUsageTrigger(params) - records := make([]ApiV2010UsageTrigger, 0) + records := make(ListUsageTrigger200Response, 0) for record := range response { records = append(records, record) } @@ -304,13 +309,13 @@ func (c *ApiService) ListUsageTrigger(params *ListUsageTriggerParams) ([]ApiV201 } // Streams UsageTrigger records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached. -func (c *ApiService) StreamUsageTrigger(params *ListUsageTriggerParams) (chan ApiV2010UsageTrigger, chan error) { +func (c *ApiService) StreamUsageTrigger(params *ListUsageTriggerParams) (chan ListUsageTrigger200Response, chan error) { if params == nil { params = &ListUsageTriggerParams{} } params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit)) - recordChannel := make(chan ApiV2010UsageTrigger, 1) + recordChannel := make(chan ListUsageTrigger200Response, 1) errorChannel := make(chan error, 1) response, err := c.PageUsageTrigger(params, "", "") @@ -325,11 +330,12 @@ func (c *ApiService) StreamUsageTrigger(params *ListUsageTriggerParams) (chan Ap return recordChannel, errorChannel } -func (c *ApiService) streamUsageTrigger(response *ListUsageTriggerResponse, params *ListUsageTriggerParams, recordChannel chan ApiV2010UsageTrigger, errorChannel chan error) { + +func (c *ApiService) streamUsageTrigger(response *, params *ListUsageTriggerParams, recordChannel chan ListUsageTrigger200Response, errorChannel chan error) { curRecord := 1 for response != nil { - responseRecords := response.UsageTriggers + responseRecords := response. for item := range responseRecords { recordChannel <- responseRecords[item] curRecord += 1 @@ -340,7 +346,7 @@ func (c *ApiService) streamUsageTrigger(response *ListUsageTriggerResponse, para } } - record, err := client.GetNext(c.baseURL, response, c.getNextListUsageTriggerResponse) + record, err := client.GetNext(c.baseURL, response, c.getNext) if err != nil { errorChannel <- err break @@ -348,94 +354,96 @@ func (c *ApiService) streamUsageTrigger(response *ListUsageTriggerResponse, para break } - response = record.(*ListUsageTriggerResponse) + response = record.(*) } close(recordChannel) close(errorChannel) } -func (c *ApiService) getNextListUsageTriggerResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } +func (c *ApiService) getNext(nextPageUrl string) (interface{}, error) { + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUsageTriggerResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUsageTrigger' type UpdateUsageTriggerParams struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to update. - PathAccountSid *string `json:"PathAccountSid,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // The URL we should call using `callback_method` when the trigger fires. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to update. + PathAccountSid *string `json:"PathAccountSid,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // The URL we should call using `callback_method` when the trigger fires. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateUsageTriggerParams) SetPathAccountSid(PathAccountSid string) *UpdateUsageTriggerParams { - params.PathAccountSid = &PathAccountSid - return params +func (params *UpdateUsageTriggerParams) SetPathAccountSid(PathAccountSid string) (*UpdateUsageTriggerParams){ + params.PathAccountSid = &PathAccountSid + return params } -func (params *UpdateUsageTriggerParams) SetCallbackMethod(CallbackMethod string) *UpdateUsageTriggerParams { - params.CallbackMethod = &CallbackMethod - return params +func (params *UpdateUsageTriggerParams) SetCallbackMethod(CallbackMethod string) (*UpdateUsageTriggerParams){ + params.CallbackMethod = &CallbackMethod + return params } -func (params *UpdateUsageTriggerParams) SetCallbackUrl(CallbackUrl string) *UpdateUsageTriggerParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *UpdateUsageTriggerParams) SetCallbackUrl(CallbackUrl string) (*UpdateUsageTriggerParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *UpdateUsageTriggerParams) SetFriendlyName(FriendlyName string) *UpdateUsageTriggerParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUsageTriggerParams) SetFriendlyName(FriendlyName string) (*UpdateUsageTriggerParams){ + params.FriendlyName = &FriendlyName + return params } // Update an instance of a usage trigger func (c *ApiService) UpdateUsageTrigger(Sid string, params *UpdateUsageTriggerParams) (*ApiV2010UsageTrigger, error) { - path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json" - if params != nil && params.PathAccountSid != nil { - path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) - } else { - path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) - } - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/2010-04-01/Accounts/{AccountSid}/Usage/Triggers/{Sid}.json" + if params != nil && params.PathAccountSid != nil { + path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) +} else { + path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) +} + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ApiV2010UsageTrigger{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ApiV2010UsageTrigger{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/api/v2010/api_service.go b/rest/api/v2010/api_service.go index 72350733f..c7e2ba9e4 100644 --- a/rest/api/v2010/api_service.go +++ b/rest/api/v2010/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://api.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/api/v2010/docs/AccountsAddressesApi.md b/rest/api/v2010/docs/AccountsAddressesApi.md index 4335ca9c2..2736aed20 100644 --- a/rest/api/v2010/docs/AccountsAddressesApi.md +++ b/rest/api/v2010/docs/AccountsAddressesApi.md @@ -149,7 +149,7 @@ Name | Type | Description ## ListAddress -> []ApiV2010Address ListAddress(ctx, optional) +> ListAddress200Response ListAddress(ctx, optional) @@ -175,7 +175,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Address**](ApiV2010Address.md) +[**ListAddress200Response**](ListAddress200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAddressesDependentPhoneNumbersApi.md b/rest/api/v2010/docs/AccountsAddressesDependentPhoneNumbersApi.md index 42d21f8b9..db142d2c9 100644 --- a/rest/api/v2010/docs/AccountsAddressesDependentPhoneNumbersApi.md +++ b/rest/api/v2010/docs/AccountsAddressesDependentPhoneNumbersApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListDependentPhoneNumber -> []ApiV2010DependentPhoneNumber ListDependentPhoneNumber(ctx, AddressSidoptional) +> ListDependentPhoneNumber200Response ListDependentPhoneNumber(ctx, AddressSidoptional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010DependentPhoneNumber**](ApiV2010DependentPhoneNumber.md) +[**ListDependentPhoneNumber200Response**](ListDependentPhoneNumber200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsApi.md b/rest/api/v2010/docs/AccountsApi.md index 9f8607a9d..ca3f2a859 100644 --- a/rest/api/v2010/docs/AccountsApi.md +++ b/rest/api/v2010/docs/AccountsApi.md @@ -94,7 +94,7 @@ Name | Type | Description ## ListAccount -> []ApiV2010Account ListAccount(ctx, optional) +> ListAccount200Response ListAccount(ctx, optional) @@ -118,7 +118,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Account**](ApiV2010Account.md) +[**ListAccount200Response**](ListAccount200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsApplicationsApi.md b/rest/api/v2010/docs/AccountsApplicationsApi.md index 0d6dfe491..c83c0a7a0 100644 --- a/rest/api/v2010/docs/AccountsApplicationsApi.md +++ b/rest/api/v2010/docs/AccountsApplicationsApi.md @@ -155,7 +155,7 @@ Name | Type | Description ## ListApplication -> []ApiV2010Application ListApplication(ctx, optional) +> ListApplication200Response ListApplication(ctx, optional) @@ -179,7 +179,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Application**](ApiV2010Application.md) +[**ListApplication200Response**](ListApplication200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAuthorizedConnectAppsApi.md b/rest/api/v2010/docs/AccountsAuthorizedConnectAppsApi.md index 1acb7879b..7267bb1ef 100644 --- a/rest/api/v2010/docs/AccountsAuthorizedConnectAppsApi.md +++ b/rest/api/v2010/docs/AccountsAuthorizedConnectAppsApi.md @@ -54,7 +54,7 @@ Name | Type | Description ## ListAuthorizedConnectApp -> []ApiV2010AuthorizedConnectApp ListAuthorizedConnectApp(ctx, optional) +> ListAuthorizedConnectApp200Response ListAuthorizedConnectApp(ctx, optional) @@ -77,7 +77,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AuthorizedConnectApp**](ApiV2010AuthorizedConnectApp.md) +[**ListAuthorizedConnectApp200Response**](ListAuthorizedConnectApp200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersApi.md index 326e32d07..c7061097b 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersApi.md @@ -54,7 +54,7 @@ Name | Type | Description ## ListAvailablePhoneNumberCountry -> []ApiV2010AvailablePhoneNumberCountry ListAvailablePhoneNumberCountry(ctx, optional) +> ListAvailablePhoneNumberCountry200Response ListAvailablePhoneNumberCountry(ctx, optional) @@ -77,7 +77,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberCountry**](ApiV2010AvailablePhoneNumberCountry.md) +[**ListAvailablePhoneNumberCountry200Response**](ListAvailablePhoneNumberCountry200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersLocalApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersLocalApi.md index 67eaa0254..2dac533cd 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersLocalApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersLocalApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberLocal -> []ApiV2010AvailablePhoneNumberLocal ListAvailablePhoneNumberLocal(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberLocal200Response ListAvailablePhoneNumberLocal(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberLocal**](ApiV2010AvailablePhoneNumberLocal.md) +[**ListAvailablePhoneNumberLocal200Response**](ListAvailablePhoneNumberLocal200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMachineToMachineApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMachineToMachineApi.md index 53c4afed1..810a5ee30 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMachineToMachineApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMachineToMachineApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberMachineToMachine -> []ApiV2010AvailablePhoneNumberMachineToMachine ListAvailablePhoneNumberMachineToMachine(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberMachineToMachine200Response ListAvailablePhoneNumberMachineToMachine(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberMachineToMachine**](ApiV2010AvailablePhoneNumberMachineToMachine.md) +[**ListAvailablePhoneNumberMachineToMachine200Response**](ListAvailablePhoneNumberMachineToMachine200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMobileApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMobileApi.md index faa940bbf..d99197115 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMobileApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersMobileApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberMobile -> []ApiV2010AvailablePhoneNumberMobile ListAvailablePhoneNumberMobile(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberMobile200Response ListAvailablePhoneNumberMobile(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberMobile**](ApiV2010AvailablePhoneNumberMobile.md) +[**ListAvailablePhoneNumberMobile200Response**](ListAvailablePhoneNumberMobile200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersNationalApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersNationalApi.md index 5d4e69d12..9c5fbca3a 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersNationalApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersNationalApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberNational -> []ApiV2010AvailablePhoneNumberNational ListAvailablePhoneNumberNational(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberNational200Response ListAvailablePhoneNumberNational(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberNational**](ApiV2010AvailablePhoneNumberNational.md) +[**ListAvailablePhoneNumberNational200Response**](ListAvailablePhoneNumberNational200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersSharedCostApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersSharedCostApi.md index d274c52a7..2f947eb1e 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersSharedCostApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersSharedCostApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberSharedCost -> []ApiV2010AvailablePhoneNumberSharedCost ListAvailablePhoneNumberSharedCost(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberSharedCost200Response ListAvailablePhoneNumberSharedCost(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberSharedCost**](ApiV2010AvailablePhoneNumberSharedCost.md) +[**ListAvailablePhoneNumberSharedCost200Response**](ListAvailablePhoneNumberSharedCost200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersTollFreeApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersTollFreeApi.md index afbd27a28..e3023245a 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersTollFreeApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersTollFreeApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberTollFree -> []ApiV2010AvailablePhoneNumberTollFree ListAvailablePhoneNumberTollFree(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberTollFree200Response ListAvailablePhoneNumberTollFree(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberTollFree**](ApiV2010AvailablePhoneNumberTollFree.md) +[**ListAvailablePhoneNumberTollFree200Response**](ListAvailablePhoneNumberTollFree200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersVoipApi.md b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersVoipApi.md index 84efa44af..10eb027c4 100644 --- a/rest/api/v2010/docs/AccountsAvailablePhoneNumbersVoipApi.md +++ b/rest/api/v2010/docs/AccountsAvailablePhoneNumbersVoipApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListAvailablePhoneNumberVoip -> []ApiV2010AvailablePhoneNumberVoip ListAvailablePhoneNumberVoip(ctx, CountryCodeoptional) +> ListAvailablePhoneNumberVoip200Response ListAvailablePhoneNumberVoip(ctx, CountryCodeoptional) @@ -55,7 +55,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010AvailablePhoneNumberVoip**](ApiV2010AvailablePhoneNumberVoip.md) +[**ListAvailablePhoneNumberVoip200Response**](ListAvailablePhoneNumberVoip200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsCallsApi.md b/rest/api/v2010/docs/AccountsCallsApi.md index 7663af185..a109411fb 100644 --- a/rest/api/v2010/docs/AccountsCallsApi.md +++ b/rest/api/v2010/docs/AccountsCallsApi.md @@ -174,7 +174,7 @@ Name | Type | Description ## ListCall -> []ApiV2010Call ListCall(ctx, optional) +> ListCall200Response ListCall(ctx, optional) @@ -197,17 +197,13 @@ Name | Type | Description **ParentCallSid** | **string** | Only include calls spawned by calls with this SID. **Status** | **string** | The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. **StartTime** | **time.Time** | Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. -**StartTimeBefore** | **time.Time** | Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. -**StartTimeAfter** | **time.Time** | Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. **EndTime** | **time.Time** | Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. -**EndTimeBefore** | **time.Time** | Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. -**EndTimeAfter** | **time.Time** | Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. **Limit** | **int** | Max number of records to return. ### Return type -[**[]ApiV2010Call**](ApiV2010Call.md) +[**ListCall200Response**](ListCall200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsCallsEventsApi.md b/rest/api/v2010/docs/AccountsCallsEventsApi.md index dd547621b..200107104 100644 --- a/rest/api/v2010/docs/AccountsCallsEventsApi.md +++ b/rest/api/v2010/docs/AccountsCallsEventsApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListCallEvent -> []ApiV2010CallEvent ListCallEvent(ctx, CallSidoptional) +> ListCallEvent200Response ListCallEvent(ctx, CallSidoptional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010CallEvent**](ApiV2010CallEvent.md) +[**ListCallEvent200Response**](ListCallEvent200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsCallsNotificationsApi.md b/rest/api/v2010/docs/AccountsCallsNotificationsApi.md index abf23f867..45e18b887 100644 --- a/rest/api/v2010/docs/AccountsCallsNotificationsApi.md +++ b/rest/api/v2010/docs/AccountsCallsNotificationsApi.md @@ -55,7 +55,7 @@ Name | Type | Description ## ListCallNotification -> []ApiV2010CallNotification ListCallNotification(ctx, CallSidoptional) +> ListCallNotification200Response ListCallNotification(ctx, CallSidoptional) @@ -86,7 +86,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010CallNotification**](ApiV2010CallNotification.md) +[**ListCallNotification200Response**](ListCallNotification200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsCallsRecordingsApi.md b/rest/api/v2010/docs/AccountsCallsRecordingsApi.md index 561eb87ad..01e55492d 100644 --- a/rest/api/v2010/docs/AccountsCallsRecordingsApi.md +++ b/rest/api/v2010/docs/AccountsCallsRecordingsApi.md @@ -151,7 +151,7 @@ Name | Type | Description ## ListCallRecording -> []ApiV2010CallRecording ListCallRecording(ctx, CallSidoptional) +> ListCallRecording200Response ListCallRecording(ctx, CallSidoptional) @@ -181,7 +181,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010CallRecording**](ApiV2010CallRecording.md) +[**ListCallRecording200Response**](ListCallRecording200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsConferencesApi.md b/rest/api/v2010/docs/AccountsConferencesApi.md index ad8fba342..7283c754c 100644 --- a/rest/api/v2010/docs/AccountsConferencesApi.md +++ b/rest/api/v2010/docs/AccountsConferencesApi.md @@ -55,7 +55,7 @@ Name | Type | Description ## ListConference -> []ApiV2010Conference ListConference(ctx, optional) +> ListConference200Response ListConference(ctx, optional) @@ -74,11 +74,7 @@ Name | Type | Description ------------- | ------------- | ------------- **PathAccountSid** | **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference resource(s) to read. **DateCreated** | **string** | The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. -**DateCreatedBefore** | **string** | The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. -**DateCreatedAfter** | **string** | The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. **DateUpdated** | **string** | The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. -**DateUpdatedBefore** | **string** | The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. -**DateUpdatedAfter** | **string** | The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. **FriendlyName** | **string** | The string that identifies the Conference resources to read. **Status** | **string** | The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. @@ -86,7 +82,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Conference**](ApiV2010Conference.md) +[**ListConference200Response**](ListConference200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsConferencesParticipantsApi.md b/rest/api/v2010/docs/AccountsConferencesParticipantsApi.md index b32a1daa1..7706e886e 100644 --- a/rest/api/v2010/docs/AccountsConferencesParticipantsApi.md +++ b/rest/api/v2010/docs/AccountsConferencesParticipantsApi.md @@ -83,7 +83,6 @@ Name | Type | Description **AmdStatusCallback** | **string** | The URL that we should call using the `amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. **AmdStatusCallbackMethod** | **string** | The HTTP method we should use when calling the `amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. **Trim** | **string** | Whether to trim any leading and trailing silence from the participant recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. -**CallToken** | **string** | A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. ### Return type @@ -193,7 +192,7 @@ Name | Type | Description ## ListParticipant -> []ApiV2010Participant ListParticipant(ctx, ConferenceSidoptional) +> ListParticipant200Response ListParticipant(ctx, ConferenceSidoptional) @@ -223,7 +222,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Participant**](ApiV2010Participant.md) +[**ListParticipant200Response**](ListParticipant200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsConferencesRecordingsApi.md b/rest/api/v2010/docs/AccountsConferencesRecordingsApi.md index e37380d78..a86771423 100644 --- a/rest/api/v2010/docs/AccountsConferencesRecordingsApi.md +++ b/rest/api/v2010/docs/AccountsConferencesRecordingsApi.md @@ -101,7 +101,7 @@ Name | Type | Description ## ListConferenceRecording -> []ApiV2010ConferenceRecording ListConferenceRecording(ctx, ConferenceSidoptional) +> ListConferenceRecording200Response ListConferenceRecording(ctx, ConferenceSidoptional) @@ -131,7 +131,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010ConferenceRecording**](ApiV2010ConferenceRecording.md) +[**ListConferenceRecording200Response**](ListConferenceRecording200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsConnectAppsApi.md b/rest/api/v2010/docs/AccountsConnectAppsApi.md index d1ac5085d..4635bc1bc 100644 --- a/rest/api/v2010/docs/AccountsConnectAppsApi.md +++ b/rest/api/v2010/docs/AccountsConnectAppsApi.md @@ -99,7 +99,7 @@ Name | Type | Description ## ListConnectApp -> []ApiV2010ConnectApp ListConnectApp(ctx, optional) +> ListConnectApp200Response ListConnectApp(ctx, optional) @@ -122,7 +122,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010ConnectApp**](ApiV2010ConnectApp.md) +[**ListConnectApp200Response**](ListConnectApp200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersApi.md b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersApi.md index bfa74b88b..f7c473ec3 100644 --- a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersApi.md +++ b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersApi.md @@ -163,7 +163,7 @@ Name | Type | Description ## ListIncomingPhoneNumber -> []ApiV2010IncomingPhoneNumber ListIncomingPhoneNumber(ctx, optional) +> ListIncomingPhoneNumber200Response ListIncomingPhoneNumber(ctx, optional) @@ -190,7 +190,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010IncomingPhoneNumber**](ApiV2010IncomingPhoneNumber.md) +[**ListIncomingPhoneNumber200Response**](ListIncomingPhoneNumber200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsApi.md b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsApi.md index 0d3188bcb..686296f1b 100644 --- a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsApi.md +++ b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListIncomingPhoneNumberAssignedAddOn -> []ApiV2010IncomingPhoneNumberAssignedAddOn ListIncomingPhoneNumberAssignedAddOn(ctx, ResourceSidoptional) +> ListIncomingPhoneNumberAssignedAddOn200Response ListIncomingPhoneNumberAssignedAddOn(ctx, ResourceSidoptional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010IncomingPhoneNumberAssignedAddOn**](ApiV2010IncomingPhoneNumberAssignedAddOn.md) +[**ListIncomingPhoneNumberAssignedAddOn200Response**](ListIncomingPhoneNumberAssignedAddOn200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsExtensionsApi.md b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsExtensionsApi.md index 620cb6514..dadcaf0a0 100644 --- a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsExtensionsApi.md +++ b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersAssignedAddOnsExtensionsApi.md @@ -56,7 +56,7 @@ Name | Type | Description ## ListIncomingPhoneNumberAssignedAddOnExtension -> []ApiV2010IncomingPhoneNumberAssignedAddOnExtension ListIncomingPhoneNumberAssignedAddOnExtension(ctx, ResourceSidAssignedAddOnSidoptional) +> ListIncomingPhoneNumberAssignedAddOnExtension200Response ListIncomingPhoneNumberAssignedAddOnExtension(ctx, ResourceSidAssignedAddOnSidoptional) @@ -84,7 +84,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010IncomingPhoneNumberAssignedAddOnExtension**](ApiV2010IncomingPhoneNumberAssignedAddOnExtension.md) +[**ListIncomingPhoneNumberAssignedAddOnExtension200Response**](ListIncomingPhoneNumberAssignedAddOnExtension200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersLocalApi.md b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersLocalApi.md index 5dfdd6552..d2c174c17 100644 --- a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersLocalApi.md +++ b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersLocalApi.md @@ -73,7 +73,7 @@ Name | Type | Description ## ListIncomingPhoneNumberLocal -> []ApiV2010IncomingPhoneNumberLocal ListIncomingPhoneNumberLocal(ctx, optional) +> ListIncomingPhoneNumberLocal200Response ListIncomingPhoneNumberLocal(ctx, optional) @@ -100,7 +100,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010IncomingPhoneNumberLocal**](ApiV2010IncomingPhoneNumberLocal.md) +[**ListIncomingPhoneNumberLocal200Response**](ListIncomingPhoneNumberLocal200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersMobileApi.md b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersMobileApi.md index 96c3b3556..961cd43d7 100644 --- a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersMobileApi.md +++ b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersMobileApi.md @@ -73,7 +73,7 @@ Name | Type | Description ## ListIncomingPhoneNumberMobile -> []ApiV2010IncomingPhoneNumberMobile ListIncomingPhoneNumberMobile(ctx, optional) +> ListIncomingPhoneNumberMobile200Response ListIncomingPhoneNumberMobile(ctx, optional) @@ -100,7 +100,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010IncomingPhoneNumberMobile**](ApiV2010IncomingPhoneNumberMobile.md) +[**ListIncomingPhoneNumberMobile200Response**](ListIncomingPhoneNumberMobile200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersTollFreeApi.md b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersTollFreeApi.md index 79e1afa13..ef0a495ee 100644 --- a/rest/api/v2010/docs/AccountsIncomingPhoneNumbersTollFreeApi.md +++ b/rest/api/v2010/docs/AccountsIncomingPhoneNumbersTollFreeApi.md @@ -73,7 +73,7 @@ Name | Type | Description ## ListIncomingPhoneNumberTollFree -> []ApiV2010IncomingPhoneNumberTollFree ListIncomingPhoneNumberTollFree(ctx, optional) +> ListIncomingPhoneNumberTollFree200Response ListIncomingPhoneNumberTollFree(ctx, optional) @@ -100,7 +100,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010IncomingPhoneNumberTollFree**](ApiV2010IncomingPhoneNumberTollFree.md) +[**ListIncomingPhoneNumberTollFree200Response**](ListIncomingPhoneNumberTollFree200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsKeysApi.md b/rest/api/v2010/docs/AccountsKeysApi.md index 8b98e2da1..1966a6b44 100644 --- a/rest/api/v2010/docs/AccountsKeysApi.md +++ b/rest/api/v2010/docs/AccountsKeysApi.md @@ -140,7 +140,7 @@ Name | Type | Description ## ListKey -> []ApiV2010Key ListKey(ctx, optional) +> ListKey200Response ListKey(ctx, optional) @@ -163,7 +163,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Key**](ApiV2010Key.md) +[**ListKey200Response**](ListKey200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsMessagesApi.md b/rest/api/v2010/docs/AccountsMessagesApi.md index 191dde1c4..36a54e1b2 100644 --- a/rest/api/v2010/docs/AccountsMessagesApi.md +++ b/rest/api/v2010/docs/AccountsMessagesApi.md @@ -162,7 +162,7 @@ Name | Type | Description ## ListMessage -> []ApiV2010Message ListMessage(ctx, optional) +> ListMessage200Response ListMessage(ctx, optional) @@ -183,14 +183,12 @@ Name | Type | Description **To** | **string** | Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` **From** | **string** | Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` **DateSent** | **time.Time** | Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). -**DateSentBefore** | **time.Time** | Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). -**DateSentAfter** | **time.Time** | Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. **Limit** | **int** | Max number of records to return. ### Return type -[**[]ApiV2010Message**](ApiV2010Message.md) +[**ListMessage200Response**](ListMessage200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsMessagesMediaApi.md b/rest/api/v2010/docs/AccountsMessagesMediaApi.md index 7d7d2de8b..de1f55504 100644 --- a/rest/api/v2010/docs/AccountsMessagesMediaApi.md +++ b/rest/api/v2010/docs/AccountsMessagesMediaApi.md @@ -100,7 +100,7 @@ Name | Type | Description ## ListMedia -> []ApiV2010Media ListMedia(ctx, MessageSidoptional) +> ListMedia200Response ListMedia(ctx, MessageSidoptional) @@ -130,7 +130,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Media**](ApiV2010Media.md) +[**ListMedia200Response**](ListMedia200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsNotificationsApi.md b/rest/api/v2010/docs/AccountsNotificationsApi.md index 0a39a5ba3..b22ee2a26 100644 --- a/rest/api/v2010/docs/AccountsNotificationsApi.md +++ b/rest/api/v2010/docs/AccountsNotificationsApi.md @@ -54,7 +54,7 @@ Name | Type | Description ## ListNotification -> []ApiV2010Notification ListNotification(ctx, optional) +> ListNotification200Response ListNotification(ctx, optional) @@ -81,7 +81,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Notification**](ApiV2010Notification.md) +[**ListNotification200Response**](ListNotification200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsOutgoingCallerIdsApi.md b/rest/api/v2010/docs/AccountsOutgoingCallerIdsApi.md index ca69d357c..749ef6f35 100644 --- a/rest/api/v2010/docs/AccountsOutgoingCallerIdsApi.md +++ b/rest/api/v2010/docs/AccountsOutgoingCallerIdsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListOutgoingCallerId -> []ApiV2010OutgoingCallerId ListOutgoingCallerId(ctx, optional) +> ListOutgoingCallerId200Response ListOutgoingCallerId(ctx, optional) @@ -170,7 +170,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010OutgoingCallerId**](ApiV2010OutgoingCallerId.md) +[**ListOutgoingCallerId200Response**](ListOutgoingCallerId200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsQueuesApi.md b/rest/api/v2010/docs/AccountsQueuesApi.md index fc7a295a1..94e3c5320 100644 --- a/rest/api/v2010/docs/AccountsQueuesApi.md +++ b/rest/api/v2010/docs/AccountsQueuesApi.md @@ -141,7 +141,7 @@ Name | Type | Description ## ListQueue -> []ApiV2010Queue ListQueue(ctx, optional) +> ListQueue200Response ListQueue(ctx, optional) @@ -164,7 +164,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Queue**](ApiV2010Queue.md) +[**ListQueue200Response**](ListQueue200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsQueuesMembersApi.md b/rest/api/v2010/docs/AccountsQueuesMembersApi.md index 37bbd3404..be91c4d1d 100644 --- a/rest/api/v2010/docs/AccountsQueuesMembersApi.md +++ b/rest/api/v2010/docs/AccountsQueuesMembersApi.md @@ -56,7 +56,7 @@ Name | Type | Description ## ListMember -> []ApiV2010Member ListMember(ctx, QueueSidoptional) +> ListMember200Response ListMember(ctx, QueueSidoptional) @@ -83,7 +83,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Member**](ApiV2010Member.md) +[**ListMember200Response**](ListMember200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsRecordingsAddOnResultsApi.md b/rest/api/v2010/docs/AccountsRecordingsAddOnResultsApi.md index 24a4f1b12..930c5b760 100644 --- a/rest/api/v2010/docs/AccountsRecordingsAddOnResultsApi.md +++ b/rest/api/v2010/docs/AccountsRecordingsAddOnResultsApi.md @@ -100,7 +100,7 @@ Name | Type | Description ## ListRecordingAddOnResult -> []ApiV2010RecordingAddOnResult ListRecordingAddOnResult(ctx, ReferenceSidoptional) +> ListRecordingAddOnResult200Response ListRecordingAddOnResult(ctx, ReferenceSidoptional) @@ -127,7 +127,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010RecordingAddOnResult**](ApiV2010RecordingAddOnResult.md) +[**ListRecordingAddOnResult200Response**](ListRecordingAddOnResult200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsRecordingsAddOnResultsPayloadsApi.md b/rest/api/v2010/docs/AccountsRecordingsAddOnResultsPayloadsApi.md index 37863b67d..7aecac49a 100644 --- a/rest/api/v2010/docs/AccountsRecordingsAddOnResultsPayloadsApi.md +++ b/rest/api/v2010/docs/AccountsRecordingsAddOnResultsPayloadsApi.md @@ -102,7 +102,7 @@ Name | Type | Description ## ListRecordingAddOnResultPayload -> []ApiV2010RecordingAddOnResultPayload ListRecordingAddOnResultPayload(ctx, ReferenceSidAddOnResultSidoptional) +> ListRecordingAddOnResultPayload200Response ListRecordingAddOnResultPayload(ctx, ReferenceSidAddOnResultSidoptional) @@ -130,7 +130,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010RecordingAddOnResultPayload**](ApiV2010RecordingAddOnResultPayload.md) +[**ListRecordingAddOnResultPayload200Response**](ListRecordingAddOnResultPayload200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsRecordingsApi.md b/rest/api/v2010/docs/AccountsRecordingsApi.md index 798200598..8c48531b9 100644 --- a/rest/api/v2010/docs/AccountsRecordingsApi.md +++ b/rest/api/v2010/docs/AccountsRecordingsApi.md @@ -99,7 +99,7 @@ Name | Type | Description ## ListRecording -> []ApiV2010Recording ListRecording(ctx, optional) +> ListRecording200Response ListRecording(ctx, optional) @@ -128,7 +128,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Recording**](ApiV2010Recording.md) +[**ListRecording200Response**](ListRecording200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsRecordingsTranscriptionsApi.md b/rest/api/v2010/docs/AccountsRecordingsTranscriptionsApi.md index 1dd9ae9fb..9fee5ee28 100644 --- a/rest/api/v2010/docs/AccountsRecordingsTranscriptionsApi.md +++ b/rest/api/v2010/docs/AccountsRecordingsTranscriptionsApi.md @@ -100,7 +100,7 @@ Name | Type | Description ## ListRecordingTranscription -> []ApiV2010RecordingTranscription ListRecordingTranscription(ctx, RecordingSidoptional) +> ListRecordingTranscription200Response ListRecordingTranscription(ctx, RecordingSidoptional) @@ -127,7 +127,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010RecordingTranscription**](ApiV2010RecordingTranscription.md) +[**ListRecordingTranscription200Response**](ListRecordingTranscription200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPCredentialListsApi.md b/rest/api/v2010/docs/AccountsSIPCredentialListsApi.md index 59c774284..01dddd3fa 100644 --- a/rest/api/v2010/docs/AccountsSIPCredentialListsApi.md +++ b/rest/api/v2010/docs/AccountsSIPCredentialListsApi.md @@ -140,7 +140,7 @@ Name | Type | Description ## ListSipCredentialList -> []ApiV2010SipCredentialList ListSipCredentialList(ctx, optional) +> ListSipCredentialList200Response ListSipCredentialList(ctx, optional) @@ -163,7 +163,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipCredentialList**](ApiV2010SipCredentialList.md) +[**ListSipCredentialList200Response**](ListSipCredentialList200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPCredentialListsCredentialsApi.md b/rest/api/v2010/docs/AccountsSIPCredentialListsCredentialsApi.md index 91949a937..b4e92329b 100644 --- a/rest/api/v2010/docs/AccountsSIPCredentialListsCredentialsApi.md +++ b/rest/api/v2010/docs/AccountsSIPCredentialListsCredentialsApi.md @@ -147,7 +147,7 @@ Name | Type | Description ## ListSipCredential -> []ApiV2010SipCredential ListSipCredential(ctx, CredentialListSidoptional) +> ListSipCredential200Response ListSipCredential(ctx, CredentialListSidoptional) @@ -174,7 +174,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipCredential**](ApiV2010SipCredential.md) +[**ListSipCredential200Response**](ListSipCredential200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPDomainsApi.md b/rest/api/v2010/docs/AccountsSIPDomainsApi.md index 66f965ad9..5613d95de 100644 --- a/rest/api/v2010/docs/AccountsSIPDomainsApi.md +++ b/rest/api/v2010/docs/AccountsSIPDomainsApi.md @@ -152,7 +152,7 @@ Name | Type | Description ## ListSipDomain -> []ApiV2010SipDomain ListSipDomain(ctx, optional) +> ListSipDomain200Response ListSipDomain(ctx, optional) @@ -175,7 +175,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipDomain**](ApiV2010SipDomain.md) +[**ListSipDomain200Response**](ListSipDomain200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsCredentialListMappingsApi.md b/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsCredentialListMappingsApi.md index 55416b95e..f2a30e4ff 100644 --- a/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsCredentialListMappingsApi.md +++ b/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsCredentialListMappingsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListSipAuthCallsCredentialListMapping -> []ApiV2010SipAuthCallsCredentialListMapping ListSipAuthCallsCredentialListMapping(ctx, DomainSidoptional) +> ListSipAuthCallsCredentialListMapping200Response ListSipAuthCallsCredentialListMapping(ctx, DomainSidoptional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipAuthCallsCredentialListMapping**](ApiV2010SipAuthCallsCredentialListMapping.md) +[**ListSipAuthCallsCredentialListMapping200Response**](ListSipAuthCallsCredentialListMapping200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsIpAccessControlListMappingsApi.md b/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsIpAccessControlListMappingsApi.md index 7d67f8095..3da5ef302 100644 --- a/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsIpAccessControlListMappingsApi.md +++ b/rest/api/v2010/docs/AccountsSIPDomainsAuthCallsIpAccessControlListMappingsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListSipAuthCallsIpAccessControlListMapping -> []ApiV2010SipAuthCallsIpAccessControlListMapping ListSipAuthCallsIpAccessControlListMapping(ctx, DomainSidoptional) +> ListSipAuthCallsIpAccessControlListMapping200Response ListSipAuthCallsIpAccessControlListMapping(ctx, DomainSidoptional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipAuthCallsIpAccessControlListMapping**](ApiV2010SipAuthCallsIpAccessControlListMapping.md) +[**ListSipAuthCallsIpAccessControlListMapping200Response**](ListSipAuthCallsIpAccessControlListMapping200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPDomainsAuthRegistrationsCredentialListMappingsApi.md b/rest/api/v2010/docs/AccountsSIPDomainsAuthRegistrationsCredentialListMappingsApi.md index 920aedcba..9487a8856 100644 --- a/rest/api/v2010/docs/AccountsSIPDomainsAuthRegistrationsCredentialListMappingsApi.md +++ b/rest/api/v2010/docs/AccountsSIPDomainsAuthRegistrationsCredentialListMappingsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListSipAuthRegistrationsCredentialListMapping -> []ApiV2010SipAuthRegistrationsCredentialListMapping ListSipAuthRegistrationsCredentialListMapping(ctx, DomainSidoptional) +> ListSipAuthRegistrationsCredentialListMapping200Response ListSipAuthRegistrationsCredentialListMapping(ctx, DomainSidoptional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipAuthRegistrationsCredentialListMapping**](ApiV2010SipAuthRegistrationsCredentialListMapping.md) +[**ListSipAuthRegistrationsCredentialListMapping200Response**](ListSipAuthRegistrationsCredentialListMapping200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPDomainsCredentialListMappingsApi.md b/rest/api/v2010/docs/AccountsSIPDomainsCredentialListMappingsApi.md index 9c364347c..eb352593b 100644 --- a/rest/api/v2010/docs/AccountsSIPDomainsCredentialListMappingsApi.md +++ b/rest/api/v2010/docs/AccountsSIPDomainsCredentialListMappingsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListSipCredentialListMapping -> []ApiV2010SipCredentialListMapping ListSipCredentialListMapping(ctx, DomainSidoptional) +> ListSipCredentialListMapping200Response ListSipCredentialListMapping(ctx, DomainSidoptional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipCredentialListMapping**](ApiV2010SipCredentialListMapping.md) +[**ListSipCredentialListMapping200Response**](ListSipCredentialListMapping200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPDomainsIpAccessControlListMappingsApi.md b/rest/api/v2010/docs/AccountsSIPDomainsIpAccessControlListMappingsApi.md index 365e43198..409f90db5 100644 --- a/rest/api/v2010/docs/AccountsSIPDomainsIpAccessControlListMappingsApi.md +++ b/rest/api/v2010/docs/AccountsSIPDomainsIpAccessControlListMappingsApi.md @@ -145,7 +145,7 @@ Name | Type | Description ## ListSipIpAccessControlListMapping -> []ApiV2010SipIpAccessControlListMapping ListSipIpAccessControlListMapping(ctx, DomainSidoptional) +> ListSipIpAccessControlListMapping200Response ListSipIpAccessControlListMapping(ctx, DomainSidoptional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipIpAccessControlListMapping**](ApiV2010SipIpAccessControlListMapping.md) +[**ListSipIpAccessControlListMapping200Response**](ListSipIpAccessControlListMapping200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPIpAccessControlListsApi.md b/rest/api/v2010/docs/AccountsSIPIpAccessControlListsApi.md index c459fa8f8..ba4e83ffc 100644 --- a/rest/api/v2010/docs/AccountsSIPIpAccessControlListsApi.md +++ b/rest/api/v2010/docs/AccountsSIPIpAccessControlListsApi.md @@ -140,7 +140,7 @@ Name | Type | Description ## ListSipIpAccessControlList -> []ApiV2010SipIpAccessControlList ListSipIpAccessControlList(ctx, optional) +> ListSipIpAccessControlList200Response ListSipIpAccessControlList(ctx, optional) @@ -163,7 +163,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipIpAccessControlList**](ApiV2010SipIpAccessControlList.md) +[**ListSipIpAccessControlList200Response**](ListSipIpAccessControlList200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSIPIpAccessControlListsIpAddressesApi.md b/rest/api/v2010/docs/AccountsSIPIpAccessControlListsIpAddressesApi.md index d1f54c11d..e1e751ffb 100644 --- a/rest/api/v2010/docs/AccountsSIPIpAccessControlListsIpAddressesApi.md +++ b/rest/api/v2010/docs/AccountsSIPIpAccessControlListsIpAddressesApi.md @@ -148,7 +148,7 @@ Name | Type | Description ## ListSipIpAddress -> []ApiV2010SipIpAddress ListSipIpAddress(ctx, IpAccessControlListSidoptional) +> ListSipIpAddress200Response ListSipIpAddress(ctx, IpAccessControlListSidoptional) @@ -175,7 +175,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SipIpAddress**](ApiV2010SipIpAddress.md) +[**ListSipIpAddress200Response**](ListSipIpAddress200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSMSShortCodesApi.md b/rest/api/v2010/docs/AccountsSMSShortCodesApi.md index 0596a623e..72e9b4270 100644 --- a/rest/api/v2010/docs/AccountsSMSShortCodesApi.md +++ b/rest/api/v2010/docs/AccountsSMSShortCodesApi.md @@ -55,7 +55,7 @@ Name | Type | Description ## ListShortCode -> []ApiV2010ShortCode ListShortCode(ctx, optional) +> ListShortCode200Response ListShortCode(ctx, optional) @@ -80,7 +80,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010ShortCode**](ApiV2010ShortCode.md) +[**ListShortCode200Response**](ListShortCode200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsSigningKeysApi.md b/rest/api/v2010/docs/AccountsSigningKeysApi.md index 75305fde5..db2b43abe 100644 --- a/rest/api/v2010/docs/AccountsSigningKeysApi.md +++ b/rest/api/v2010/docs/AccountsSigningKeysApi.md @@ -140,7 +140,7 @@ Name | Type | Description ## ListSigningKey -> []ApiV2010SigningKey ListSigningKey(ctx, optional) +> ListSigningKey200Response ListSigningKey(ctx, optional) @@ -163,7 +163,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010SigningKey**](ApiV2010SigningKey.md) +[**ListSigningKey200Response**](ListSigningKey200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsTranscriptionsApi.md b/rest/api/v2010/docs/AccountsTranscriptionsApi.md index 838691a89..292fb9378 100644 --- a/rest/api/v2010/docs/AccountsTranscriptionsApi.md +++ b/rest/api/v2010/docs/AccountsTranscriptionsApi.md @@ -98,7 +98,7 @@ Name | Type | Description ## ListTranscription -> []ApiV2010Transcription ListTranscription(ctx, optional) +> ListTranscription200Response ListTranscription(ctx, optional) @@ -121,7 +121,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010Transcription**](ApiV2010Transcription.md) +[**ListTranscription200Response**](ListTranscription200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsAllTimeApi.md b/rest/api/v2010/docs/AccountsUsageRecordsAllTimeApi.md index fcbcb4ac7..0b2fef968 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsAllTimeApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsAllTimeApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordAllTime -> []ApiV2010UsageRecordAllTime ListUsageRecordAllTime(ctx, optional) +> ListUsageRecordAllTime200Response ListUsageRecordAllTime(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordAllTime**](ApiV2010UsageRecordAllTime.md) +[**ListUsageRecordAllTime200Response**](ListUsageRecordAllTime200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsApi.md b/rest/api/v2010/docs/AccountsUsageRecordsApi.md index c10d85f06..1ee31bb34 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecord -> []ApiV2010UsageRecord ListUsageRecord(ctx, optional) +> ListUsageRecord200Response ListUsageRecord(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecord**](ApiV2010UsageRecord.md) +[**ListUsageRecord200Response**](ListUsageRecord200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsDailyApi.md b/rest/api/v2010/docs/AccountsUsageRecordsDailyApi.md index 7e8259c8e..f64f87ad5 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsDailyApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsDailyApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordDaily -> []ApiV2010UsageRecordDaily ListUsageRecordDaily(ctx, optional) +> ListUsageRecordDaily200Response ListUsageRecordDaily(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordDaily**](ApiV2010UsageRecordDaily.md) +[**ListUsageRecordDaily200Response**](ListUsageRecordDaily200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsLastMonthApi.md b/rest/api/v2010/docs/AccountsUsageRecordsLastMonthApi.md index 548700f54..0b151e7e8 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsLastMonthApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsLastMonthApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordLastMonth -> []ApiV2010UsageRecordLastMonth ListUsageRecordLastMonth(ctx, optional) +> ListUsageRecordLastMonth200Response ListUsageRecordLastMonth(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordLastMonth**](ApiV2010UsageRecordLastMonth.md) +[**ListUsageRecordLastMonth200Response**](ListUsageRecordLastMonth200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsMonthlyApi.md b/rest/api/v2010/docs/AccountsUsageRecordsMonthlyApi.md index c92eace99..343dc5787 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsMonthlyApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsMonthlyApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordMonthly -> []ApiV2010UsageRecordMonthly ListUsageRecordMonthly(ctx, optional) +> ListUsageRecordMonthly200Response ListUsageRecordMonthly(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordMonthly**](ApiV2010UsageRecordMonthly.md) +[**ListUsageRecordMonthly200Response**](ListUsageRecordMonthly200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsThisMonthApi.md b/rest/api/v2010/docs/AccountsUsageRecordsThisMonthApi.md index d965c7d42..90c9e701f 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsThisMonthApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsThisMonthApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordThisMonth -> []ApiV2010UsageRecordThisMonth ListUsageRecordThisMonth(ctx, optional) +> ListUsageRecordThisMonth200Response ListUsageRecordThisMonth(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordThisMonth**](ApiV2010UsageRecordThisMonth.md) +[**ListUsageRecordThisMonth200Response**](ListUsageRecordThisMonth200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsTodayApi.md b/rest/api/v2010/docs/AccountsUsageRecordsTodayApi.md index 03a80f06a..71be11e10 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsTodayApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsTodayApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordToday -> []ApiV2010UsageRecordToday ListUsageRecordToday(ctx, optional) +> ListUsageRecordToday200Response ListUsageRecordToday(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordToday**](ApiV2010UsageRecordToday.md) +[**ListUsageRecordToday200Response**](ListUsageRecordToday200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsYearlyApi.md b/rest/api/v2010/docs/AccountsUsageRecordsYearlyApi.md index 32e3e41c7..8957c124c 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsYearlyApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsYearlyApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordYearly -> []ApiV2010UsageRecordYearly ListUsageRecordYearly(ctx, optional) +> ListUsageRecordYearly200Response ListUsageRecordYearly(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordYearly**](ApiV2010UsageRecordYearly.md) +[**ListUsageRecordYearly200Response**](ListUsageRecordYearly200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageRecordsYesterdayApi.md b/rest/api/v2010/docs/AccountsUsageRecordsYesterdayApi.md index a02c62c00..104666667 100644 --- a/rest/api/v2010/docs/AccountsUsageRecordsYesterdayApi.md +++ b/rest/api/v2010/docs/AccountsUsageRecordsYesterdayApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## ListUsageRecordYesterday -> []ApiV2010UsageRecordYesterday ListUsageRecordYesterday(ctx, optional) +> ListUsageRecordYesterday200Response ListUsageRecordYesterday(ctx, optional) @@ -37,7 +37,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageRecordYesterday**](ApiV2010UsageRecordYesterday.md) +[**ListUsageRecordYesterday200Response**](ListUsageRecordYesterday200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/AccountsUsageTriggersApi.md b/rest/api/v2010/docs/AccountsUsageTriggersApi.md index 765bfda21..c93c97d8d 100644 --- a/rest/api/v2010/docs/AccountsUsageTriggersApi.md +++ b/rest/api/v2010/docs/AccountsUsageTriggersApi.md @@ -146,7 +146,7 @@ Name | Type | Description ## ListUsageTrigger -> []ApiV2010UsageTrigger ListUsageTrigger(ctx, optional) +> ListUsageTrigger200Response ListUsageTrigger(ctx, optional) @@ -172,7 +172,7 @@ Name | Type | Description ### Return type -[**[]ApiV2010UsageTrigger**](ApiV2010UsageTrigger.md) +[**ListUsageTrigger200Response**](ListUsageTrigger200Response.md) ### Authorization diff --git a/rest/api/v2010/docs/ListAccountResponse.md b/rest/api/v2010/docs/ListAccountResponse.md index 8583afac0..e6a3c8e00 100644 --- a/rest/api/v2010/docs/ListAccountResponse.md +++ b/rest/api/v2010/docs/ListAccountResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Accounts** | [**[]ApiV2010Account**](ApiV2010Account.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAddressResponse.md b/rest/api/v2010/docs/ListAddressResponse.md index ba1f9c76d..8ce768b2a 100644 --- a/rest/api/v2010/docs/ListAddressResponse.md +++ b/rest/api/v2010/docs/ListAddressResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Addresses** | [**[]ApiV2010Address**](ApiV2010Address.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListApplicationResponse.md b/rest/api/v2010/docs/ListApplicationResponse.md index 5b79ec971..2bb189484 100644 --- a/rest/api/v2010/docs/ListApplicationResponse.md +++ b/rest/api/v2010/docs/ListApplicationResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Applications** | [**[]ApiV2010Application**](ApiV2010Application.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAuthorizedConnectAppResponse.md b/rest/api/v2010/docs/ListAuthorizedConnectAppResponse.md index cd10fe821..c5fb00bbb 100644 --- a/rest/api/v2010/docs/ListAuthorizedConnectAppResponse.md +++ b/rest/api/v2010/docs/ListAuthorizedConnectAppResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AuthorizedConnectApps** | [**[]ApiV2010AuthorizedConnectApp**](ApiV2010AuthorizedConnectApp.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberCountryResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberCountryResponse.md index e4c88661e..a59c857bd 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberCountryResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberCountryResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Countries** | [**[]ApiV2010AvailablePhoneNumberCountry**](ApiV2010AvailablePhoneNumberCountry.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberLocalResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberLocalResponse.md index dd1c41695..205e18881 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberLocalResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberLocalResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberLocal**](ApiV2010AvailablePhoneNumberLocal.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberMachineToMachineResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberMachineToMachineResponse.md index 64b39d024..57e9aaec6 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberMachineToMachineResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberMachineToMachineResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberMachineToMachine**](ApiV2010AvailablePhoneNumberMachineToMachine.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberMobileResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberMobileResponse.md index 5a186753a..aac528f74 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberMobileResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberMobileResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberMobile**](ApiV2010AvailablePhoneNumberMobile.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberNationalResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberNationalResponse.md index 6843e6cdf..da7940cc6 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberNationalResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberNationalResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberNational**](ApiV2010AvailablePhoneNumberNational.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberSharedCostResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberSharedCostResponse.md index 9e7c1e540..d478f1678 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberSharedCostResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberSharedCostResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberSharedCost**](ApiV2010AvailablePhoneNumberSharedCost.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberTollFreeResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberTollFreeResponse.md index f3b5babda..56e9d5c17 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberTollFreeResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberTollFreeResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberTollFree**](ApiV2010AvailablePhoneNumberTollFree.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListAvailablePhoneNumberVoipResponse.md b/rest/api/v2010/docs/ListAvailablePhoneNumberVoipResponse.md index c91b53f8e..5ffd2b60b 100644 --- a/rest/api/v2010/docs/ListAvailablePhoneNumberVoipResponse.md +++ b/rest/api/v2010/docs/ListAvailablePhoneNumberVoipResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AvailablePhoneNumbers** | [**[]ApiV2010AvailablePhoneNumberVoip**](ApiV2010AvailablePhoneNumberVoip.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListCallEventResponse.md b/rest/api/v2010/docs/ListCallEventResponse.md index 9e1911973..793e6ed97 100644 --- a/rest/api/v2010/docs/ListCallEventResponse.md +++ b/rest/api/v2010/docs/ListCallEventResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Events** | [**[]ApiV2010CallEvent**](ApiV2010CallEvent.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListCallNotificationResponse.md b/rest/api/v2010/docs/ListCallNotificationResponse.md index 1b1cdf266..87efec158 100644 --- a/rest/api/v2010/docs/ListCallNotificationResponse.md +++ b/rest/api/v2010/docs/ListCallNotificationResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Notifications** | [**[]ApiV2010CallNotification**](ApiV2010CallNotification.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListCallRecordingResponse.md b/rest/api/v2010/docs/ListCallRecordingResponse.md index a0db218d3..615ba5b39 100644 --- a/rest/api/v2010/docs/ListCallRecordingResponse.md +++ b/rest/api/v2010/docs/ListCallRecordingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Recordings** | [**[]ApiV2010CallRecording**](ApiV2010CallRecording.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListCallResponse.md b/rest/api/v2010/docs/ListCallResponse.md index 9f346bc47..a917dd8e4 100644 --- a/rest/api/v2010/docs/ListCallResponse.md +++ b/rest/api/v2010/docs/ListCallResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Calls** | [**[]ApiV2010Call**](ApiV2010Call.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListConferenceRecordingResponse.md b/rest/api/v2010/docs/ListConferenceRecordingResponse.md index afb481967..b770d73de 100644 --- a/rest/api/v2010/docs/ListConferenceRecordingResponse.md +++ b/rest/api/v2010/docs/ListConferenceRecordingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Recordings** | [**[]ApiV2010ConferenceRecording**](ApiV2010ConferenceRecording.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListConferenceResponse.md b/rest/api/v2010/docs/ListConferenceResponse.md index b4072c544..27af5be73 100644 --- a/rest/api/v2010/docs/ListConferenceResponse.md +++ b/rest/api/v2010/docs/ListConferenceResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Conferences** | [**[]ApiV2010Conference**](ApiV2010Conference.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListConnectAppResponse.md b/rest/api/v2010/docs/ListConnectAppResponse.md index 5cc1f66e5..b6f04bb19 100644 --- a/rest/api/v2010/docs/ListConnectAppResponse.md +++ b/rest/api/v2010/docs/ListConnectAppResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ConnectApps** | [**[]ApiV2010ConnectApp**](ApiV2010ConnectApp.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListDependentPhoneNumberResponse.md b/rest/api/v2010/docs/ListDependentPhoneNumberResponse.md index d2685e0c6..111ef25c9 100644 --- a/rest/api/v2010/docs/ListDependentPhoneNumberResponse.md +++ b/rest/api/v2010/docs/ListDependentPhoneNumberResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **DependentPhoneNumbers** | [**[]ApiV2010DependentPhoneNumber**](ApiV2010DependentPhoneNumber.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnExtensionResponse.md b/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnExtensionResponse.md index 599e88c54..6c801e56a 100644 --- a/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnExtensionResponse.md +++ b/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnExtensionResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Extensions** | [**[]ApiV2010IncomingPhoneNumberAssignedAddOnExtension**](ApiV2010IncomingPhoneNumberAssignedAddOnExtension.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnResponse.md b/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnResponse.md index 941ec5a40..3c837a67c 100644 --- a/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnResponse.md +++ b/rest/api/v2010/docs/ListIncomingPhoneNumberAssignedAddOnResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AssignedAddOns** | [**[]ApiV2010IncomingPhoneNumberAssignedAddOn**](ApiV2010IncomingPhoneNumberAssignedAddOn.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListIncomingPhoneNumberLocalResponse.md b/rest/api/v2010/docs/ListIncomingPhoneNumberLocalResponse.md index c61aa508c..b99c4929f 100644 --- a/rest/api/v2010/docs/ListIncomingPhoneNumberLocalResponse.md +++ b/rest/api/v2010/docs/ListIncomingPhoneNumberLocalResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IncomingPhoneNumbers** | [**[]ApiV2010IncomingPhoneNumberLocal**](ApiV2010IncomingPhoneNumberLocal.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListIncomingPhoneNumberMobileResponse.md b/rest/api/v2010/docs/ListIncomingPhoneNumberMobileResponse.md index 656059bf1..05139c706 100644 --- a/rest/api/v2010/docs/ListIncomingPhoneNumberMobileResponse.md +++ b/rest/api/v2010/docs/ListIncomingPhoneNumberMobileResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IncomingPhoneNumbers** | [**[]ApiV2010IncomingPhoneNumberMobile**](ApiV2010IncomingPhoneNumberMobile.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListIncomingPhoneNumberResponse.md b/rest/api/v2010/docs/ListIncomingPhoneNumberResponse.md index 55ff62dc5..f121b0ddc 100644 --- a/rest/api/v2010/docs/ListIncomingPhoneNumberResponse.md +++ b/rest/api/v2010/docs/ListIncomingPhoneNumberResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IncomingPhoneNumbers** | [**[]ApiV2010IncomingPhoneNumber**](ApiV2010IncomingPhoneNumber.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListIncomingPhoneNumberTollFreeResponse.md b/rest/api/v2010/docs/ListIncomingPhoneNumberTollFreeResponse.md index 7aac66dab..3d4cc587d 100644 --- a/rest/api/v2010/docs/ListIncomingPhoneNumberTollFreeResponse.md +++ b/rest/api/v2010/docs/ListIncomingPhoneNumberTollFreeResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IncomingPhoneNumbers** | [**[]ApiV2010IncomingPhoneNumberTollFree**](ApiV2010IncomingPhoneNumberTollFree.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListKeyResponse.md b/rest/api/v2010/docs/ListKeyResponse.md index dadacd46e..ec9d7e138 100644 --- a/rest/api/v2010/docs/ListKeyResponse.md +++ b/rest/api/v2010/docs/ListKeyResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Keys** | [**[]ApiV2010Key**](ApiV2010Key.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListMediaResponse.md b/rest/api/v2010/docs/ListMediaResponse.md index c639f1c2e..2304bf156 100644 --- a/rest/api/v2010/docs/ListMediaResponse.md +++ b/rest/api/v2010/docs/ListMediaResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MediaList** | [**[]ApiV2010Media**](ApiV2010Media.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListMemberResponse.md b/rest/api/v2010/docs/ListMemberResponse.md index f852d57c0..e6940c29d 100644 --- a/rest/api/v2010/docs/ListMemberResponse.md +++ b/rest/api/v2010/docs/ListMemberResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **QueueMembers** | [**[]ApiV2010Member**](ApiV2010Member.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListMessageResponse.md b/rest/api/v2010/docs/ListMessageResponse.md index 4509b98ae..3661913c8 100644 --- a/rest/api/v2010/docs/ListMessageResponse.md +++ b/rest/api/v2010/docs/ListMessageResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Messages** | [**[]ApiV2010Message**](ApiV2010Message.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListNotificationResponse.md b/rest/api/v2010/docs/ListNotificationResponse.md index e1fa75b9a..fb9ff98c6 100644 --- a/rest/api/v2010/docs/ListNotificationResponse.md +++ b/rest/api/v2010/docs/ListNotificationResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Notifications** | [**[]ApiV2010Notification**](ApiV2010Notification.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListOutgoingCallerIdResponse.md b/rest/api/v2010/docs/ListOutgoingCallerIdResponse.md index 23197daf6..cdd919a4b 100644 --- a/rest/api/v2010/docs/ListOutgoingCallerIdResponse.md +++ b/rest/api/v2010/docs/ListOutgoingCallerIdResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **OutgoingCallerIds** | [**[]ApiV2010OutgoingCallerId**](ApiV2010OutgoingCallerId.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListParticipantResponse.md b/rest/api/v2010/docs/ListParticipantResponse.md index 66c4f739d..97008441c 100644 --- a/rest/api/v2010/docs/ListParticipantResponse.md +++ b/rest/api/v2010/docs/ListParticipantResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Participants** | [**[]ApiV2010Participant**](ApiV2010Participant.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListQueueResponse.md b/rest/api/v2010/docs/ListQueueResponse.md index 7ef1364a8..85a3e4780 100644 --- a/rest/api/v2010/docs/ListQueueResponse.md +++ b/rest/api/v2010/docs/ListQueueResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Queues** | [**[]ApiV2010Queue**](ApiV2010Queue.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListRecordingAddOnResultPayloadResponse.md b/rest/api/v2010/docs/ListRecordingAddOnResultPayloadResponse.md index 567d1c870..5a72717bf 100644 --- a/rest/api/v2010/docs/ListRecordingAddOnResultPayloadResponse.md +++ b/rest/api/v2010/docs/ListRecordingAddOnResultPayloadResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Payloads** | [**[]ApiV2010RecordingAddOnResultPayload**](ApiV2010RecordingAddOnResultPayload.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListRecordingAddOnResultResponse.md b/rest/api/v2010/docs/ListRecordingAddOnResultResponse.md index 4a90f6eea..67341e14f 100644 --- a/rest/api/v2010/docs/ListRecordingAddOnResultResponse.md +++ b/rest/api/v2010/docs/ListRecordingAddOnResultResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AddOnResults** | [**[]ApiV2010RecordingAddOnResult**](ApiV2010RecordingAddOnResult.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListRecordingResponse.md b/rest/api/v2010/docs/ListRecordingResponse.md index 75121fbae..260ed3f81 100644 --- a/rest/api/v2010/docs/ListRecordingResponse.md +++ b/rest/api/v2010/docs/ListRecordingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Recordings** | [**[]ApiV2010Recording**](ApiV2010Recording.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListRecordingTranscriptionResponse.md b/rest/api/v2010/docs/ListRecordingTranscriptionResponse.md index 9c30747bc..63bd727a4 100644 --- a/rest/api/v2010/docs/ListRecordingTranscriptionResponse.md +++ b/rest/api/v2010/docs/ListRecordingTranscriptionResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Transcriptions** | [**[]ApiV2010RecordingTranscription**](ApiV2010RecordingTranscription.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListShortCodeResponse.md b/rest/api/v2010/docs/ListShortCodeResponse.md index 99b0ea7e9..dd7d8b7c3 100644 --- a/rest/api/v2010/docs/ListShortCodeResponse.md +++ b/rest/api/v2010/docs/ListShortCodeResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ShortCodes** | [**[]ApiV2010ShortCode**](ApiV2010ShortCode.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSigningKeyResponse.md b/rest/api/v2010/docs/ListSigningKeyResponse.md index 9aaed2ac3..c3f98c7d2 100644 --- a/rest/api/v2010/docs/ListSigningKeyResponse.md +++ b/rest/api/v2010/docs/ListSigningKeyResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SigningKeys** | [**[]ApiV2010SigningKey**](ApiV2010SigningKey.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipAuthCallsCredentialListMappingResponse.md b/rest/api/v2010/docs/ListSipAuthCallsCredentialListMappingResponse.md index 52af20198..6bd9d82c8 100644 --- a/rest/api/v2010/docs/ListSipAuthCallsCredentialListMappingResponse.md +++ b/rest/api/v2010/docs/ListSipAuthCallsCredentialListMappingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Contents** | [**[]ApiV2010SipAuthCallsCredentialListMapping**](ApiV2010SipAuthCallsCredentialListMapping.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipAuthCallsIpAccessControlListMappingResponse.md b/rest/api/v2010/docs/ListSipAuthCallsIpAccessControlListMappingResponse.md index 04901fec1..3ce1a2001 100644 --- a/rest/api/v2010/docs/ListSipAuthCallsIpAccessControlListMappingResponse.md +++ b/rest/api/v2010/docs/ListSipAuthCallsIpAccessControlListMappingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Contents** | [**[]ApiV2010SipAuthCallsIpAccessControlListMapping**](ApiV2010SipAuthCallsIpAccessControlListMapping.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipAuthRegistrationsCredentialListMappingResponse.md b/rest/api/v2010/docs/ListSipAuthRegistrationsCredentialListMappingResponse.md index cd3ba7923..3b666dba7 100644 --- a/rest/api/v2010/docs/ListSipAuthRegistrationsCredentialListMappingResponse.md +++ b/rest/api/v2010/docs/ListSipAuthRegistrationsCredentialListMappingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Contents** | [**[]ApiV2010SipAuthRegistrationsCredentialListMapping**](ApiV2010SipAuthRegistrationsCredentialListMapping.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipCredentialListMappingResponse.md b/rest/api/v2010/docs/ListSipCredentialListMappingResponse.md index 1b1054f75..ee4d3834a 100644 --- a/rest/api/v2010/docs/ListSipCredentialListMappingResponse.md +++ b/rest/api/v2010/docs/ListSipCredentialListMappingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **CredentialListMappings** | [**[]ApiV2010SipCredentialListMapping**](ApiV2010SipCredentialListMapping.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipCredentialListResponse.md b/rest/api/v2010/docs/ListSipCredentialListResponse.md index 73fde3257..3fffc9f82 100644 --- a/rest/api/v2010/docs/ListSipCredentialListResponse.md +++ b/rest/api/v2010/docs/ListSipCredentialListResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **CredentialLists** | [**[]ApiV2010SipCredentialList**](ApiV2010SipCredentialList.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipCredentialResponse.md b/rest/api/v2010/docs/ListSipCredentialResponse.md index cc6116732..e33491550 100644 --- a/rest/api/v2010/docs/ListSipCredentialResponse.md +++ b/rest/api/v2010/docs/ListSipCredentialResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Credentials** | [**[]ApiV2010SipCredential**](ApiV2010SipCredential.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipDomainResponse.md b/rest/api/v2010/docs/ListSipDomainResponse.md index 0a136c0e3..b190ef19b 100644 --- a/rest/api/v2010/docs/ListSipDomainResponse.md +++ b/rest/api/v2010/docs/ListSipDomainResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Domains** | [**[]ApiV2010SipDomain**](ApiV2010SipDomain.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipIpAccessControlListMappingResponse.md b/rest/api/v2010/docs/ListSipIpAccessControlListMappingResponse.md index 5110f4680..9a80f3cf2 100644 --- a/rest/api/v2010/docs/ListSipIpAccessControlListMappingResponse.md +++ b/rest/api/v2010/docs/ListSipIpAccessControlListMappingResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IpAccessControlListMappings** | [**[]ApiV2010SipIpAccessControlListMapping**](ApiV2010SipIpAccessControlListMapping.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipIpAccessControlListResponse.md b/rest/api/v2010/docs/ListSipIpAccessControlListResponse.md index 3d86a4003..15f958cc9 100644 --- a/rest/api/v2010/docs/ListSipIpAccessControlListResponse.md +++ b/rest/api/v2010/docs/ListSipIpAccessControlListResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IpAccessControlLists** | [**[]ApiV2010SipIpAccessControlList**](ApiV2010SipIpAccessControlList.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListSipIpAddressResponse.md b/rest/api/v2010/docs/ListSipIpAddressResponse.md index 888b3ffb2..b2cc77bcc 100644 --- a/rest/api/v2010/docs/ListSipIpAddressResponse.md +++ b/rest/api/v2010/docs/ListSipIpAddressResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **IpAddresses** | [**[]ApiV2010SipIpAddress**](ApiV2010SipIpAddress.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListTranscriptionResponse.md b/rest/api/v2010/docs/ListTranscriptionResponse.md index ef3673ed0..0372e9ab2 100644 --- a/rest/api/v2010/docs/ListTranscriptionResponse.md +++ b/rest/api/v2010/docs/ListTranscriptionResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Transcriptions** | [**[]ApiV2010Transcription**](ApiV2010Transcription.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordAllTimeResponse.md b/rest/api/v2010/docs/ListUsageRecordAllTimeResponse.md index e45b9b66b..442428c0b 100644 --- a/rest/api/v2010/docs/ListUsageRecordAllTimeResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordAllTimeResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordAllTime**](ApiV2010UsageRecordAllTime.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordDailyResponse.md b/rest/api/v2010/docs/ListUsageRecordDailyResponse.md index 8e6530b49..b6ededb47 100644 --- a/rest/api/v2010/docs/ListUsageRecordDailyResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordDailyResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordDaily**](ApiV2010UsageRecordDaily.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordLastMonthResponse.md b/rest/api/v2010/docs/ListUsageRecordLastMonthResponse.md index 024bdf1c7..ecf09a90b 100644 --- a/rest/api/v2010/docs/ListUsageRecordLastMonthResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordLastMonthResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordLastMonth**](ApiV2010UsageRecordLastMonth.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordMonthlyResponse.md b/rest/api/v2010/docs/ListUsageRecordMonthlyResponse.md index 65159f022..129a7b527 100644 --- a/rest/api/v2010/docs/ListUsageRecordMonthlyResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordMonthlyResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordMonthly**](ApiV2010UsageRecordMonthly.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordResponse.md b/rest/api/v2010/docs/ListUsageRecordResponse.md index 47acd196b..c9ca61377 100644 --- a/rest/api/v2010/docs/ListUsageRecordResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecord**](ApiV2010UsageRecord.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordThisMonthResponse.md b/rest/api/v2010/docs/ListUsageRecordThisMonthResponse.md index 777690251..9434eb160 100644 --- a/rest/api/v2010/docs/ListUsageRecordThisMonthResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordThisMonthResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordThisMonth**](ApiV2010UsageRecordThisMonth.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordTodayResponse.md b/rest/api/v2010/docs/ListUsageRecordTodayResponse.md index 3e7280643..94c939cc9 100644 --- a/rest/api/v2010/docs/ListUsageRecordTodayResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordTodayResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordToday**](ApiV2010UsageRecordToday.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordYearlyResponse.md b/rest/api/v2010/docs/ListUsageRecordYearlyResponse.md index 512165e7e..7baf3c32a 100644 --- a/rest/api/v2010/docs/ListUsageRecordYearlyResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordYearlyResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordYearly**](ApiV2010UsageRecordYearly.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageRecordYesterdayResponse.md b/rest/api/v2010/docs/ListUsageRecordYesterdayResponse.md index f148b91aa..a1905cdaf 100644 --- a/rest/api/v2010/docs/ListUsageRecordYesterdayResponse.md +++ b/rest/api/v2010/docs/ListUsageRecordYesterdayResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageRecords** | [**[]ApiV2010UsageRecordYesterday**](ApiV2010UsageRecordYesterday.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/docs/ListUsageTriggerResponse.md b/rest/api/v2010/docs/ListUsageTriggerResponse.md index 105a935fe..ad8d36f60 100644 --- a/rest/api/v2010/docs/ListUsageTriggerResponse.md +++ b/rest/api/v2010/docs/ListUsageTriggerResponse.md @@ -5,14 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **UsageTriggers** | [**[]ApiV2010UsageTrigger**](ApiV2010UsageTrigger.md) | |[optional] -**End** | **int** | |[optional] -**FirstPageUri** | **string** | |[optional] -**NextPageUri** | Pointer to **string** | | -**Page** | **int** | |[optional] -**PageSize** | **int** | |[optional] -**PreviousPageUri** | Pointer to **string** | | -**Start** | **int** | |[optional] -**Uri** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/api/v2010/model_api_v2010_account.go b/rest/api/v2010/model_api_v2010_account.go index 08d3b3057..77bb52593 100644 --- a/rest/api/v2010/model_api_v2010_account.go +++ b/rest/api/v2010/model_api_v2010_account.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Account struct for ApiV2010Account type ApiV2010Account struct { - // The authorization token for this account. This token should be kept a secret, so no sharing. + // The authorization token for this account. This token should be kept a secret, so no sharing. AuthToken *string `json:"auth_token,omitempty"` - // The date that this account was created, in GMT in RFC 2822 format + // The date that this account was created, in GMT in RFC 2822 format DateCreated *string `json:"date_created,omitempty"` - // The date that this account was last updated, in GMT in RFC 2822 format. + // The date that this account was last updated, in GMT in RFC 2822 format. DateUpdated *string `json:"date_updated,omitempty"` - // A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address. + // A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique 34 character id that represents the parent of this account. The OwnerAccountSid of a parent account is it's own sid. + // The unique 34 character id that represents the parent of this account. The OwnerAccountSid of a parent account is it's own sid. OwnerAccountSid *string `json:"owner_account_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. - Sid *string `json:"sid,omitempty"` + // A 34 character string that uniquely identifies this resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // A Map of various subresources available for the given Account Instance + // A Map of various subresources available for the given Account Instance SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - Type *string `json:"type,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com` + Type *string `json:"type,omitempty"` + // The URI for this resource, relative to `https://api.twilio.com` Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_account_available_phone_number_country_available_phone_number_local_capabilities.go b/rest/api/v2010/model_api_v2010_account_available_phone_number_country_available_phone_number_local_capabilities.go index ec1af6f07..861fda75e 100644 --- a/rest/api/v2010/model_api_v2010_account_available_phone_number_country_available_phone_number_local_capabilities.go +++ b/rest/api/v2010/model_api_v2010_account_available_phone_number_country_available_phone_number_local_capabilities.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are: `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. type ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities struct { - Mms bool `json:"mms,omitempty"` - Sms bool `json:"sms,omitempty"` + Mms bool `json:"mms,omitempty"` + Sms bool `json:"sms,omitempty"` Voice bool `json:"voice,omitempty"` - Fax bool `json:"fax,omitempty"` + Fax bool `json:"fax,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_account_incoming_phone_number_capabilities.go b/rest/api/v2010/model_api_v2010_account_incoming_phone_number_capabilities.go index 57a99936b..2cfc932d7 100644 --- a/rest/api/v2010/model_api_v2010_account_incoming_phone_number_capabilities.go +++ b/rest/api/v2010/model_api_v2010_account_incoming_phone_number_capabilities.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010AccountIncomingPhoneNumberCapabilities The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. type ApiV2010AccountIncomingPhoneNumberCapabilities struct { - Mms bool `json:"mms,omitempty"` - Sms bool `json:"sms,omitempty"` + Mms bool `json:"mms,omitempty"` + Sms bool `json:"sms,omitempty"` Voice bool `json:"voice,omitempty"` - Fax bool `json:"fax,omitempty"` + Fax bool `json:"fax,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_account_token_ice_servers.go b/rest/api/v2010/model_api_v2010_account_token_ice_servers.go index 7aa2daa75..dbd0c0f7b 100644 --- a/rest/api/v2010/model_api_v2010_account_token_ice_servers.go +++ b/rest/api/v2010/model_api_v2010_account_token_ice_servers.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010AccountTokenIceServers struct for ApiV2010AccountTokenIceServers type ApiV2010AccountTokenIceServers struct { Credential string `json:"credential,omitempty"` - Username string `json:"username,omitempty"` - Url string `json:"url,omitempty"` - Urls string `json:"urls,omitempty"` + Username string `json:"username,omitempty"` + Url string `json:"url,omitempty"` + Urls string `json:"urls,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_address.go b/rest/api/v2010/model_api_v2010_address.go index 2822995e1..76fecb30a 100644 --- a/rest/api/v2010/model_api_v2010_address.go +++ b/rest/api/v2010/model_api_v2010_address.go @@ -13,39 +13,44 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Address struct for ApiV2010Address type ApiV2010Address struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource. AccountSid *string `json:"account_sid,omitempty"` - // The city in which the address is located. + // The city in which the address is located. City *string `json:"city,omitempty"` - // The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters. + // The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters. CustomerName *string `json:"customer_name,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The ISO country code of the address. + // The ISO country code of the address. IsoCountry *string `json:"iso_country,omitempty"` - // The postal code of the address. + // The postal code of the address. PostalCode *string `json:"postal_code,omitempty"` - // The state or region of the address. + // The state or region of the address. Region *string `json:"region,omitempty"` - // The unique string that that we created to identify the Address resource. + // The unique string that that we created to identify the Address resource. Sid *string `json:"sid,omitempty"` - // The number and street address of the address. + // The number and street address of the address. Street *string `json:"street,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // Whether emergency calling has been enabled on this number. + // Whether emergency calling has been enabled on this number. EmergencyEnabled *bool `json:"emergency_enabled,omitempty"` - // Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been validated. `false` indicate the country doesn't require validation or the Address is not valid. + // Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been validated. `false` indicate the country doesn't require validation or the Address is not valid. Validated *bool `json:"validated,omitempty"` - // Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been verified. `false` indicate the country doesn't require verified or the Address is not valid. + // Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been verified. `false` indicate the country doesn't require verified or the Address is not valid. Verified *bool `json:"verified,omitempty"` - // The additional number and street address of the address. + // The additional number and street address of the address. StreetSecondary *string `json:"street_secondary,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_application.go b/rest/api/v2010/model_api_v2010_application.go index 2603c118a..c57f8cc55 100644 --- a/rest/api/v2010/model_api_v2010_application.go +++ b/rest/api/v2010/model_api_v2010_application.go @@ -13,49 +13,54 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Application struct for ApiV2010Application type ApiV2010Application struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The URL we call using a POST method to send message status information to your application. + // The URL we call using a POST method to send message status information to your application. MessageStatusCallback *string `json:"message_status_callback,omitempty"` - // The unique string that that we created to identify the Application resource. + // The unique string that that we created to identify the Application resource. Sid *string `json:"sid,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call using a POST method to send status information to your application about SMS messages that refer to the application. + // The URL we call using a POST method to send status information to your application about SMS messages that refer to the application. SmsStatusCallback *string `json:"sms_status_callback,omitempty"` - // The URL we call when the phone number receives an incoming SMS message. + // The URL we call when the phone number receives an incoming SMS message. SmsUrl *string `json:"sms_url,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. + // Whether we look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL we call when the phone number assigned to this application receives a call. + // The URL we call when the phone number assigned to this application receives a call. VoiceUrl *string `json:"voice_url,omitempty"` - // Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. + // Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. PublicApplicationConnectEnabled *bool `json:"public_application_connect_enabled,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_authorized_connect_app.go b/rest/api/v2010/model_api_v2010_authorized_connect_app.go index dd4145f26..27294ad7b 100644 --- a/rest/api/v2010/model_api_v2010_authorized_connect_app.go +++ b/rest/api/v2010/model_api_v2010_authorized_connect_app.go @@ -13,27 +13,32 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010AuthorizedConnectApp struct for ApiV2010AuthorizedConnectApp type ApiV2010AuthorizedConnectApp struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource. AccountSid *string `json:"account_sid,omitempty"` - // The company name set for the Connect App. + // The company name set for the Connect App. ConnectAppCompanyName *string `json:"connect_app_company_name,omitempty"` - // A detailed description of the Connect App. + // A detailed description of the Connect App. ConnectAppDescription *string `json:"connect_app_description,omitempty"` - // The name of the Connect App. + // The name of the Connect App. ConnectAppFriendlyName *string `json:"connect_app_friendly_name,omitempty"` - // The public URL for the Connect App. + // The public URL for the Connect App. ConnectAppHomepageUrl *string `json:"connect_app_homepage_url,omitempty"` - // The SID that we assigned to the Connect App. + // The SID that we assigned to the Connect App. ConnectAppSid *string `json:"connect_app_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The set of permissions that you authorized for the Connect App. Can be: `get-all` or `post-all`. + // The set of permissions that you authorized for the Connect App. Can be: `get-all` or `post-all`. Permissions *[]string `json:"permissions,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_country.go b/rest/api/v2010/model_api_v2010_available_phone_number_country.go index e3a6522ae..eaea05ec2 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_country.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_country.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010AvailablePhoneNumberCountry struct for ApiV2010AvailablePhoneNumberCountry type ApiV2010AvailablePhoneNumberCountry struct { - // The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country. + // The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country. CountryCode *string `json:"country_code,omitempty"` - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The URI of the Country resource, relative to `https://api.twilio.com`. + // The URI of the Country resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // Whether all phone numbers available in the country are new to the Twilio platform. `true` if they are and `false` if all numbers are not in the Twilio Phone Number Beta program. + // Whether all phone numbers available in the country are new to the Twilio platform. `true` if they are and `false` if all numbers are not in the Twilio Phone Number Beta program. Beta *bool `json:"beta,omitempty"` - // A list of related AvailablePhoneNumber resources identified by their URIs relative to `https://api.twilio.com`. + // A list of related AvailablePhoneNumber resources identified by their URIs relative to `https://api.twilio.com`. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_local.go b/rest/api/v2010/model_api_v2010_available_phone_number_local.go index b60be826f..55c8e3cd1 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_local.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_local.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberLocal struct for ApiV2010AvailablePhoneNumberLocal type ApiV2010AvailablePhoneNumberLocal struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberLocal) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberLocal) UnmarshalJSON(bytes []byte) ( } *response = ApiV2010AvailablePhoneNumberLocal{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberLocal) UnmarshalJSON(bytes []byte) ( return } + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_machine_to_machine.go b/rest/api/v2010/model_api_v2010_available_phone_number_machine_to_machine.go index 153d5570e..691597b15 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_machine_to_machine.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_machine_to_machine.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberMachineToMachine struct for ApiV2010AvailablePhoneNumberMachineToMachine type ApiV2010AvailablePhoneNumberMachineToMachine struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberMachineToMachine) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberMachineToMachine) UnmarshalJSON(byte } *response = ApiV2010AvailablePhoneNumberMachineToMachine{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberMachineToMachine) UnmarshalJSON(byte return } + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_mobile.go b/rest/api/v2010/model_api_v2010_available_phone_number_mobile.go index 7a476b948..823576223 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_mobile.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_mobile.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberMobile struct for ApiV2010AvailablePhoneNumberMobile type ApiV2010AvailablePhoneNumberMobile struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberMobile) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberMobile) UnmarshalJSON(bytes []byte) } *response = ApiV2010AvailablePhoneNumberMobile{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberMobile) UnmarshalJSON(bytes []byte) return } + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_national.go b/rest/api/v2010/model_api_v2010_available_phone_number_national.go index a5f540b76..d3fd02f84 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_national.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_national.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberNational struct for ApiV2010AvailablePhoneNumberNational type ApiV2010AvailablePhoneNumberNational struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberNational) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberNational) UnmarshalJSON(bytes []byte } *response = ApiV2010AvailablePhoneNumberNational{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberNational) UnmarshalJSON(bytes []byte return } + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_shared_cost.go b/rest/api/v2010/model_api_v2010_available_phone_number_shared_cost.go index 4533922bf..99886a394 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_shared_cost.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_shared_cost.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberSharedCost struct for ApiV2010AvailablePhoneNumberSharedCost type ApiV2010AvailablePhoneNumberSharedCost struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberSharedCost) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberSharedCost) UnmarshalJSON(bytes []by } *response = ApiV2010AvailablePhoneNumberSharedCost{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberSharedCost) UnmarshalJSON(bytes []by return } + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_toll_free.go b/rest/api/v2010/model_api_v2010_available_phone_number_toll_free.go index 46bd28b68..5515e5367 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_toll_free.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_toll_free.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberTollFree struct for ApiV2010AvailablePhoneNumberTollFree type ApiV2010AvailablePhoneNumberTollFree struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberTollFree) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberTollFree) UnmarshalJSON(bytes []byte } *response = ApiV2010AvailablePhoneNumberTollFree{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberTollFree) UnmarshalJSON(bytes []byte return } + diff --git a/rest/api/v2010/model_api_v2010_available_phone_number_voip.go b/rest/api/v2010/model_api_v2010_available_phone_number_voip.go index 74620757e..af9b7e0c7 100644 --- a/rest/api/v2010/model_api_v2010_available_phone_number_voip.go +++ b/rest/api/v2010/model_api_v2010_available_phone_number_voip.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010AvailablePhoneNumberVoip struct for ApiV2010AvailablePhoneNumberVoip type ApiV2010AvailablePhoneNumberVoip struct { - // A formatted version of the phone number. + // A formatted version of the phone number. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + // The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. Lata *string `json:"lata,omitempty"` - // The locality or city of this phone number's location. + // The locality or city of this phone number's location. Locality *string `json:"locality,omitempty"` - // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + // The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. RateCenter *string `json:"rate_center,omitempty"` - // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The latitude of this phone number's location. Available for only phone numbers from the US and Canada. Latitude *float32 `json:"latitude,omitempty"` - // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + // The longitude of this phone number's location. Available for only phone numbers from the US and Canada. Longitude *float32 `json:"longitude,omitempty"` - // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + // The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. Region *string `json:"region,omitempty"` - // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + // The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. PostalCode *string `json:"postal_code,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. IsoCountry *string `json:"iso_country,omitempty"` - // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + // The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. AddressRequirements *string `json:"address_requirements,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities,omitempty"` } func (response *ApiV2010AvailablePhoneNumberVoip) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - FriendlyName *string `json:"friendly_name"` - PhoneNumber *string `json:"phone_number"` - Lata *string `json:"lata"` - Locality *string `json:"locality"` - RateCenter *string `json:"rate_center"` - Latitude *interface{} `json:"latitude"` - Longitude *interface{} `json:"longitude"` - Region *string `json:"region"` - PostalCode *string `json:"postal_code"` - IsoCountry *string `json:"iso_country"` - AddressRequirements *string `json:"address_requirements"` - Beta *bool `json:"beta"` - Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` + FriendlyName *string `json:"friendly_name"` + PhoneNumber *string `json:"phone_number"` + Lata *string `json:"lata"` + Locality *string `json:"locality"` + RateCenter *string `json:"rate_center"` + Latitude *interface{} `json:"latitude"` + Longitude *interface{} `json:"longitude"` + Region *string `json:"region"` + PostalCode *string `json:"postal_code"` + IsoCountry *string `json:"iso_country"` + AddressRequirements *string `json:"address_requirements"` + Beta *bool `json:"beta"` + Capabilities *ApiV2010AccountAvailablePhoneNumberCountryAvailablePhoneNumberLocalCapabilities `json:"capabilities"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,17 +68,17 @@ func (response *ApiV2010AvailablePhoneNumberVoip) UnmarshalJSON(bytes []byte) (e } *response = ApiV2010AvailablePhoneNumberVoip{ - FriendlyName: raw.FriendlyName, - PhoneNumber: raw.PhoneNumber, - Lata: raw.Lata, - Locality: raw.Locality, - RateCenter: raw.RateCenter, - Region: raw.Region, - PostalCode: raw.PostalCode, - IsoCountry: raw.IsoCountry, + FriendlyName: raw.FriendlyName, + PhoneNumber: raw.PhoneNumber, + Lata: raw.Lata, + Locality: raw.Locality, + RateCenter: raw.RateCenter, + Region: raw.Region, + PostalCode: raw.PostalCode, + IsoCountry: raw.IsoCountry, AddressRequirements: raw.AddressRequirements, - Beta: raw.Beta, - Capabilities: raw.Capabilities, + Beta: raw.Beta, + Capabilities: raw.Capabilities, } responseLatitude, err := client.UnmarshalFloat32(raw.Latitude) @@ -98,3 +95,4 @@ func (response *ApiV2010AvailablePhoneNumberVoip) UnmarshalJSON(bytes []byte) (e return } + diff --git a/rest/api/v2010/model_api_v2010_balance.go b/rest/api/v2010/model_api_v2010_balance.go index e68a7fb8e..75e6313b0 100644 --- a/rest/api/v2010/model_api_v2010_balance.go +++ b/rest/api/v2010/model_api_v2010_balance.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Balance struct for ApiV2010Balance type ApiV2010Balance struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The balance of the Account, in units specified by the unit parameter. Balance changes may not be reflected immediately. Child accounts do not contain balance information + // The balance of the Account, in units specified by the unit parameter. Balance changes may not be reflected immediately. Child accounts do not contain balance information Balance *string `json:"balance,omitempty"` - // The units of currency for the account balance + // The units of currency for the account balance Currency *string `json:"currency,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_call.go b/rest/api/v2010/model_api_v2010_call.go index 5f6791670..09ec79256 100644 --- a/rest/api/v2010/model_api_v2010_call.go +++ b/rest/api/v2010/model_api_v2010_call.go @@ -13,58 +13,63 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Call struct for ApiV2010Call type ApiV2010Call struct { - // The unique string that we created to identify this Call resource. + // The unique string that we created to identify this Call resource. Sid *string `json:"sid,omitempty"` - // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The SID that identifies the call that created this leg. + // The SID that identifies the call that created this leg. ParentCallSid *string `json:"parent_call_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource. AccountSid *string `json:"account_sid,omitempty"` - // The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. + // The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. To *string `json:"to,omitempty"` - // The phone number, SIP address or Client identifier that received this call. Formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). + // The phone number, SIP address or Client identifier that received this call. Formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). ToFormatted *string `json:"to_formatted,omitempty"` - // The phone number, SIP address, Client identifier or SIM SID that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. + // The phone number, SIP address, Client identifier or SIM SID that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. From *string `json:"from,omitempty"` - // The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). + // The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). FromFormatted *string `json:"from_formatted,omitempty"` - // If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. + // If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. PhoneNumberSid *string `json:"phone_number_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The start time of the call, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. + Status *string `json:"status,omitempty"` + // The start time of the call, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. StartTime *string `json:"start_time,omitempty"` - // The time the call ended, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. + // The time the call ended, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. EndTime *string `json:"end_time,omitempty"` - // The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. + // The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. Duration *string `json:"duration,omitempty"` - // The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. + // The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. Price *string `json:"price,omitempty"` - // The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. + // The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. PriceUnit *string `json:"price_unit,omitempty"` - // A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. + // A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. Direction *string `json:"direction,omitempty"` - // Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. + // Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. AnsweredBy *string `json:"answered_by,omitempty"` - // The API version used to create the call. + // The API version used to create the call. ApiVersion *string `json:"api_version,omitempty"` - // The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. + // The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. ForwardedFrom *string `json:"forwarded_from,omitempty"` - // The Group SID associated with this call. If no Group is associated with the call, the field is empty. + // The Group SID associated with this call. If no Group is associated with the call, the field is empty. GroupSid *string `json:"group_sid,omitempty"` - // The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty. + // The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty. CallerName *string `json:"caller_name,omitempty"` - // The wait time in milliseconds before the call is placed. + // The wait time in milliseconds before the call is placed. QueueTime *string `json:"queue_time,omitempty"` - // The unique identifier of the trunk resource that was used for this call. The field is empty if the call was not made using a SIP trunk or if the call is not terminated. + // The unique identifier of the trunk resource that was used for this call. The field is empty if the call was not made using a SIP trunk or if the call is not terminated. TrunkSid *string `json:"trunk_sid,omitempty"` - // The URI of this resource, relative to `https://api.twilio.com`. + // The URI of this resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // A list of subresources available to this call, identified by their URIs relative to `https://api.twilio.com`. + // A list of subresources available to this call, identified by their URIs relative to `https://api.twilio.com`. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_call_event.go b/rest/api/v2010/model_api_v2010_call_event.go index f720a511d..40228d0a8 100644 --- a/rest/api/v2010/model_api_v2010_call_event.go +++ b/rest/api/v2010/model_api_v2010_call_event.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010CallEvent struct for ApiV2010CallEvent type ApiV2010CallEvent struct { - // Contains a dictionary representing the request of the call. + // Contains a dictionary representing the request of the call. Request *interface{} `json:"request,omitempty"` - // Contains a dictionary representing the call response, including a list of the call events. + // Contains a dictionary representing the call response, including a list of the call events. Response *interface{} `json:"response,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_call_feedback.go b/rest/api/v2010/model_api_v2010_call_feedback.go index b8dd51bd4..7546410dd 100644 --- a/rest/api/v2010/model_api_v2010_call_feedback.go +++ b/rest/api/v2010/model_api_v2010_call_feedback.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010CallFeedback struct for ApiV2010CallFeedback type ApiV2010CallFeedback struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. AccountSid *string `json:"account_sid,omitempty"` - // The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. + // A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. Issues *[]string `json:"issues,omitempty"` - // `1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call. + // `1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call. QualityScore *int `json:"quality_score,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_call_feedback_summary.go b/rest/api/v2010/model_api_v2010_call_feedback_summary.go index 2b94d21eb..d893e2162 100644 --- a/rest/api/v2010/model_api_v2010_call_feedback_summary.go +++ b/rest/api/v2010/model_api_v2010_call_feedback_summary.go @@ -13,60 +13,57 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010CallFeedbackSummary struct for ApiV2010CallFeedbackSummary type ApiV2010CallFeedbackSummary struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. AccountSid *string `json:"account_sid,omitempty"` - // The total number of calls. + // The total number of calls. CallCount *int `json:"call_count,omitempty"` - // The total number of calls with a feedback entry. + // The total number of calls with a feedback entry. CallFeedbackCount *int `json:"call_feedback_count,omitempty"` - // The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // The last date for which feedback entries are included in this Feedback Summary, formatted as `YYYY-MM-DD` and specified in UTC. + // The last date for which feedback entries are included in this Feedback Summary, formatted as `YYYY-MM-DD` and specified in UTC. EndDate *string `json:"end_date,omitempty"` - // Whether the feedback summary includes subaccounts; `true` if it does, otherwise `false`. + // Whether the feedback summary includes subaccounts; `true` if it does, otherwise `false`. IncludeSubaccounts *bool `json:"include_subaccounts,omitempty"` - // A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, or `one-way-audio`. + // A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, or `one-way-audio`. Issues *[]interface{} `json:"issues,omitempty"` - // The average QualityScore of the feedback entries. + // The average QualityScore of the feedback entries. QualityScoreAverage *float32 `json:"quality_score_average,omitempty"` - // The median QualityScore of the feedback entries. + // The median QualityScore of the feedback entries. QualityScoreMedian *float32 `json:"quality_score_median,omitempty"` - // The standard deviation of the quality scores. + // The standard deviation of the quality scores. QualityScoreStandardDeviation *float32 `json:"quality_score_standard_deviation,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The first date for which feedback entries are included in this feedback summary, formatted as `YYYY-MM-DD` and specified in UTC. + // The first date for which feedback entries are included in this feedback summary, formatted as `YYYY-MM-DD` and specified in UTC. StartDate *string `json:"start_date,omitempty"` - Status *string `json:"status,omitempty"` + Status *string `json:"status,omitempty"` } func (response *ApiV2010CallFeedbackSummary) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - CallCount *int `json:"call_count"` - CallFeedbackCount *int `json:"call_feedback_count"` - DateCreated *string `json:"date_created"` - DateUpdated *string `json:"date_updated"` - EndDate *string `json:"end_date"` - IncludeSubaccounts *bool `json:"include_subaccounts"` - Issues *[]interface{} `json:"issues"` - QualityScoreAverage *interface{} `json:"quality_score_average"` - QualityScoreMedian *interface{} `json:"quality_score_median"` - QualityScoreStandardDeviation *interface{} `json:"quality_score_standard_deviation"` - Sid *string `json:"sid"` - StartDate *string `json:"start_date"` - Status *string `json:"status"` + AccountSid *string `json:"account_sid"` + CallCount *int `json:"call_count"` + CallFeedbackCount *int `json:"call_feedback_count"` + DateCreated *string `json:"date_created"` + DateUpdated *string `json:"date_updated"` + EndDate *string `json:"end_date"` + IncludeSubaccounts *bool `json:"include_subaccounts"` + Issues *[]interface{} `json:"issues"` + QualityScoreAverage *interface{} `json:"quality_score_average"` + QualityScoreMedian *interface{} `json:"quality_score_median"` + QualityScoreStandardDeviation *interface{} `json:"quality_score_standard_deviation"` + Sid *string `json:"sid"` + StartDate *string `json:"start_date"` + Status *string `json:"status"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -74,17 +71,17 @@ func (response *ApiV2010CallFeedbackSummary) UnmarshalJSON(bytes []byte) (err er } *response = ApiV2010CallFeedbackSummary{ - AccountSid: raw.AccountSid, - CallCount: raw.CallCount, - CallFeedbackCount: raw.CallFeedbackCount, - DateCreated: raw.DateCreated, - DateUpdated: raw.DateUpdated, - EndDate: raw.EndDate, + AccountSid: raw.AccountSid, + CallCount: raw.CallCount, + CallFeedbackCount: raw.CallFeedbackCount, + DateCreated: raw.DateCreated, + DateUpdated: raw.DateUpdated, + EndDate: raw.EndDate, IncludeSubaccounts: raw.IncludeSubaccounts, - Issues: raw.Issues, - Sid: raw.Sid, - StartDate: raw.StartDate, - Status: raw.Status, + Issues: raw.Issues, + Sid: raw.Sid, + StartDate: raw.StartDate, + Status: raw.Status, } responseQualityScoreAverage, err := client.UnmarshalFloat32(raw.QualityScoreAverage) @@ -107,3 +104,4 @@ func (response *ApiV2010CallFeedbackSummary) UnmarshalJSON(bytes []byte) (err er return } + diff --git a/rest/api/v2010/model_api_v2010_call_notification.go b/rest/api/v2010/model_api_v2010_call_notification.go index ab531bb78..9e48f92d3 100644 --- a/rest/api/v2010/model_api_v2010_call_notification.go +++ b/rest/api/v2010/model_api_v2010_call_notification.go @@ -13,35 +13,40 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010CallNotification struct for ApiV2010CallNotification type ApiV2010CallNotification struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the Call Notification resource. + // The API version used to create the Call Notification resource. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). ErrorCode *string `json:"error_code,omitempty"` - // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. + // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. Log *string `json:"log,omitempty"` - // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. + // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. MessageDate *string `json:"message_date,omitempty"` - // The text of the notification. + // The text of the notification. MessageText *string `json:"message_text,omitempty"` - // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). MoreInfo *string `json:"more_info,omitempty"` - // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. + // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. RequestMethod *string `json:"request_method,omitempty"` - // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. + // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. RequestUrl *string `json:"request_url,omitempty"` - // The unique string that that we created to identify the Call Notification resource. + // The unique string that that we created to identify the Call Notification resource. Sid *string `json:"sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_call_notification_instance.go b/rest/api/v2010/model_api_v2010_call_notification_instance.go index 8922a3880..a0c8a9da2 100644 --- a/rest/api/v2010/model_api_v2010_call_notification_instance.go +++ b/rest/api/v2010/model_api_v2010_call_notification_instance.go @@ -13,41 +13,46 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010CallNotificationInstance struct for ApiV2010CallNotificationInstance type ApiV2010CallNotificationInstance struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the Call Notification resource. + // The API version used to create the Call Notification resource. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). ErrorCode *string `json:"error_code,omitempty"` - // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. + // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. Log *string `json:"log,omitempty"` - // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. + // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. MessageDate *string `json:"message_date,omitempty"` - // The text of the notification. + // The text of the notification. MessageText *string `json:"message_text,omitempty"` - // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). MoreInfo *string `json:"more_info,omitempty"` - // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. + // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. RequestMethod *string `json:"request_method,omitempty"` - // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. + // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. RequestUrl *string `json:"request_url,omitempty"` - // The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. + // The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. RequestVariables *string `json:"request_variables,omitempty"` - // The HTTP body returned by your server. + // The HTTP body returned by your server. ResponseBody *string `json:"response_body,omitempty"` - // The HTTP headers returned by your server. + // The HTTP headers returned by your server. ResponseHeaders *string `json:"response_headers,omitempty"` - // The unique string that that we created to identify the Call Notification resource. + // The unique string that that we created to identify the Call Notification resource. Sid *string `json:"sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_call_recording.go b/rest/api/v2010/model_api_v2010_call_recording.go index 1a2d84009..2c0e8f9ed 100644 --- a/rest/api/v2010/model_api_v2010_call_recording.go +++ b/rest/api/v2010/model_api_v2010_call_recording.go @@ -13,71 +13,68 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010CallRecording struct for ApiV2010CallRecording type ApiV2010CallRecording struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to make the recording. + // The API version used to make the recording. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The Conference SID that identifies the conference associated with the recording, if a conference recording. + // The Conference SID that identifies the conference associated with the recording, if a conference recording. ConferenceSid *string `json:"conference_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. StartTime *string `json:"start_time,omitempty"` - // The length of the recording in seconds. + // The length of the recording in seconds. Duration *string `json:"duration,omitempty"` - // The unique string that that we created to identify the Recording resource. + // The unique string that that we created to identify the Recording resource. Sid *string `json:"sid,omitempty"` - // The one-time cost of creating the recording in the `price_unit` currency. + // The one-time cost of creating the recording in the `price_unit` currency. Price *float32 `json:"price,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. + // How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. EncryptionDetails *interface{} `json:"encryption_details,omitempty"` - // The currency used in the `price` property. Example: `USD`. + // The currency used in the `price` property. Example: `USD`. PriceUnit *string `json:"price_unit,omitempty"` - Status *string `json:"status,omitempty"` - // The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. - Channels *int `json:"channels,omitempty"` - Source *string `json:"source,omitempty"` - // The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. + Status *string `json:"status,omitempty"` + // The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. + Channels *int `json:"channels,omitempty"` + Source *string `json:"source,omitempty"` + // The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. ErrorCode *int `json:"error_code,omitempty"` - // The recorded track. Can be: `inbound`, `outbound`, or `both`. + // The recorded track. Can be: `inbound`, `outbound`, or `both`. Track *string `json:"track,omitempty"` } func (response *ApiV2010CallRecording) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - CallSid *string `json:"call_sid"` - ConferenceSid *string `json:"conference_sid"` - DateCreated *string `json:"date_created"` - DateUpdated *string `json:"date_updated"` - StartTime *string `json:"start_time"` - Duration *string `json:"duration"` - Sid *string `json:"sid"` - Price *interface{} `json:"price"` - Uri *string `json:"uri"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + CallSid *string `json:"call_sid"` + ConferenceSid *string `json:"conference_sid"` + DateCreated *string `json:"date_created"` + DateUpdated *string `json:"date_updated"` + StartTime *string `json:"start_time"` + Duration *string `json:"duration"` + Sid *string `json:"sid"` + Price *interface{} `json:"price"` + Uri *string `json:"uri"` EncryptionDetails *interface{} `json:"encryption_details"` - PriceUnit *string `json:"price_unit"` - Status *string `json:"status"` - Channels *int `json:"channels"` - Source *string `json:"source"` - ErrorCode *int `json:"error_code"` - Track *string `json:"track"` + PriceUnit *string `json:"price_unit"` + Status *string `json:"status"` + Channels *int `json:"channels"` + Source *string `json:"source"` + ErrorCode *int `json:"error_code"` + Track *string `json:"track"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -85,23 +82,23 @@ func (response *ApiV2010CallRecording) UnmarshalJSON(bytes []byte) (err error) { } *response = ApiV2010CallRecording{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - CallSid: raw.CallSid, - ConferenceSid: raw.ConferenceSid, - DateCreated: raw.DateCreated, - DateUpdated: raw.DateUpdated, - StartTime: raw.StartTime, - Duration: raw.Duration, - Sid: raw.Sid, - Uri: raw.Uri, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + CallSid: raw.CallSid, + ConferenceSid: raw.ConferenceSid, + DateCreated: raw.DateCreated, + DateUpdated: raw.DateUpdated, + StartTime: raw.StartTime, + Duration: raw.Duration, + Sid: raw.Sid, + Uri: raw.Uri, EncryptionDetails: raw.EncryptionDetails, - PriceUnit: raw.PriceUnit, - Status: raw.Status, - Channels: raw.Channels, - Source: raw.Source, - ErrorCode: raw.ErrorCode, - Track: raw.Track, + PriceUnit: raw.PriceUnit, + Status: raw.Status, + Channels: raw.Channels, + Source: raw.Source, + ErrorCode: raw.ErrorCode, + Track: raw.Track, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -112,3 +109,4 @@ func (response *ApiV2010CallRecording) UnmarshalJSON(bytes []byte) (err error) { return } + diff --git a/rest/api/v2010/model_api_v2010_conference.go b/rest/api/v2010/model_api_v2010_conference.go index f4c439d6a..a61e65ee3 100644 --- a/rest/api/v2010/model_api_v2010_conference.go +++ b/rest/api/v2010/model_api_v2010_conference.go @@ -13,29 +13,34 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Conference struct for ApiV2010Conference type ApiV2010Conference struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Conference resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Conference resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The API version used to create this conference. + // The API version used to create this conference. ApiVersion *string `json:"api_version,omitempty"` - // A string that you assigned to describe this conference room. Maxiumum length is 128 characters. + // A string that you assigned to describe this conference room. Maxiumum length is 128 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. + // A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. Region *string `json:"region,omitempty"` - // The unique string that that we created to identify this Conference resource. - Sid *string `json:"sid,omitempty"` + // The unique string that that we created to identify this Conference resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // The URI of this resource, relative to `https://api.twilio.com`. + // The URI of this resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // A list of related resources identified by their URIs relative to `https://api.twilio.com`. - SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - ReasonConferenceEnded *string `json:"reason_conference_ended,omitempty"` - // The call SID that caused the conference to end. + // A list of related resources identified by their URIs relative to `https://api.twilio.com`. + SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` + ReasonConferenceEnded *string `json:"reason_conference_ended,omitempty"` + // The call SID that caused the conference to end. CallSidEndingConference *string `json:"call_sid_ending_conference,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_conference_recording.go b/rest/api/v2010/model_api_v2010_conference_recording.go index 850abe317..b188c113b 100644 --- a/rest/api/v2010/model_api_v2010_conference_recording.go +++ b/rest/api/v2010/model_api_v2010_conference_recording.go @@ -13,39 +13,44 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010ConferenceRecording struct for ApiV2010ConferenceRecording type ApiV2010ConferenceRecording struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the recording. + // The API version used to create the recording. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Conference Recording resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Conference Recording resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The Conference SID that identifies the conference associated with the recording. + // The Conference SID that identifies the conference associated with the recording. ConferenceSid *string `json:"conference_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. StartTime *string `json:"start_time,omitempty"` - // The length of the recording in seconds. + // The length of the recording in seconds. Duration *string `json:"duration,omitempty"` - // The unique string that that we created to identify the Conference Recording resource. + // The unique string that that we created to identify the Conference Recording resource. Sid *string `json:"sid,omitempty"` - // The one-time cost of creating the recording in the `price_unit` currency. + // The one-time cost of creating the recording in the `price_unit` currency. Price *string `json:"price,omitempty"` - // The currency used in the `price` property. Example: `USD`. + // The currency used in the `price` property. Example: `USD`. PriceUnit *string `json:"price_unit,omitempty"` - Status *string `json:"status,omitempty"` - // The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. - Channels *int `json:"channels,omitempty"` - Source *string `json:"source,omitempty"` - // The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. + Status *string `json:"status,omitempty"` + // The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. + Channels *int `json:"channels,omitempty"` + Source *string `json:"source,omitempty"` + // The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. ErrorCode *int `json:"error_code,omitempty"` - // How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. + // How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. EncryptionDetails *interface{} `json:"encryption_details,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_connect_app.go b/rest/api/v2010/model_api_v2010_connect_app.go index f1bfd2c28..9c2a0caaa 100644 --- a/rest/api/v2010/model_api_v2010_connect_app.go +++ b/rest/api/v2010/model_api_v2010_connect_app.go @@ -13,29 +13,34 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010ConnectApp struct for ApiV2010ConnectApp type ApiV2010ConnectApp struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource. AccountSid *string `json:"account_sid,omitempty"` - // The URL we redirect the user to after we authenticate the user and obtain authorization to access the Connect App. + // The URL we redirect the user to after we authenticate the user and obtain authorization to access the Connect App. AuthorizeRedirectUrl *string `json:"authorize_redirect_url,omitempty"` - // The company name set for the Connect App. + // The company name set for the Connect App. CompanyName *string `json:"company_name,omitempty"` - // The HTTP method we use to call `deauthorize_callback_url`. + // The HTTP method we use to call `deauthorize_callback_url`. DeauthorizeCallbackMethod *string `json:"deauthorize_callback_method,omitempty"` - // The URL we call using the `deauthorize_callback_method` to de-authorize the Connect App. + // The URL we call using the `deauthorize_callback_method` to de-authorize the Connect App. DeauthorizeCallbackUrl *string `json:"deauthorize_callback_url,omitempty"` - // The description of the Connect App. + // The description of the Connect App. Description *string `json:"description,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The public URL where users can obtain more information about this Connect App. + // The public URL where users can obtain more information about this Connect App. HomepageUrl *string `json:"homepage_url,omitempty"` - // The set of permissions that your ConnectApp requests. + // The set of permissions that your ConnectApp requests. Permissions *[]string `json:"permissions,omitempty"` - // The unique string that that we created to identify the ConnectApp resource. + // The unique string that that we created to identify the ConnectApp resource. Sid *string `json:"sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_dependent_phone_number.go b/rest/api/v2010/model_api_v2010_dependent_phone_number.go index 2cc76dde2..55e0ae5f6 100644 --- a/rest/api/v2010/model_api_v2010_dependent_phone_number.go +++ b/rest/api/v2010/model_api_v2010_dependent_phone_number.go @@ -13,57 +13,62 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010DependentPhoneNumber struct for ApiV2010DependentPhoneNumber type ApiV2010DependentPhoneNumber struct { - // The unique string that that we created to identify the DependentPhoneNumber resource. + // The unique string that that we created to identify the DependentPhoneNumber resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. VoiceUrl *string `json:"voice_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database. Can be: `true` or `false`. Caller ID lookups can cost $0.01 each. + // Whether we look up the caller's caller-ID name from the CNAM database. Can be: `true` or `false`. Caller ID lookups can cost $0.01 each. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call when the phone number receives an incoming SMS message. - SmsUrl *string `json:"sms_url,omitempty"` + // The URL we call when the phone number receives an incoming SMS message. + SmsUrl *string `json:"sms_url,omitempty"` AddressRequirements *string `json:"address_requirements,omitempty"` - // The set of Boolean properties that indicates whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. + // The set of Boolean properties that indicates whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. Capabilities *interface{} `json:"capabilities,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. SmsApplicationSid *string `json:"sms_application_sid,omitempty"` - // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. VoiceApplicationSid *string `json:"voice_application_sid,omitempty"` - // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - TrunkSid *string `json:"trunk_sid,omitempty"` + // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + TrunkSid *string `json:"trunk_sid,omitempty"` EmergencyStatus *string `json:"emergency_status,omitempty"` - // The SID of the emergency address configuration that we use for emergency calling from the phone number. + // The SID of the emergency address configuration that we use for emergency calling from the phone number. EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_incoming_phone_number.go b/rest/api/v2010/model_api_v2010_incoming_phone_number.go index 230c657a9..0a2ccf84e 100644 --- a/rest/api/v2010/model_api_v2010_incoming_phone_number.go +++ b/rest/api/v2010/model_api_v2010_incoming_phone_number.go @@ -13,69 +13,74 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010IncomingPhoneNumber struct for ApiV2010IncomingPhoneNumber type ApiV2010IncomingPhoneNumber struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this IncomingPhoneNumber resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this IncomingPhoneNumber resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Address resource associated with the phone number. - AddressSid *string `json:"address_sid,omitempty"` + // The SID of the Address resource associated with the phone number. + AddressSid *string `json:"address_sid,omitempty"` AddressRequirements *string `json:"address_requirements,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountIncomingPhoneNumberCapabilities `json:"capabilities,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. IdentitySid *string `json:"identity_sid,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. Origin *string `json:"origin,omitempty"` - // The unique string that that we created to identify this IncomingPhoneNumber resource. + // The unique string that that we created to identify this IncomingPhoneNumber resource. Sid *string `json:"sid,omitempty"` - // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. SmsApplicationSid *string `json:"sms_application_sid,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call when the phone number receives an incoming SMS message. + // The URL we call when the phone number receives an incoming SMS message. SmsUrl *string `json:"sms_url,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. TrunkSid *string `json:"trunk_sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. - Uri *string `json:"uri,omitempty"` + // The URI of the resource, relative to `https://api.twilio.com`. + Uri *string `json:"uri,omitempty"` VoiceReceiveMode *string `json:"voice_receive_mode,omitempty"` - // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. VoiceApplicationSid *string `json:"voice_application_sid,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"voice_url,omitempty"` + // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"voice_url,omitempty"` EmergencyStatus *string `json:"emergency_status,omitempty"` - // The SID of the emergency address configuration that we use for emergency calling from this phone number. - EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` + // The SID of the emergency address configuration that we use for emergency calling from this phone number. + EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` EmergencyAddressStatus *string `json:"emergency_address_status,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. BundleSid *string `json:"bundle_sid,omitempty"` - Status *string `json:"status,omitempty"` + Status *string `json:"status,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on.go b/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on.go index 6e92adc9e..a1d0dd66a 100644 --- a/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on.go +++ b/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on.go @@ -13,29 +13,34 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010IncomingPhoneNumberAssignedAddOn struct for ApiV2010IncomingPhoneNumberAssignedAddOn type ApiV2010IncomingPhoneNumberAssignedAddOn struct { - // The unique string that that we created to identify the resource. + // The unique string that that we created to identify the resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Phone Number to which the Add-on is assigned. + // The SID of the Phone Number to which the Add-on is assigned. ResourceSid *string `json:"resource_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // A short description of the functionality that the Add-on provides. + // A short description of the functionality that the Add-on provides. Description *string `json:"description,omitempty"` - // A JSON string that represents the current configuration of this Add-on installation. + // A JSON string that represents the current configuration of this Add-on installation. Configuration *interface{} `json:"configuration,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // A list of related resources identified by their relative URIs. + // A list of related resources identified by their relative URIs. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on_extension.go b/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on_extension.go index dc2cce032..2a6d62359 100644 --- a/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on_extension.go +++ b/rest/api/v2010/model_api_v2010_incoming_phone_number_assigned_add_on_extension.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010IncomingPhoneNumberAssignedAddOnExtension struct for ApiV2010IncomingPhoneNumberAssignedAddOnExtension type ApiV2010IncomingPhoneNumberAssignedAddOnExtension struct { - // The unique string that that we created to identify the resource. + // The unique string that that we created to identify the resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Phone Number to which the Add-on is assigned. + // The SID of the Phone Number to which the Add-on is assigned. ResourceSid *string `json:"resource_sid,omitempty"` - // The SID that uniquely identifies the assigned Add-on installation. + // The SID that uniquely identifies the assigned Add-on installation. AssignedAddOnSid *string `json:"assigned_add_on_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // A string that you assigned to describe the Product this Extension is used within. + // A string that you assigned to describe the Product this Extension is used within. ProductName *string `json:"product_name,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // Whether the Extension will be invoked. + // Whether the Extension will be invoked. Enabled *bool `json:"enabled,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_incoming_phone_number_local.go b/rest/api/v2010/model_api_v2010_incoming_phone_number_local.go index 4cc321dc9..696e9592b 100644 --- a/rest/api/v2010/model_api_v2010_incoming_phone_number_local.go +++ b/rest/api/v2010/model_api_v2010_incoming_phone_number_local.go @@ -13,69 +13,74 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010IncomingPhoneNumberLocal struct for ApiV2010IncomingPhoneNumberLocal type ApiV2010IncomingPhoneNumberLocal struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Address resource associated with the phone number. - AddressSid *string `json:"address_sid,omitempty"` + // The SID of the Address resource associated with the phone number. + AddressSid *string `json:"address_sid,omitempty"` AddressRequirements *string `json:"address_requirements,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountIncomingPhoneNumberCapabilities `json:"capabilities,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. IdentitySid *string `json:"identity_sid,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. Origin *string `json:"origin,omitempty"` - // The unique string that that we created to identify the resource. + // The unique string that that we created to identify the resource. Sid *string `json:"sid,omitempty"` - // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. SmsApplicationSid *string `json:"sms_application_sid,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call when the phone number receives an incoming SMS message. + // The URL we call when the phone number receives an incoming SMS message. SmsUrl *string `json:"sms_url,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. TrunkSid *string `json:"trunk_sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. - Uri *string `json:"uri,omitempty"` + // The URI of the resource, relative to `https://api.twilio.com`. + Uri *string `json:"uri,omitempty"` VoiceReceiveMode *string `json:"voice_receive_mode,omitempty"` - // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. VoiceApplicationSid *string `json:"voice_application_sid,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL we call when this phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"voice_url,omitempty"` + // The URL we call when this phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"voice_url,omitempty"` EmergencyStatus *string `json:"emergency_status,omitempty"` - // The SID of the emergency address configuration that we use for emergency calling from this phone number. - EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` + // The SID of the emergency address configuration that we use for emergency calling from this phone number. + EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` EmergencyAddressStatus *string `json:"emergency_address_status,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. BundleSid *string `json:"bundle_sid,omitempty"` - Status *string `json:"status,omitempty"` + Status *string `json:"status,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_incoming_phone_number_mobile.go b/rest/api/v2010/model_api_v2010_incoming_phone_number_mobile.go index adfa25639..6eca80bdf 100644 --- a/rest/api/v2010/model_api_v2010_incoming_phone_number_mobile.go +++ b/rest/api/v2010/model_api_v2010_incoming_phone_number_mobile.go @@ -13,69 +13,74 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010IncomingPhoneNumberMobile struct for ApiV2010IncomingPhoneNumberMobile type ApiV2010IncomingPhoneNumberMobile struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Address resource associated with the phone number. - AddressSid *string `json:"address_sid,omitempty"` + // The SID of the Address resource associated with the phone number. + AddressSid *string `json:"address_sid,omitempty"` AddressRequirements *string `json:"address_requirements,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountIncomingPhoneNumberCapabilities `json:"capabilities,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. IdentitySid *string `json:"identity_sid,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. Origin *string `json:"origin,omitempty"` - // The unique string that that we created to identify the resource. + // The unique string that that we created to identify the resource. Sid *string `json:"sid,omitempty"` - // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. SmsApplicationSid *string `json:"sms_application_sid,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call when the phone number receives an incoming SMS message. + // The URL we call when the phone number receives an incoming SMS message. SmsUrl *string `json:"sms_url,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. TrunkSid *string `json:"trunk_sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. - Uri *string `json:"uri,omitempty"` + // The URI of the resource, relative to `https://api.twilio.com`. + Uri *string `json:"uri,omitempty"` VoiceReceiveMode *string `json:"voice_receive_mode,omitempty"` - // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. VoiceApplicationSid *string `json:"voice_application_sid,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"voice_url,omitempty"` + // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"voice_url,omitempty"` EmergencyStatus *string `json:"emergency_status,omitempty"` - // The SID of the emergency address configuration that we use for emergency calling from this phone number. - EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` + // The SID of the emergency address configuration that we use for emergency calling from this phone number. + EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` EmergencyAddressStatus *string `json:"emergency_address_status,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. BundleSid *string `json:"bundle_sid,omitempty"` - Status *string `json:"status,omitempty"` + Status *string `json:"status,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_incoming_phone_number_toll_free.go b/rest/api/v2010/model_api_v2010_incoming_phone_number_toll_free.go index 067b0c04e..8beb9832d 100644 --- a/rest/api/v2010/model_api_v2010_incoming_phone_number_toll_free.go +++ b/rest/api/v2010/model_api_v2010_incoming_phone_number_toll_free.go @@ -13,69 +13,74 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010IncomingPhoneNumberTollFree struct for ApiV2010IncomingPhoneNumberTollFree type ApiV2010IncomingPhoneNumberTollFree struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Address resource associated with the phone number. - AddressSid *string `json:"address_sid,omitempty"` + // The SID of the Address resource associated with the phone number. + AddressSid *string `json:"address_sid,omitempty"` AddressRequirements *string `json:"address_requirements,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - Beta *bool `json:"beta,omitempty"` + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + Beta *bool `json:"beta,omitempty"` Capabilities *ApiV2010AccountIncomingPhoneNumberCapabilities `json:"capabilities,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + // The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. IdentitySid *string `json:"identity_sid,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + // The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. Origin *string `json:"origin,omitempty"` - // The unique string that that we created to identify the resource. + // The unique string that that we created to identify the resource. Sid *string `json:"sid,omitempty"` - // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. SmsApplicationSid *string `json:"sms_application_sid,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call when the phone number receives an incoming SMS message. + // The URL we call when the phone number receives an incoming SMS message. SmsUrl *string `json:"sms_url,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. TrunkSid *string `json:"trunk_sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. - Uri *string `json:"uri,omitempty"` + // The URI of the resource, relative to `https://api.twilio.com`. + Uri *string `json:"uri,omitempty"` VoiceReceiveMode *string `json:"voice_receive_mode,omitempty"` - // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. VoiceApplicationSid *string `json:"voice_application_sid,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - VoiceUrl *string `json:"voice_url,omitempty"` + // The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + VoiceUrl *string `json:"voice_url,omitempty"` EmergencyStatus *string `json:"emergency_status,omitempty"` - // The SID of the emergency address configuration that we use for emergency calling from this phone number. - EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` + // The SID of the emergency address configuration that we use for emergency calling from this phone number. + EmergencyAddressSid *string `json:"emergency_address_sid,omitempty"` EmergencyAddressStatus *string `json:"emergency_address_status,omitempty"` - // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + // The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. BundleSid *string `json:"bundle_sid,omitempty"` - Status *string `json:"status,omitempty"` + Status *string `json:"status,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_key.go b/rest/api/v2010/model_api_v2010_key.go index 7a45ec23f..c28f906f2 100644 --- a/rest/api/v2010/model_api_v2010_key.go +++ b/rest/api/v2010/model_api_v2010_key.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Key struct for ApiV2010Key type ApiV2010Key struct { - // The unique string that that we created to identify the Key resource. + // The unique string that that we created to identify the Key resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_media.go b/rest/api/v2010/model_api_v2010_media.go index 5ff9558c4..e7f2f6728 100644 --- a/rest/api/v2010/model_api_v2010_media.go +++ b/rest/api/v2010/model_api_v2010_media.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Media struct for ApiV2010Media type ApiV2010Media struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this Media resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this Media resource. AccountSid *string `json:"account_sid,omitempty"` - // The default [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif`. + // The default [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif`. ContentType *string `json:"content_type,omitempty"` - // The date and time in GMT when this Media resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when this Media resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT when this Media resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when this Media resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The SID of the Message resource that is associated with this Media resource. + // The SID of the Message resource that is associated with this Media resource. ParentSid *string `json:"parent_sid,omitempty"` - // The unique string that identifies this Media resource. + // The unique string that identifies this Media resource. Sid *string `json:"sid,omitempty"` - // The URI of this Media resource, relative to `https://api.twilio.com`. + // The URI of this Media resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_member.go b/rest/api/v2010/model_api_v2010_member.go index 0741b3ed4..2c16bf9a8 100644 --- a/rest/api/v2010/model_api_v2010_member.go +++ b/rest/api/v2010/model_api_v2010_member.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Member struct for ApiV2010Member type ApiV2010Member struct { - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The date that the member was enqueued, given in RFC 2822 format. + // The date that the member was enqueued, given in RFC 2822 format. DateEnqueued *string `json:"date_enqueued,omitempty"` - // This member's current position in the queue. + // This member's current position in the queue. Position *int `json:"position,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The number of seconds the member has been in the queue. + // The number of seconds the member has been in the queue. WaitTime *int `json:"wait_time,omitempty"` - // The SID of the Queue the member is in. + // The SID of the Queue the member is in. QueueSid *string `json:"queue_sid,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_message.go b/rest/api/v2010/model_api_v2010_message.go index 53b4f74ae..539d6d1b7 100644 --- a/rest/api/v2010/model_api_v2010_message.go +++ b/rest/api/v2010/model_api_v2010_message.go @@ -13,45 +13,50 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Message struct for ApiV2010Message type ApiV2010Message struct { - // The text content of the message + // The text content of the message Body *string `json:"body,omitempty"` - // The number of segments that make up the complete message. SMS message bodies that exceed the [character limit](https://www.twilio.com/docs/glossary/what-sms-character-limit) are segmented and charged as multiple messages. Note: For messages sent via a Messaging Service, `num_segments` is initially `0`, since a sender hasn't yet been assigned. + // The number of segments that make up the complete message. SMS message bodies that exceed the [character limit](https://www.twilio.com/docs/glossary/what-sms-character-limit) are segmented and charged as multiple messages. Note: For messages sent via a Messaging Service, `num_segments` is initially `0`, since a sender hasn't yet been assigned. NumSegments *string `json:"num_segments,omitempty"` - Direction *string `json:"direction,omitempty"` - // The sender's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent. + Direction *string `json:"direction,omitempty"` + // The sender's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/docs/sms/api/short-code), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent. From *string `json:"from,omitempty"` - // The recipient's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format) or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g. `whatsapp:+15552229999`) + // The recipient's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format) or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g. `whatsapp:+15552229999`) To *string `json:"to,omitempty"` - // The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was last updated + // The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was last updated DateUpdated *string `json:"date_updated,omitempty"` - // The amount billed for the message in the currency specified by `price_unit`. The `price` is populated after the message has been sent/received, and may not be immediately availalble. View the [Pricing page](https://www.twilio.com/en-us/pricing) for more details. + // The amount billed for the message in the currency specified by `price_unit`. The `price` is populated after the message has been sent/received, and may not be immediately availalble. View the [Pricing page](https://www.twilio.com/en-us/pricing) for more details. Price *string `json:"price,omitempty"` - // The description of the `error_code` if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. + // The description of the `error_code` if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. ErrorMessage *string `json:"error_message,omitempty"` - // The URI of the Message resource, relative to `https://api.twilio.com`. + // The URI of the Message resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource AccountSid *string `json:"account_sid,omitempty"` - // The number of media files associated with the Message resource. + // The number of media files associated with the Message resource. NumMedia *string `json:"num_media,omitempty"` - Status *string `json:"status,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. The value is `null` if a Messaging Service was not used. + Status *string `json:"status,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. The value is `null` if a Messaging Service was not used. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // The unique, Twilio-provided string that identifies the Message resource. + // The unique, Twilio-provided string that identifies the Message resource. Sid *string `json:"sid,omitempty"` - // The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL. + // The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL. DateSent *string `json:"date_sent,omitempty"` - // The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was created + // The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was created DateCreated *string `json:"date_created,omitempty"` - // The [error code](https://www.twilio.com/docs/api/errors) returned if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. + // The [error code](https://www.twilio.com/docs/api/errors) returned if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. ErrorCode *int `json:"error_code,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The API version used to process the Message + // The API version used to process the Message ApiVersion *string `json:"api_version,omitempty"` - // A list of related resources identified by their URIs relative to `https://api.twilio.com` + // A list of related resources identified by their URIs relative to `https://api.twilio.com` SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_message_feedback.go b/rest/api/v2010/model_api_v2010_message_feedback.go index dae02e4a2..03f48f406 100644 --- a/rest/api/v2010/model_api_v2010_message_feedback.go +++ b/rest/api/v2010/model_api_v2010_message_feedback.go @@ -13,18 +13,23 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010MessageFeedback struct for ApiV2010MessageFeedback type ApiV2010MessageFeedback struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this MessageFeedback resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this MessageFeedback resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Message resource associated with this MessageFeedback resource. + // The SID of the Message resource associated with this MessageFeedback resource. MessageSid *string `json:"message_sid,omitempty"` - Outcome *string `json:"outcome,omitempty"` - // The date and time in GMT when this MessageFeedback resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + Outcome *string `json:"outcome,omitempty"` + // The date and time in GMT when this MessageFeedback resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT when this MessageFeedback resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when this MessageFeedback resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_new_key.go b/rest/api/v2010/model_api_v2010_new_key.go index 3ab074000..4cc113f08 100644 --- a/rest/api/v2010/model_api_v2010_new_key.go +++ b/rest/api/v2010/model_api_v2010_new_key.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010NewKey struct for ApiV2010NewKey type ApiV2010NewKey struct { - // The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. + // The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** + // The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** Secret *string `json:"secret,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_new_signing_key.go b/rest/api/v2010/model_api_v2010_new_signing_key.go index 55a7b8b9e..c2555587d 100644 --- a/rest/api/v2010/model_api_v2010_new_signing_key.go +++ b/rest/api/v2010/model_api_v2010_new_signing_key.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010NewSigningKey struct for ApiV2010NewSigningKey type ApiV2010NewSigningKey struct { - // The unique string that that we created to identify the NewSigningKey resource. + // The unique string that that we created to identify the NewSigningKey resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** + // The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** Secret *string `json:"secret,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_notification.go b/rest/api/v2010/model_api_v2010_notification.go index 18ac84323..2de700736 100644 --- a/rest/api/v2010/model_api_v2010_notification.go +++ b/rest/api/v2010/model_api_v2010_notification.go @@ -13,35 +13,40 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Notification struct for ApiV2010Notification type ApiV2010Notification struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. + // The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). ErrorCode *string `json:"error_code,omitempty"` - // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. + // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. Log *string `json:"log,omitempty"` - // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. + // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. MessageDate *string `json:"message_date,omitempty"` - // The text of the notification. + // The text of the notification. MessageText *string `json:"message_text,omitempty"` - // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). MoreInfo *string `json:"more_info,omitempty"` - // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. + // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. RequestMethod *string `json:"request_method,omitempty"` - // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. + // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. RequestUrl *string `json:"request_url,omitempty"` - // The unique string that that we created to identify the Notification resource. + // The unique string that that we created to identify the Notification resource. Sid *string `json:"sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_notification_instance.go b/rest/api/v2010/model_api_v2010_notification_instance.go index f9e0730b7..28d2f0db1 100644 --- a/rest/api/v2010/model_api_v2010_notification_instance.go +++ b/rest/api/v2010/model_api_v2010_notification_instance.go @@ -13,41 +13,46 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010NotificationInstance struct for ApiV2010NotificationInstance type ApiV2010NotificationInstance struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. + // The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). ErrorCode *string `json:"error_code,omitempty"` - // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. + // An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. Log *string `json:"log,omitempty"` - // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. + // The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. MessageDate *string `json:"message_date,omitempty"` - // The text of the notification. + // The text of the notification. MessageText *string `json:"message_text,omitempty"` - // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + // The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). MoreInfo *string `json:"more_info,omitempty"` - // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. + // The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. RequestMethod *string `json:"request_method,omitempty"` - // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. + // The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. RequestUrl *string `json:"request_url,omitempty"` - // The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. + // The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. RequestVariables *string `json:"request_variables,omitempty"` - // The HTTP body returned by your server. + // The HTTP body returned by your server. ResponseBody *string `json:"response_body,omitempty"` - // The HTTP headers returned by your server. + // The HTTP headers returned by your server. ResponseHeaders *string `json:"response_headers,omitempty"` - // The unique string that that we created to identify the Notification resource. + // The unique string that that we created to identify the Notification resource. Sid *string `json:"sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_outgoing_caller_id.go b/rest/api/v2010/model_api_v2010_outgoing_caller_id.go index 1c6cca342..0b3755197 100644 --- a/rest/api/v2010/model_api_v2010_outgoing_caller_id.go +++ b/rest/api/v2010/model_api_v2010_outgoing_caller_id.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010OutgoingCallerId struct for ApiV2010OutgoingCallerId type ApiV2010OutgoingCallerId struct { - // The unique string that that we created to identify the OutgoingCallerId resource. + // The unique string that that we created to identify the OutgoingCallerId resource. Sid *string `json:"sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource. AccountSid *string `json:"account_sid,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_participant.go b/rest/api/v2010/model_api_v2010_participant.go index efb5369b6..0ab45ca0a 100644 --- a/rest/api/v2010/model_api_v2010_participant.go +++ b/rest/api/v2010/model_api_v2010_participant.go @@ -13,34 +13,39 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Participant struct for ApiV2010Participant type ApiV2010Participant struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Participant resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Participant resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The user-specified label of this participant, if one was given when the participant was created. This may be used to fetch, update or delete the participant. + // The user-specified label of this participant, if one was given when the participant was created. This may be used to fetch, update or delete the participant. Label *string `json:"label,omitempty"` - // The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. + // The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. CallSidToCoach *string `json:"call_sid_to_coach,omitempty"` - // Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. + // Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. Coaching *bool `json:"coaching,omitempty"` - // The SID of the conference the participant is in. + // The SID of the conference the participant is in. ConferenceSid *string `json:"conference_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // Whether the conference ends when the participant leaves. Can be: `true` or `false` and the default is `false`. If `true`, the conference ends and all other participants drop out when the participant leaves. + // Whether the conference ends when the participant leaves. Can be: `true` or `false` and the default is `false`. If `true`, the conference ends and all other participants drop out when the participant leaves. EndConferenceOnExit *bool `json:"end_conference_on_exit,omitempty"` - // Whether the participant is muted. Can be `true` or `false`. + // Whether the participant is muted. Can be `true` or `false`. Muted *bool `json:"muted,omitempty"` - // Whether the participant is on hold. Can be `true` or `false`. + // Whether the participant is on hold. Can be `true` or `false`. Hold *bool `json:"hold,omitempty"` - // Whether the conference starts when the participant joins the conference, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. - StartConferenceOnEnter *bool `json:"start_conference_on_enter,omitempty"` - Status *string `json:"status,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // Whether the conference starts when the participant joins the conference, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + StartConferenceOnEnter *bool `json:"start_conference_on_enter,omitempty"` + Status *string `json:"status,omitempty"` + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_payments.go b/rest/api/v2010/model_api_v2010_payments.go index 2bb38dd23..fa1fd5837 100644 --- a/rest/api/v2010/model_api_v2010_payments.go +++ b/rest/api/v2010/model_api_v2010_payments.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Payments struct for ApiV2010Payments type ApiV2010Payments struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF. CallSid *string `json:"call_sid,omitempty"` - // The SID of the Payments resource. + // The SID of the Payments resource. Sid *string `json:"sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_queue.go b/rest/api/v2010/model_api_v2010_queue.go index f2dc32452..47a4bfd4a 100644 --- a/rest/api/v2010/model_api_v2010_queue.go +++ b/rest/api/v2010/model_api_v2010_queue.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Queue struct for ApiV2010Queue type ApiV2010Queue struct { - // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The number of calls currently in the queue. + // The number of calls currently in the queue. CurrentSize *int `json:"current_size,omitempty"` - // A string that you assigned to describe this resource. + // A string that you assigned to describe this resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The URI of this resource, relative to `https://api.twilio.com`. + // The URI of this resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Queue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Queue resource. AccountSid *string `json:"account_sid,omitempty"` - // The average wait time in seconds of the members in this queue. This is calculated at the time of the request. + // The average wait time in seconds of the members in this queue. This is calculated at the time of the request. AverageWaitTime *int `json:"average_wait_time,omitempty"` - // The unique string that that we created to identify this Queue resource. + // The unique string that that we created to identify this Queue resource. Sid *string `json:"sid,omitempty"` - // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000. + // The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000. MaxSize *int `json:"max_size,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_recording.go b/rest/api/v2010/model_api_v2010_recording.go index 4dc6135eb..e96ffd325 100644 --- a/rest/api/v2010/model_api_v2010_recording.go +++ b/rest/api/v2010/model_api_v2010_recording.go @@ -13,43 +13,48 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Recording struct for ApiV2010Recording type ApiV2010Recording struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used during the recording. + // The API version used during the recording. ApiVersion *string `json:"api_version,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. This will always refer to the parent leg of a two-leg call. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. This will always refer to the parent leg of a two-leg call. CallSid *string `json:"call_sid,omitempty"` - // The Conference SID that identifies the conference associated with the recording, if a conference recording. + // The Conference SID that identifies the conference associated with the recording, if a conference recording. ConferenceSid *string `json:"conference_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. StartTime *string `json:"start_time,omitempty"` - // The length of the recording in seconds. + // The length of the recording in seconds. Duration *string `json:"duration,omitempty"` - // The unique string that that we created to identify the Recording resource. + // The unique string that that we created to identify the Recording resource. Sid *string `json:"sid,omitempty"` - // The one-time cost of creating the recording in the `price_unit` currency. + // The one-time cost of creating the recording in the `price_unit` currency. Price *string `json:"price,omitempty"` - // The currency used in the `price` property. Example: `USD`. + // The currency used in the `price` property. Example: `USD`. PriceUnit *string `json:"price_unit,omitempty"` - Status *string `json:"status,omitempty"` - // The number of channels in the final recording file. Can be: `1` or `2`. You can split a call with two legs into two separate recording channels if you record using [TwiML Dial](https://www.twilio.com/docs/voice/twiml/dial#record) or the [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call). - Channels *int `json:"channels,omitempty"` - Source *string `json:"source,omitempty"` - // The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. + Status *string `json:"status,omitempty"` + // The number of channels in the final recording file. Can be: `1` or `2`. You can split a call with two legs into two separate recording channels if you record using [TwiML Dial](https://www.twilio.com/docs/voice/twiml/dial#record) or the [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call). + Channels *int `json:"channels,omitempty"` + Source *string `json:"source,omitempty"` + // The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. ErrorCode *int `json:"error_code,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. + // How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. EncryptionDetails *interface{} `json:"encryption_details,omitempty"` - // A list of related resources identified by their relative URIs. + // A list of related resources identified by their relative URIs. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URL of the media file associated with this recording resource. When stored externally, this is the full URL location of the media file. + // The URL of the media file associated with this recording resource. When stored externally, this is the full URL location of the media file. MediaUrl *string `json:"media_url,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_recording_add_on_result.go b/rest/api/v2010/model_api_v2010_recording_add_on_result.go index c03c79975..6e542d1f7 100644 --- a/rest/api/v2010/model_api_v2010_recording_add_on_result.go +++ b/rest/api/v2010/model_api_v2010_recording_add_on_result.go @@ -13,26 +13,31 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010RecordingAddOnResult struct for ApiV2010RecordingAddOnResult type ApiV2010RecordingAddOnResult struct { - // The unique string that that we created to identify the Recording AddOnResult resource. + // The unique string that that we created to identify the Recording AddOnResult resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource. AccountSid *string `json:"account_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The SID of the Add-on to which the result belongs. + Status *string `json:"status,omitempty"` + // The SID of the Add-on to which the result belongs. AddOnSid *string `json:"add_on_sid,omitempty"` - // The SID of the Add-on configuration. + // The SID of the Add-on configuration. AddOnConfigurationSid *string `json:"add_on_configuration_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The date and time in GMT that the result was completed specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the result was completed specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCompleted *string `json:"date_completed,omitempty"` - // The SID of the recording to which the AddOnResult resource belongs. + // The SID of the recording to which the AddOnResult resource belongs. ReferenceSid *string `json:"reference_sid,omitempty"` - // A list of related resources identified by their relative URIs. + // A list of related resources identified by their relative URIs. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_recording_add_on_result_payload.go b/rest/api/v2010/model_api_v2010_recording_add_on_result_payload.go index 17cb574ae..3ec7caecb 100644 --- a/rest/api/v2010/model_api_v2010_recording_add_on_result_payload.go +++ b/rest/api/v2010/model_api_v2010_recording_add_on_result_payload.go @@ -13,29 +13,34 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010RecordingAddOnResultPayload struct for ApiV2010RecordingAddOnResultPayload type ApiV2010RecordingAddOnResultPayload struct { - // The unique string that that we created to identify the Recording AddOnResult Payload resource. + // The unique string that that we created to identify the Recording AddOnResult Payload resource. Sid *string `json:"sid,omitempty"` - // The SID of the AddOnResult to which the payload belongs. + // The SID of the AddOnResult to which the payload belongs. AddOnResultSid *string `json:"add_on_result_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource. AccountSid *string `json:"account_sid,omitempty"` - // The string provided by the vendor that describes the payload. + // The string provided by the vendor that describes the payload. Label *string `json:"label,omitempty"` - // The SID of the Add-on to which the result belongs. + // The SID of the Add-on to which the result belongs. AddOnSid *string `json:"add_on_sid,omitempty"` - // The SID of the Add-on configuration. + // The SID of the Add-on configuration. AddOnConfigurationSid *string `json:"add_on_configuration_sid,omitempty"` - // The MIME type of the payload. + // The MIME type of the payload. ContentType *string `json:"content_type,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The SID of the recording to which the AddOnResult resource that contains the payload belongs. + // The SID of the recording to which the AddOnResult resource that contains the payload belongs. ReferenceSid *string `json:"reference_sid,omitempty"` - // A list of related resources identified by their relative URIs. + // A list of related resources identified by their relative URIs. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_recording_transcription.go b/rest/api/v2010/model_api_v2010_recording_transcription.go index 446124f87..0d2d2ec49 100644 --- a/rest/api/v2010/model_api_v2010_recording_transcription.go +++ b/rest/api/v2010/model_api_v2010_recording_transcription.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010RecordingTranscription struct for ApiV2010RecordingTranscription type ApiV2010RecordingTranscription struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the transcription. + // The API version used to create the transcription. ApiVersion *string `json:"api_version,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The duration of the transcribed audio in seconds. + // The duration of the transcribed audio in seconds. Duration *string `json:"duration,omitempty"` - // The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. + // The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. + // The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. RecordingSid *string `json:"recording_sid,omitempty"` - // The unique string that that we created to identify the Transcription resource. - Sid *string `json:"sid,omitempty"` + // The unique string that that we created to identify the Transcription resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // The text content of the transcription. + // The text content of the transcription. TranscriptionText *string `json:"transcription_text,omitempty"` - // The transcription type. + // The transcription type. Type *string `json:"type,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } func (response *ApiV2010RecordingTranscription) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - DateCreated *string `json:"date_created"` - DateUpdated *string `json:"date_updated"` - Duration *string `json:"duration"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - RecordingSid *string `json:"recording_sid"` - Sid *string `json:"sid"` - Status *string `json:"status"` - TranscriptionText *string `json:"transcription_text"` - Type *string `json:"type"` - Uri *string `json:"uri"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + DateCreated *string `json:"date_created"` + DateUpdated *string `json:"date_updated"` + Duration *string `json:"duration"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + RecordingSid *string `json:"recording_sid"` + Sid *string `json:"sid"` + Status *string `json:"status"` + TranscriptionText *string `json:"transcription_text"` + Type *string `json:"type"` + Uri *string `json:"uri"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,18 +68,18 @@ func (response *ApiV2010RecordingTranscription) UnmarshalJSON(bytes []byte) (err } *response = ApiV2010RecordingTranscription{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - DateCreated: raw.DateCreated, - DateUpdated: raw.DateUpdated, - Duration: raw.Duration, - PriceUnit: raw.PriceUnit, - RecordingSid: raw.RecordingSid, - Sid: raw.Sid, - Status: raw.Status, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + DateCreated: raw.DateCreated, + DateUpdated: raw.DateUpdated, + Duration: raw.Duration, + PriceUnit: raw.PriceUnit, + RecordingSid: raw.RecordingSid, + Sid: raw.Sid, + Status: raw.Status, TranscriptionText: raw.TranscriptionText, - Type: raw.Type, - Uri: raw.Uri, + Type: raw.Type, + Uri: raw.Uri, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -93,3 +90,4 @@ func (response *ApiV2010RecordingTranscription) UnmarshalJSON(bytes []byte) (err return } + diff --git a/rest/api/v2010/model_api_v2010_short_code.go b/rest/api/v2010/model_api_v2010_short_code.go index 773ab35f3..56d2dd4a1 100644 --- a/rest/api/v2010/model_api_v2010_short_code.go +++ b/rest/api/v2010/model_api_v2010_short_code.go @@ -13,31 +13,36 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010ShortCode struct for ApiV2010ShortCode type ApiV2010ShortCode struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this ShortCode resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this ShortCode resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to start a new TwiML session when an SMS message is sent to this short code. + // The API version used to start a new TwiML session when an SMS message is sent to this short code. ApiVersion *string `json:"api_version,omitempty"` - // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // A string that you assigned to describe this resource. By default, the `FriendlyName` is the short code. + // A string that you assigned to describe this resource. By default, the `FriendlyName` is the short code. FriendlyName *string `json:"friendly_name,omitempty"` - // The short code. e.g., 894546. + // The short code. e.g., 894546. ShortCode *string `json:"short_code,omitempty"` - // The unique string that that we created to identify this ShortCode resource. + // The unique string that that we created to identify this ShortCode resource. Sid *string `json:"sid,omitempty"` - // The HTTP method we use to call the `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call the `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call if an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call if an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call the `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call the `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call when receiving an incoming SMS message to this short code. + // The URL we call when receiving an incoming SMS message to this short code. SmsUrl *string `json:"sms_url,omitempty"` - // The URI of this resource, relative to `https://api.twilio.com`. + // The URI of this resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_signing_key.go b/rest/api/v2010/model_api_v2010_signing_key.go index fd7b72e80..132dcf369 100644 --- a/rest/api/v2010/model_api_v2010_signing_key.go +++ b/rest/api/v2010/model_api_v2010_signing_key.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SigningKey struct for ApiV2010SigningKey type ApiV2010SigningKey struct { - Sid *string `json:"sid,omitempty"` + Sid *string `json:"sid,omitempty"` FriendlyName *string `json:"friendly_name,omitempty"` - DateCreated *string `json:"date_created,omitempty"` - DateUpdated *string `json:"date_updated,omitempty"` + DateCreated *string `json:"date_created,omitempty"` + DateUpdated *string `json:"date_updated,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_auth_calls_credential_list_mapping.go b/rest/api/v2010/model_api_v2010_sip_auth_calls_credential_list_mapping.go index 4da1d174c..d084bab11 100644 --- a/rest/api/v2010/model_api_v2010_sip_auth_calls_credential_list_mapping.go +++ b/rest/api/v2010/model_api_v2010_sip_auth_calls_credential_list_mapping.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipAuthCallsCredentialListMapping struct for ApiV2010SipAuthCallsCredentialListMapping type ApiV2010SipAuthCallsCredentialListMapping struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that that we created to identify the CredentialListMapping resource. + // The unique string that that we created to identify the CredentialListMapping resource. Sid *string `json:"sid,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_auth_calls_ip_access_control_list_mapping.go b/rest/api/v2010/model_api_v2010_sip_auth_calls_ip_access_control_list_mapping.go index e48592902..a8addbae2 100644 --- a/rest/api/v2010/model_api_v2010_sip_auth_calls_ip_access_control_list_mapping.go +++ b/rest/api/v2010/model_api_v2010_sip_auth_calls_ip_access_control_list_mapping.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipAuthCallsIpAccessControlListMapping struct for ApiV2010SipAuthCallsIpAccessControlListMapping type ApiV2010SipAuthCallsIpAccessControlListMapping struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that that we created to identify the IpAccessControlListMapping resource. + // The unique string that that we created to identify the IpAccessControlListMapping resource. Sid *string `json:"sid,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_auth_registrations_credential_list_mapping.go b/rest/api/v2010/model_api_v2010_sip_auth_registrations_credential_list_mapping.go index 379aa24e9..3dd33e057 100644 --- a/rest/api/v2010/model_api_v2010_sip_auth_registrations_credential_list_mapping.go +++ b/rest/api/v2010/model_api_v2010_sip_auth_registrations_credential_list_mapping.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipAuthRegistrationsCredentialListMapping struct for ApiV2010SipAuthRegistrationsCredentialListMapping type ApiV2010SipAuthRegistrationsCredentialListMapping struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that that we created to identify the CredentialListMapping resource. + // The unique string that that we created to identify the CredentialListMapping resource. Sid *string `json:"sid,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_credential.go b/rest/api/v2010/model_api_v2010_sip_credential.go index 01b61599b..1d9de779d 100644 --- a/rest/api/v2010/model_api_v2010_sip_credential.go +++ b/rest/api/v2010/model_api_v2010_sip_credential.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipCredential struct for ApiV2010SipCredential type ApiV2010SipCredential struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique id of the Account that is responsible for this resource. + // The unique id of the Account that is responsible for this resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique id that identifies the credential list that includes this credential. + // The unique id that identifies the credential list that includes this credential. CredentialListSid *string `json:"credential_list_sid,omitempty"` - // The username for this credential. + // The username for this credential. Username *string `json:"username,omitempty"` - // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com` + // The URI for this resource, relative to `https://api.twilio.com` Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_credential_list.go b/rest/api/v2010/model_api_v2010_sip_credential_list.go index 672a6f725..15b33a4a1 100644 --- a/rest/api/v2010/model_api_v2010_sip_credential_list.go +++ b/rest/api/v2010/model_api_v2010_sip_credential_list.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipCredentialList struct for ApiV2010SipCredentialList type ApiV2010SipCredentialList struct { - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // A human readable descriptive text that describes the CredentialList, up to 64 characters long. + // A human readable descriptive text that describes the CredentialList, up to 64 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // A list of credentials associated with this credential list. + // A list of credentials associated with this credential list. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com`. + // The URI for this resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_credential_list_mapping.go b/rest/api/v2010/model_api_v2010_sip_credential_list_mapping.go index 315e619c2..3c1ddbc3f 100644 --- a/rest/api/v2010/model_api_v2010_sip_credential_list_mapping.go +++ b/rest/api/v2010/model_api_v2010_sip_credential_list_mapping.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipCredentialListMapping struct for ApiV2010SipCredentialListMapping type ApiV2010SipCredentialListMapping struct { - // The unique id of the Account that is responsible for this resource. + // The unique id of the Account that is responsible for this resource. AccountSid *string `json:"account_sid,omitempty"` - // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // The unique string that is created to identify the SipDomain resource. + // The unique string that is created to identify the SipDomain resource. DomainSid *string `json:"domain_sid,omitempty"` - // A human readable descriptive text for this resource, up to 64 characters long. + // A human readable descriptive text for this resource, up to 64 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com` + // The URI for this resource, relative to `https://api.twilio.com` Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_domain.go b/rest/api/v2010/model_api_v2010_sip_domain.go index 8e10787bb..14aec9ffb 100644 --- a/rest/api/v2010/model_api_v2010_sip_domain.go +++ b/rest/api/v2010/model_api_v2010_sip_domain.go @@ -13,49 +13,54 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipDomain struct for ApiV2010SipDomain type ApiV2010SipDomain struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to process the call. + // The API version used to process the call. ApiVersion *string `json:"api_version,omitempty"` - // The types of authentication you have mapped to your domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If you have both defined for your domain, both will be returned in a comma delimited string. If `auth_type` is not defined, the domain will not be able to receive any traffic. + // The types of authentication you have mapped to your domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If you have both defined for your domain, both will be returned in a comma delimited string. If `auth_type` is not defined, the domain will not be able to receive any traffic. AuthType *string `json:"auth_type,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with `sip.twilio.com`. + // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with `sip.twilio.com`. DomainName *string `json:"domain_name,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that that we created to identify the SipDomain resource. + // The unique string that that we created to identify the SipDomain resource. Sid *string `json:"sid,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The HTTP method we use to call `voice_status_callback_url`. Either `GET` or `POST`. + // The HTTP method we use to call `voice_status_callback_url`. Either `GET` or `POST`. VoiceStatusCallbackMethod *string `json:"voice_status_callback_method,omitempty"` - // The URL that we call to pass status parameters (such as call ended) to your application. + // The URL that we call to pass status parameters (such as call ended) to your application. VoiceStatusCallbackUrl *string `json:"voice_status_callback_url,omitempty"` - // The URL we call using the `voice_method` when the domain receives a call. + // The URL we call using the `voice_method` when the domain receives a call. VoiceUrl *string `json:"voice_url,omitempty"` - // A list of mapping resources associated with the SIP Domain resource identified by their relative URIs. + // A list of mapping resources associated with the SIP Domain resource identified by their relative URIs. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // Whether to allow SIP Endpoints to register with the domain to receive calls. + // Whether to allow SIP Endpoints to register with the domain to receive calls. SipRegistration *bool `json:"sip_registration,omitempty"` - // Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. + // Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. EmergencyCallingEnabled *bool `json:"emergency_calling_enabled,omitempty"` - // Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. + // Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. Secure *bool `json:"secure,omitempty"` - // The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. + // The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. ByocTrunkSid *string `json:"byoc_trunk_sid,omitempty"` - // Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. + // Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. EmergencyCallerSid *string `json:"emergency_caller_sid,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_ip_access_control_list.go b/rest/api/v2010/model_api_v2010_sip_ip_access_control_list.go index 50d952da3..e2438bfa1 100644 --- a/rest/api/v2010/model_api_v2010_sip_ip_access_control_list.go +++ b/rest/api/v2010/model_api_v2010_sip_ip_access_control_list.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipIpAccessControlList struct for ApiV2010SipIpAccessControlList type ApiV2010SipIpAccessControlList struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. + // The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // A human readable descriptive text, up to 255 characters long. + // A human readable descriptive text, up to 255 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // A list of the IpAddress resources associated with this IP access control list resource. + // A list of the IpAddress resources associated with this IP access control list resource. SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com` + // The URI for this resource, relative to `https://api.twilio.com` Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_ip_access_control_list_mapping.go b/rest/api/v2010/model_api_v2010_sip_ip_access_control_list_mapping.go index 863595dcd..06f5e24c0 100644 --- a/rest/api/v2010/model_api_v2010_sip_ip_access_control_list_mapping.go +++ b/rest/api/v2010/model_api_v2010_sip_ip_access_control_list_mapping.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipIpAccessControlListMapping struct for ApiV2010SipIpAccessControlListMapping type ApiV2010SipIpAccessControlListMapping struct { - // The unique id of the Account that is responsible for this resource. + // The unique id of the Account that is responsible for this resource. AccountSid *string `json:"account_sid,omitempty"` - // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // The unique string that is created to identify the SipDomain resource. + // The unique string that is created to identify the SipDomain resource. DomainSid *string `json:"domain_sid,omitempty"` - // A human readable descriptive text for this resource, up to 64 characters long. + // A human readable descriptive text for this resource, up to 64 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com` + // The URI for this resource, relative to `https://api.twilio.com` Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_sip_ip_address.go b/rest/api/v2010/model_api_v2010_sip_ip_address.go index 5e60a2674..99416812a 100644 --- a/rest/api/v2010/model_api_v2010_sip_ip_address.go +++ b/rest/api/v2010/model_api_v2010_sip_ip_address.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010SipIpAddress struct for ApiV2010SipIpAddress type ApiV2010SipIpAddress struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique id of the Account that is responsible for this resource. + // The unique id of the Account that is responsible for this resource. AccountSid *string `json:"account_sid,omitempty"` - // A human readable descriptive text for this resource, up to 255 characters long. + // A human readable descriptive text for this resource, up to 255 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. + // An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. IpAddress *string `json:"ip_address,omitempty"` - // An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. + // An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. CidrPrefixLength *int `json:"cidr_prefix_length,omitempty"` - // The unique id of the IpAccessControlList resource that includes this resource. + // The unique id of the IpAccessControlList resource that includes this resource. IpAccessControlListSid *string `json:"ip_access_control_list_sid,omitempty"` - // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateCreated *string `json:"date_created,omitempty"` - // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + // The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI for this resource, relative to `https://api.twilio.com` + // The URI for this resource, relative to `https://api.twilio.com` Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_siprec.go b/rest/api/v2010/model_api_v2010_siprec.go index a7afd8b5c..130a50703 100644 --- a/rest/api/v2010/model_api_v2010_siprec.go +++ b/rest/api/v2010/model_api_v2010_siprec.go @@ -13,20 +13,25 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Siprec struct for ApiV2010Siprec type ApiV2010Siprec struct { - // The SID of the Siprec resource. + // The SID of the Siprec resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Siprec resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Siprec resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. - Name *string `json:"name,omitempty"` + // The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. + Name *string `json:"name,omitempty"` Status *string `json:"status,omitempty"` - // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_stream.go b/rest/api/v2010/model_api_v2010_stream.go index 98713b293..9932b6018 100644 --- a/rest/api/v2010/model_api_v2010_stream.go +++ b/rest/api/v2010/model_api_v2010_stream.go @@ -13,20 +13,25 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Stream struct for ApiV2010Stream type ApiV2010Stream struct { - // The SID of the Stream resource. + // The SID of the Stream resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. CallSid *string `json:"call_sid,omitempty"` - // The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. - Name *string `json:"name,omitempty"` + // The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. + Name *string `json:"name,omitempty"` Status *string `json:"status,omitempty"` - // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_token.go b/rest/api/v2010/model_api_v2010_token.go index b9aa290b1..b5f4b592a 100644 --- a/rest/api/v2010/model_api_v2010_token.go +++ b/rest/api/v2010/model_api_v2010_token.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010Token struct for ApiV2010Token type ApiV2010Token struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // An array representing the ephemeral credentials and the STUN and TURN server URIs. + // An array representing the ephemeral credentials and the STUN and TURN server URIs. IceServers *[]ApiV2010AccountTokenIceServers `json:"ice_servers,omitempty"` - // The temporary password that the username will use when authenticating with Twilio. + // The temporary password that the username will use when authenticating with Twilio. Password *string `json:"password,omitempty"` - // The duration in seconds for which the username and password are valid. + // The duration in seconds for which the username and password are valid. Ttl *string `json:"ttl,omitempty"` - // The temporary username that uniquely identifies a Token. + // The temporary username that uniquely identifies a Token. Username *string `json:"username,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_transcription.go b/rest/api/v2010/model_api_v2010_transcription.go index 635c20141..6687d0f7b 100644 --- a/rest/api/v2010/model_api_v2010_transcription.go +++ b/rest/api/v2010/model_api_v2010_transcription.go @@ -13,57 +13,54 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010Transcription struct for ApiV2010Transcription type ApiV2010Transcription struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the transcription. + // The API version used to create the transcription. ApiVersion *string `json:"api_version,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The duration of the transcribed audio in seconds. + // The duration of the transcribed audio in seconds. Duration *string `json:"duration,omitempty"` - // The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. + // The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. + // The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. RecordingSid *string `json:"recording_sid,omitempty"` - // The unique string that that we created to identify the Transcription resource. - Sid *string `json:"sid,omitempty"` + // The unique string that that we created to identify the Transcription resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // The text content of the transcription. + // The text content of the transcription. TranscriptionText *string `json:"transcription_text,omitempty"` - // The transcription type. Can only be: `fast`. + // The transcription type. Can only be: `fast`. Type *string `json:"type,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } func (response *ApiV2010Transcription) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - DateCreated *string `json:"date_created"` - DateUpdated *string `json:"date_updated"` - Duration *string `json:"duration"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - RecordingSid *string `json:"recording_sid"` - Sid *string `json:"sid"` - Status *string `json:"status"` - TranscriptionText *string `json:"transcription_text"` - Type *string `json:"type"` - Uri *string `json:"uri"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + DateCreated *string `json:"date_created"` + DateUpdated *string `json:"date_updated"` + Duration *string `json:"duration"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + RecordingSid *string `json:"recording_sid"` + Sid *string `json:"sid"` + Status *string `json:"status"` + TranscriptionText *string `json:"transcription_text"` + Type *string `json:"type"` + Uri *string `json:"uri"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -71,18 +68,18 @@ func (response *ApiV2010Transcription) UnmarshalJSON(bytes []byte) (err error) { } *response = ApiV2010Transcription{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - DateCreated: raw.DateCreated, - DateUpdated: raw.DateUpdated, - Duration: raw.Duration, - PriceUnit: raw.PriceUnit, - RecordingSid: raw.RecordingSid, - Sid: raw.Sid, - Status: raw.Status, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + DateCreated: raw.DateCreated, + DateUpdated: raw.DateUpdated, + Duration: raw.Duration, + PriceUnit: raw.PriceUnit, + RecordingSid: raw.RecordingSid, + Sid: raw.Sid, + Status: raw.Status, TranscriptionText: raw.TranscriptionText, - Type: raw.Type, - Uri: raw.Uri, + Type: raw.Type, + Uri: raw.Uri, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -93,3 +90,4 @@ func (response *ApiV2010Transcription) UnmarshalJSON(bytes []byte) (err error) { return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record.go b/rest/api/v2010/model_api_v2010_usage_record.go index 6fb061349..c9004fa68 100644 --- a/rest/api/v2010/model_api_v2010_usage_record.go +++ b/rest/api/v2010/model_api_v2010_usage_record.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecord struct for ApiV2010UsageRecord type ApiV2010UsageRecord struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecord) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecord) UnmarshalJSON(bytes []byte) (err error) { } *response = ApiV2010UsageRecord{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecord) UnmarshalJSON(bytes []byte) (err error) { return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_all_time.go b/rest/api/v2010/model_api_v2010_usage_record_all_time.go index c5e0beb93..8c751f58e 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_all_time.go +++ b/rest/api/v2010/model_api_v2010_usage_record_all_time.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordAllTime struct for ApiV2010UsageRecordAllTime type ApiV2010UsageRecordAllTime struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordAllTime) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordAllTime) UnmarshalJSON(bytes []byte) (err err } *response = ApiV2010UsageRecordAllTime{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordAllTime) UnmarshalJSON(bytes []byte) (err err return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_daily.go b/rest/api/v2010/model_api_v2010_usage_record_daily.go index 4fbd1a022..4b3de7dd5 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_daily.go +++ b/rest/api/v2010/model_api_v2010_usage_record_daily.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordDaily struct for ApiV2010UsageRecordDaily type ApiV2010UsageRecordDaily struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordDaily) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordDaily) UnmarshalJSON(bytes []byte) (err error } *response = ApiV2010UsageRecordDaily{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordDaily) UnmarshalJSON(bytes []byte) (err error return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_last_month.go b/rest/api/v2010/model_api_v2010_usage_record_last_month.go index 38349c9a7..5d3d2af78 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_last_month.go +++ b/rest/api/v2010/model_api_v2010_usage_record_last_month.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordLastMonth struct for ApiV2010UsageRecordLastMonth type ApiV2010UsageRecordLastMonth struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordLastMonth) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordLastMonth) UnmarshalJSON(bytes []byte) (err e } *response = ApiV2010UsageRecordLastMonth{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordLastMonth) UnmarshalJSON(bytes []byte) (err e return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_monthly.go b/rest/api/v2010/model_api_v2010_usage_record_monthly.go index 9128a868b..e95d7449c 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_monthly.go +++ b/rest/api/v2010/model_api_v2010_usage_record_monthly.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordMonthly struct for ApiV2010UsageRecordMonthly type ApiV2010UsageRecordMonthly struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordMonthly) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordMonthly) UnmarshalJSON(bytes []byte) (err err } *response = ApiV2010UsageRecordMonthly{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordMonthly) UnmarshalJSON(bytes []byte) (err err return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_this_month.go b/rest/api/v2010/model_api_v2010_usage_record_this_month.go index 33af5d732..755987339 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_this_month.go +++ b/rest/api/v2010/model_api_v2010_usage_record_this_month.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordThisMonth struct for ApiV2010UsageRecordThisMonth type ApiV2010UsageRecordThisMonth struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordThisMonth) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordThisMonth) UnmarshalJSON(bytes []byte) (err e } *response = ApiV2010UsageRecordThisMonth{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordThisMonth) UnmarshalJSON(bytes []byte) (err e return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_today.go b/rest/api/v2010/model_api_v2010_usage_record_today.go index 16b37846b..11953b453 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_today.go +++ b/rest/api/v2010/model_api_v2010_usage_record_today.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordToday struct for ApiV2010UsageRecordToday type ApiV2010UsageRecordToday struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordToday) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordToday) UnmarshalJSON(bytes []byte) (err error } *response = ApiV2010UsageRecordToday{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordToday) UnmarshalJSON(bytes []byte) (err error return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_yearly.go b/rest/api/v2010/model_api_v2010_usage_record_yearly.go index 9df8614e1..df53a6279 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_yearly.go +++ b/rest/api/v2010/model_api_v2010_usage_record_yearly.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordYearly struct for ApiV2010UsageRecordYearly type ApiV2010UsageRecordYearly struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordYearly) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordYearly) UnmarshalJSON(bytes []byte) (err erro } *response = ApiV2010UsageRecordYearly{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordYearly) UnmarshalJSON(bytes []byte) (err erro return } + diff --git a/rest/api/v2010/model_api_v2010_usage_record_yesterday.go b/rest/api/v2010/model_api_v2010_usage_record_yesterday.go index 84a629f95..ff9241d52 100644 --- a/rest/api/v2010/model_api_v2010_usage_record_yesterday.go +++ b/rest/api/v2010/model_api_v2010_usage_record_yesterday.go @@ -13,63 +13,60 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // ApiV2010UsageRecordYesterday struct for ApiV2010UsageRecordYesterday type ApiV2010UsageRecordYesterday struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - AsOf *string `json:"as_of,omitempty"` + // Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + AsOf *string `json:"as_of,omitempty"` Category *string `json:"category,omitempty"` - // The number of usage events, such as the number of calls. + // The number of usage events, such as the number of calls. Count *string `json:"count,omitempty"` - // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + // The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. CountUnit *string `json:"count_unit,omitempty"` - // A plain-language description of the usage category. + // A plain-language description of the usage category. Description *string `json:"description,omitempty"` - // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. EndDate *string `json:"end_date,omitempty"` - // The total price of the usage in the currency specified in `price_unit` and associated with the account. + // The total price of the usage in the currency specified in `price_unit` and associated with the account. Price *float32 `json:"price,omitempty"` - // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + // The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. PriceUnit *string `json:"price_unit,omitempty"` - // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + // The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. StartDate *string `json:"start_date,omitempty"` - // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + // A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). SubresourceUris *map[string]interface{} `json:"subresource_uris,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. + // The URI of the resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` - // The amount used to bill usage and measured in units described in `usage_unit`. + // The amount used to bill usage and measured in units described in `usage_unit`. Usage *string `json:"usage,omitempty"` - // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + // The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. UsageUnit *string `json:"usage_unit,omitempty"` } func (response *ApiV2010UsageRecordYesterday) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - ApiVersion *string `json:"api_version"` - AsOf *string `json:"as_of"` - Category *string `json:"category"` - Count *string `json:"count"` - CountUnit *string `json:"count_unit"` - Description *string `json:"description"` - EndDate *string `json:"end_date"` - Price *interface{} `json:"price"` - PriceUnit *string `json:"price_unit"` - StartDate *string `json:"start_date"` + AccountSid *string `json:"account_sid"` + ApiVersion *string `json:"api_version"` + AsOf *string `json:"as_of"` + Category *string `json:"category"` + Count *string `json:"count"` + CountUnit *string `json:"count_unit"` + Description *string `json:"description"` + EndDate *string `json:"end_date"` + Price *interface{} `json:"price"` + PriceUnit *string `json:"price_unit"` + StartDate *string `json:"start_date"` SubresourceUris *map[string]interface{} `json:"subresource_uris"` - Uri *string `json:"uri"` - Usage *string `json:"usage"` - UsageUnit *string `json:"usage_unit"` + Uri *string `json:"uri"` + Usage *string `json:"usage"` + UsageUnit *string `json:"usage_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,20 +74,20 @@ func (response *ApiV2010UsageRecordYesterday) UnmarshalJSON(bytes []byte) (err e } *response = ApiV2010UsageRecordYesterday{ - AccountSid: raw.AccountSid, - ApiVersion: raw.ApiVersion, - AsOf: raw.AsOf, - Category: raw.Category, - Count: raw.Count, - CountUnit: raw.CountUnit, - Description: raw.Description, - EndDate: raw.EndDate, - PriceUnit: raw.PriceUnit, - StartDate: raw.StartDate, + AccountSid: raw.AccountSid, + ApiVersion: raw.ApiVersion, + AsOf: raw.AsOf, + Category: raw.Category, + Count: raw.Count, + CountUnit: raw.CountUnit, + Description: raw.Description, + EndDate: raw.EndDate, + PriceUnit: raw.PriceUnit, + StartDate: raw.StartDate, SubresourceUris: raw.SubresourceUris, - Uri: raw.Uri, - Usage: raw.Usage, - UsageUnit: raw.UsageUnit, + Uri: raw.Uri, + Usage: raw.Usage, + UsageUnit: raw.UsageUnit, } responsePrice, err := client.UnmarshalFloat32(raw.Price) @@ -101,3 +98,4 @@ func (response *ApiV2010UsageRecordYesterday) UnmarshalJSON(bytes []byte) (err e return } + diff --git a/rest/api/v2010/model_api_v2010_usage_trigger.go b/rest/api/v2010/model_api_v2010_usage_trigger.go index 7b878c551..c70819bc7 100644 --- a/rest/api/v2010/model_api_v2010_usage_trigger.go +++ b/rest/api/v2010/model_api_v2010_usage_trigger.go @@ -13,36 +13,41 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010UsageTrigger struct for ApiV2010UsageTrigger type ApiV2010UsageTrigger struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the trigger monitors. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the trigger monitors. AccountSid *string `json:"account_sid,omitempty"` - // The API version used to create the resource. + // The API version used to create the resource. ApiVersion *string `json:"api_version,omitempty"` - // The HTTP method we use to call `callback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `callback_url`. Can be: `GET` or `POST`. CallbackMethod *string `json:"callback_method,omitempty"` - // The URL we call using the `callback_method` when the trigger fires. + // The URL we call using the `callback_method` when the trigger fires. CallbackUrl *string `json:"callback_url,omitempty"` - // The current value of the field the trigger is watching. + // The current value of the field the trigger is watching. CurrentValue *string `json:"current_value,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *string `json:"date_created,omitempty"` - // The date and time in GMT that the trigger was last fired specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the trigger was last fired specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateFired *string `json:"date_fired,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *string `json:"date_updated,omitempty"` - // The string that you assigned to describe the trigger. + // The string that you assigned to describe the trigger. FriendlyName *string `json:"friendly_name,omitempty"` - Recurring *string `json:"recurring,omitempty"` - // The unique string that that we created to identify the UsageTrigger resource. - Sid *string `json:"sid,omitempty"` + Recurring *string `json:"recurring,omitempty"` + // The unique string that that we created to identify the UsageTrigger resource. + Sid *string `json:"sid,omitempty"` TriggerBy *string `json:"trigger_by,omitempty"` - // The value at which the trigger will fire. Must be a positive, numeric value. + // The value at which the trigger will fire. Must be a positive, numeric value. TriggerValue *string `json:"trigger_value,omitempty"` - // The URI of the resource, relative to `https://api.twilio.com`. - Uri *string `json:"uri,omitempty"` + // The URI of the resource, relative to `https://api.twilio.com`. + Uri *string `json:"uri,omitempty"` UsageCategory *string `json:"usage_category,omitempty"` - // The URI of the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to `https://api.twilio.com`. + // The URI of the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to `https://api.twilio.com`. UsageRecordUri *string `json:"usage_record_uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_user_defined_message.go b/rest/api/v2010/model_api_v2010_user_defined_message.go index 31bb8599e..904f62560 100644 --- a/rest/api/v2010/model_api_v2010_user_defined_message.go +++ b/rest/api/v2010/model_api_v2010_user_defined_message.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010UserDefinedMessage struct for ApiV2010UserDefinedMessage type ApiV2010UserDefinedMessage struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message is associated with. CallSid *string `json:"call_sid,omitempty"` - // The SID that uniquely identifies this User Defined Message. + // The SID that uniquely identifies this User Defined Message. Sid *string `json:"sid,omitempty"` - // The date that this User Defined Message was created, given in RFC 2822 format. + // The date that this User Defined Message was created, given in RFC 2822 format. DateCreated *string `json:"date_created,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_user_defined_message_subscription.go b/rest/api/v2010/model_api_v2010_user_defined_message_subscription.go index 427c72b71..c44f789c3 100644 --- a/rest/api/v2010/model_api_v2010_user_defined_message_subscription.go +++ b/rest/api/v2010/model_api_v2010_user_defined_message_subscription.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010UserDefinedMessageSubscription struct for ApiV2010UserDefinedMessageSubscription type ApiV2010UserDefinedMessageSubscription struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message Subscription is associated with. This refers to the Call SID that is producing the User Defined Messages. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message Subscription is associated with. This refers to the Call SID that is producing the User Defined Messages. CallSid *string `json:"call_sid,omitempty"` - // The SID that uniquely identifies this User Defined Message Subscription. + // The SID that uniquely identifies this User Defined Message Subscription. Sid *string `json:"sid,omitempty"` - // The date that this User Defined Message Subscription was created, given in RFC 2822 format. + // The date that this User Defined Message Subscription was created, given in RFC 2822 format. DateCreated *string `json:"date_created,omitempty"` - // The URI of the User Defined Message Subscription Resource, relative to `https://api.twilio.com`. + // The URI of the User Defined Message Subscription Resource, relative to `https://api.twilio.com`. Uri *string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_api_v2010_validation_request.go b/rest/api/v2010/model_api_v2010_validation_request.go index 385a7400d..0a0a0026c 100644 --- a/rest/api/v2010/model_api_v2010_validation_request.go +++ b/rest/api/v2010/model_api_v2010_validation_request.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ApiV2010ValidationRequest struct for ApiV2010ValidationRequest type ApiV2010ValidationRequest struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the Caller ID. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the Caller ID. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Caller ID is associated with. + // The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Caller ID is associated with. CallSid *string `json:"call_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The 6 digit validation code that someone must enter to validate the Caller ID when `phone_number` is called. + // The 6 digit validation code that someone must enter to validate the Caller ID when `phone_number` is called. ValidationCode *string `json:"validation_code,omitempty"` } + + diff --git a/rest/api/v2010/model_list_account_response.go b/rest/api/v2010/model_list_account_response.go index 4150b3a2b..ba03e7189 100644 --- a/rest/api/v2010/model_list_account_response.go +++ b/rest/api/v2010/model_list_account_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAccountResponse struct for ListAccountResponse type ListAccountResponse struct { - Accounts []ApiV2010Account `json:"accounts,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Accounts []ApiV2010Account `json:"accounts,omitempty"` } + + diff --git a/rest/api/v2010/model_list_address_response.go b/rest/api/v2010/model_list_address_response.go index 73401ca65..77b2900d8 100644 --- a/rest/api/v2010/model_list_address_response.go +++ b/rest/api/v2010/model_list_address_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAddressResponse struct for ListAddressResponse type ListAddressResponse struct { - Addresses []ApiV2010Address `json:"addresses,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Addresses []ApiV2010Address `json:"addresses,omitempty"` } + + diff --git a/rest/api/v2010/model_list_application_response.go b/rest/api/v2010/model_list_application_response.go index 846988f8b..2f036fb0f 100644 --- a/rest/api/v2010/model_list_application_response.go +++ b/rest/api/v2010/model_list_application_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListApplicationResponse struct for ListApplicationResponse type ListApplicationResponse struct { - Applications []ApiV2010Application `json:"applications,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Applications []ApiV2010Application `json:"applications,omitempty"` } + + diff --git a/rest/api/v2010/model_list_authorized_connect_app_response.go b/rest/api/v2010/model_list_authorized_connect_app_response.go index 5a93cbbeb..aa6a3b944 100644 --- a/rest/api/v2010/model_list_authorized_connect_app_response.go +++ b/rest/api/v2010/model_list_authorized_connect_app_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAuthorizedConnectAppResponse struct for ListAuthorizedConnectAppResponse type ListAuthorizedConnectAppResponse struct { AuthorizedConnectApps []ApiV2010AuthorizedConnectApp `json:"authorized_connect_apps,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_country_response.go b/rest/api/v2010/model_list_available_phone_number_country_response.go index 9f7c452f7..ee7f9575e 100644 --- a/rest/api/v2010/model_list_available_phone_number_country_response.go +++ b/rest/api/v2010/model_list_available_phone_number_country_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberCountryResponse struct for ListAvailablePhoneNumberCountryResponse type ListAvailablePhoneNumberCountryResponse struct { - Countries []ApiV2010AvailablePhoneNumberCountry `json:"countries,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Countries []ApiV2010AvailablePhoneNumberCountry `json:"countries,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_local_response.go b/rest/api/v2010/model_list_available_phone_number_local_response.go index f6bb02248..01b5ad8dc 100644 --- a/rest/api/v2010/model_list_available_phone_number_local_response.go +++ b/rest/api/v2010/model_list_available_phone_number_local_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberLocalResponse struct for ListAvailablePhoneNumberLocalResponse type ListAvailablePhoneNumberLocalResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberLocal `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_machine_to_machine_response.go b/rest/api/v2010/model_list_available_phone_number_machine_to_machine_response.go index 5ccf592dd..60c4a19f0 100644 --- a/rest/api/v2010/model_list_available_phone_number_machine_to_machine_response.go +++ b/rest/api/v2010/model_list_available_phone_number_machine_to_machine_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberMachineToMachineResponse struct for ListAvailablePhoneNumberMachineToMachineResponse type ListAvailablePhoneNumberMachineToMachineResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberMachineToMachine `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_mobile_response.go b/rest/api/v2010/model_list_available_phone_number_mobile_response.go index abe65de84..fcd69eec2 100644 --- a/rest/api/v2010/model_list_available_phone_number_mobile_response.go +++ b/rest/api/v2010/model_list_available_phone_number_mobile_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberMobileResponse struct for ListAvailablePhoneNumberMobileResponse type ListAvailablePhoneNumberMobileResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberMobile `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_national_response.go b/rest/api/v2010/model_list_available_phone_number_national_response.go index ae58f2e32..28b682325 100644 --- a/rest/api/v2010/model_list_available_phone_number_national_response.go +++ b/rest/api/v2010/model_list_available_phone_number_national_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberNationalResponse struct for ListAvailablePhoneNumberNationalResponse type ListAvailablePhoneNumberNationalResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberNational `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_shared_cost_response.go b/rest/api/v2010/model_list_available_phone_number_shared_cost_response.go index 6a1875669..54cd2ba28 100644 --- a/rest/api/v2010/model_list_available_phone_number_shared_cost_response.go +++ b/rest/api/v2010/model_list_available_phone_number_shared_cost_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberSharedCostResponse struct for ListAvailablePhoneNumberSharedCostResponse type ListAvailablePhoneNumberSharedCostResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberSharedCost `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_toll_free_response.go b/rest/api/v2010/model_list_available_phone_number_toll_free_response.go index 64c3033ae..ffa1f9e9b 100644 --- a/rest/api/v2010/model_list_available_phone_number_toll_free_response.go +++ b/rest/api/v2010/model_list_available_phone_number_toll_free_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberTollFreeResponse struct for ListAvailablePhoneNumberTollFreeResponse type ListAvailablePhoneNumberTollFreeResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberTollFree `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_available_phone_number_voip_response.go b/rest/api/v2010/model_list_available_phone_number_voip_response.go index fcc19968a..04e3a63af 100644 --- a/rest/api/v2010/model_list_available_phone_number_voip_response.go +++ b/rest/api/v2010/model_list_available_phone_number_voip_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAvailablePhoneNumberVoipResponse struct for ListAvailablePhoneNumberVoipResponse type ListAvailablePhoneNumberVoipResponse struct { AvailablePhoneNumbers []ApiV2010AvailablePhoneNumberVoip `json:"available_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_call_event_response.go b/rest/api/v2010/model_list_call_event_response.go index 377073f2d..15b2045db 100644 --- a/rest/api/v2010/model_list_call_event_response.go +++ b/rest/api/v2010/model_list_call_event_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCallEventResponse struct for ListCallEventResponse type ListCallEventResponse struct { - Events []ApiV2010CallEvent `json:"events,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Events []ApiV2010CallEvent `json:"events,omitempty"` } + + diff --git a/rest/api/v2010/model_list_call_notification_response.go b/rest/api/v2010/model_list_call_notification_response.go index eb1e47e3c..6b8cbbab7 100644 --- a/rest/api/v2010/model_list_call_notification_response.go +++ b/rest/api/v2010/model_list_call_notification_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCallNotificationResponse struct for ListCallNotificationResponse type ListCallNotificationResponse struct { - Notifications []ApiV2010CallNotification `json:"notifications,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Notifications []ApiV2010CallNotification `json:"notifications,omitempty"` } + + diff --git a/rest/api/v2010/model_list_call_recording_response.go b/rest/api/v2010/model_list_call_recording_response.go index 0ba3ac1c0..cb19962d6 100644 --- a/rest/api/v2010/model_list_call_recording_response.go +++ b/rest/api/v2010/model_list_call_recording_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCallRecordingResponse struct for ListCallRecordingResponse type ListCallRecordingResponse struct { - Recordings []ApiV2010CallRecording `json:"recordings,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Recordings []ApiV2010CallRecording `json:"recordings,omitempty"` } + + diff --git a/rest/api/v2010/model_list_call_response.go b/rest/api/v2010/model_list_call_response.go index d8bc900f6..0bc62a7c7 100644 --- a/rest/api/v2010/model_list_call_response.go +++ b/rest/api/v2010/model_list_call_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCallResponse struct for ListCallResponse type ListCallResponse struct { - Calls []ApiV2010Call `json:"calls,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Calls []ApiV2010Call `json:"calls,omitempty"` } + + diff --git a/rest/api/v2010/model_list_conference_recording_response.go b/rest/api/v2010/model_list_conference_recording_response.go index 772d9c575..931c43ba4 100644 --- a/rest/api/v2010/model_list_conference_recording_response.go +++ b/rest/api/v2010/model_list_conference_recording_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConferenceRecordingResponse struct for ListConferenceRecordingResponse type ListConferenceRecordingResponse struct { - Recordings []ApiV2010ConferenceRecording `json:"recordings,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Recordings []ApiV2010ConferenceRecording `json:"recordings,omitempty"` } + + diff --git a/rest/api/v2010/model_list_conference_response.go b/rest/api/v2010/model_list_conference_response.go index 65f1a7955..8a11d2f33 100644 --- a/rest/api/v2010/model_list_conference_response.go +++ b/rest/api/v2010/model_list_conference_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConferenceResponse struct for ListConferenceResponse type ListConferenceResponse struct { - Conferences []ApiV2010Conference `json:"conferences,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Conferences []ApiV2010Conference `json:"conferences,omitempty"` } + + diff --git a/rest/api/v2010/model_list_connect_app_response.go b/rest/api/v2010/model_list_connect_app_response.go index ecb2e5038..19e93c866 100644 --- a/rest/api/v2010/model_list_connect_app_response.go +++ b/rest/api/v2010/model_list_connect_app_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConnectAppResponse struct for ListConnectAppResponse type ListConnectAppResponse struct { - ConnectApps []ApiV2010ConnectApp `json:"connect_apps,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + ConnectApps []ApiV2010ConnectApp `json:"connect_apps,omitempty"` } + + diff --git a/rest/api/v2010/model_list_dependent_phone_number_response.go b/rest/api/v2010/model_list_dependent_phone_number_response.go index 31dc22ad8..6f3d660f5 100644 --- a/rest/api/v2010/model_list_dependent_phone_number_response.go +++ b/rest/api/v2010/model_list_dependent_phone_number_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDependentPhoneNumberResponse struct for ListDependentPhoneNumberResponse type ListDependentPhoneNumberResponse struct { DependentPhoneNumbers []ApiV2010DependentPhoneNumber `json:"dependent_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_extension_response.go b/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_extension_response.go index 5af790e23..eb3de77bf 100644 --- a/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_extension_response.go +++ b/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_extension_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIncomingPhoneNumberAssignedAddOnExtensionResponse struct for ListIncomingPhoneNumberAssignedAddOnExtensionResponse type ListIncomingPhoneNumberAssignedAddOnExtensionResponse struct { - Extensions []ApiV2010IncomingPhoneNumberAssignedAddOnExtension `json:"extensions,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Extensions []ApiV2010IncomingPhoneNumberAssignedAddOnExtension `json:"extensions,omitempty"` } + + diff --git a/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_response.go b/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_response.go index 0cc23ec03..27de86fc0 100644 --- a/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_response.go +++ b/rest/api/v2010/model_list_incoming_phone_number_assigned_add_on_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIncomingPhoneNumberAssignedAddOnResponse struct for ListIncomingPhoneNumberAssignedAddOnResponse type ListIncomingPhoneNumberAssignedAddOnResponse struct { - AssignedAddOns []ApiV2010IncomingPhoneNumberAssignedAddOn `json:"assigned_add_ons,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + AssignedAddOns []ApiV2010IncomingPhoneNumberAssignedAddOn `json:"assigned_add_ons,omitempty"` } + + diff --git a/rest/api/v2010/model_list_incoming_phone_number_local_response.go b/rest/api/v2010/model_list_incoming_phone_number_local_response.go index 3c178537d..bcb9cb561 100644 --- a/rest/api/v2010/model_list_incoming_phone_number_local_response.go +++ b/rest/api/v2010/model_list_incoming_phone_number_local_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIncomingPhoneNumberLocalResponse struct for ListIncomingPhoneNumberLocalResponse type ListIncomingPhoneNumberLocalResponse struct { IncomingPhoneNumbers []ApiV2010IncomingPhoneNumberLocal `json:"incoming_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_incoming_phone_number_mobile_response.go b/rest/api/v2010/model_list_incoming_phone_number_mobile_response.go index 5f8b980e3..4e7629a3b 100644 --- a/rest/api/v2010/model_list_incoming_phone_number_mobile_response.go +++ b/rest/api/v2010/model_list_incoming_phone_number_mobile_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIncomingPhoneNumberMobileResponse struct for ListIncomingPhoneNumberMobileResponse type ListIncomingPhoneNumberMobileResponse struct { IncomingPhoneNumbers []ApiV2010IncomingPhoneNumberMobile `json:"incoming_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_incoming_phone_number_response.go b/rest/api/v2010/model_list_incoming_phone_number_response.go index 081afb0b2..9749fdd40 100644 --- a/rest/api/v2010/model_list_incoming_phone_number_response.go +++ b/rest/api/v2010/model_list_incoming_phone_number_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIncomingPhoneNumberResponse struct for ListIncomingPhoneNumberResponse type ListIncomingPhoneNumberResponse struct { IncomingPhoneNumbers []ApiV2010IncomingPhoneNumber `json:"incoming_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_incoming_phone_number_toll_free_response.go b/rest/api/v2010/model_list_incoming_phone_number_toll_free_response.go index 416be708b..747e98784 100644 --- a/rest/api/v2010/model_list_incoming_phone_number_toll_free_response.go +++ b/rest/api/v2010/model_list_incoming_phone_number_toll_free_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIncomingPhoneNumberTollFreeResponse struct for ListIncomingPhoneNumberTollFreeResponse type ListIncomingPhoneNumberTollFreeResponse struct { IncomingPhoneNumbers []ApiV2010IncomingPhoneNumberTollFree `json:"incoming_phone_numbers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_key_response.go b/rest/api/v2010/model_list_key_response.go index 8c9a50789..158aaf7d2 100644 --- a/rest/api/v2010/model_list_key_response.go +++ b/rest/api/v2010/model_list_key_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListKeyResponse struct for ListKeyResponse type ListKeyResponse struct { - Keys []ApiV2010Key `json:"keys,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Keys []ApiV2010Key `json:"keys,omitempty"` } + + diff --git a/rest/api/v2010/model_list_media_response.go b/rest/api/v2010/model_list_media_response.go index 8a7dee440..e8adc2154 100644 --- a/rest/api/v2010/model_list_media_response.go +++ b/rest/api/v2010/model_list_media_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMediaResponse struct for ListMediaResponse type ListMediaResponse struct { - MediaList []ApiV2010Media `json:"media_list,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + MediaList []ApiV2010Media `json:"media_list,omitempty"` } + + diff --git a/rest/api/v2010/model_list_member_response.go b/rest/api/v2010/model_list_member_response.go index ec994467d..3306f9be6 100644 --- a/rest/api/v2010/model_list_member_response.go +++ b/rest/api/v2010/model_list_member_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMemberResponse struct for ListMemberResponse type ListMemberResponse struct { - QueueMembers []ApiV2010Member `json:"queue_members,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + QueueMembers []ApiV2010Member `json:"queue_members,omitempty"` } + + diff --git a/rest/api/v2010/model_list_message_response.go b/rest/api/v2010/model_list_message_response.go index 8c6d5da81..b9f0fe447 100644 --- a/rest/api/v2010/model_list_message_response.go +++ b/rest/api/v2010/model_list_message_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessageResponse struct for ListMessageResponse type ListMessageResponse struct { - Messages []ApiV2010Message `json:"messages,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Messages []ApiV2010Message `json:"messages,omitempty"` } + + diff --git a/rest/api/v2010/model_list_notification_response.go b/rest/api/v2010/model_list_notification_response.go index 36c830127..f902cb5b7 100644 --- a/rest/api/v2010/model_list_notification_response.go +++ b/rest/api/v2010/model_list_notification_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListNotificationResponse struct for ListNotificationResponse type ListNotificationResponse struct { - Notifications []ApiV2010Notification `json:"notifications,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Notifications []ApiV2010Notification `json:"notifications,omitempty"` } + + diff --git a/rest/api/v2010/model_list_outgoing_caller_id_response.go b/rest/api/v2010/model_list_outgoing_caller_id_response.go index 87cbc0cb4..556cf3d91 100644 --- a/rest/api/v2010/model_list_outgoing_caller_id_response.go +++ b/rest/api/v2010/model_list_outgoing_caller_id_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListOutgoingCallerIdResponse struct for ListOutgoingCallerIdResponse type ListOutgoingCallerIdResponse struct { OutgoingCallerIds []ApiV2010OutgoingCallerId `json:"outgoing_caller_ids,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_participant_response.go b/rest/api/v2010/model_list_participant_response.go index 1c4255699..8623d7ce8 100644 --- a/rest/api/v2010/model_list_participant_response.go +++ b/rest/api/v2010/model_list_participant_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListParticipantResponse struct for ListParticipantResponse type ListParticipantResponse struct { - Participants []ApiV2010Participant `json:"participants,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Participants []ApiV2010Participant `json:"participants,omitempty"` } + + diff --git a/rest/api/v2010/model_list_queue_response.go b/rest/api/v2010/model_list_queue_response.go index 68d9f7e90..743bb5029 100644 --- a/rest/api/v2010/model_list_queue_response.go +++ b/rest/api/v2010/model_list_queue_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListQueueResponse struct for ListQueueResponse type ListQueueResponse struct { - Queues []ApiV2010Queue `json:"queues,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Queues []ApiV2010Queue `json:"queues,omitempty"` } + + diff --git a/rest/api/v2010/model_list_recording_add_on_result_payload_response.go b/rest/api/v2010/model_list_recording_add_on_result_payload_response.go index 05216d15a..7d2fff52c 100644 --- a/rest/api/v2010/model_list_recording_add_on_result_payload_response.go +++ b/rest/api/v2010/model_list_recording_add_on_result_payload_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRecordingAddOnResultPayloadResponse struct for ListRecordingAddOnResultPayloadResponse type ListRecordingAddOnResultPayloadResponse struct { - Payloads []ApiV2010RecordingAddOnResultPayload `json:"payloads,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Payloads []ApiV2010RecordingAddOnResultPayload `json:"payloads,omitempty"` } + + diff --git a/rest/api/v2010/model_list_recording_add_on_result_response.go b/rest/api/v2010/model_list_recording_add_on_result_response.go index 34827b9f5..7302cc515 100644 --- a/rest/api/v2010/model_list_recording_add_on_result_response.go +++ b/rest/api/v2010/model_list_recording_add_on_result_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRecordingAddOnResultResponse struct for ListRecordingAddOnResultResponse type ListRecordingAddOnResultResponse struct { - AddOnResults []ApiV2010RecordingAddOnResult `json:"add_on_results,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + AddOnResults []ApiV2010RecordingAddOnResult `json:"add_on_results,omitempty"` } + + diff --git a/rest/api/v2010/model_list_recording_response.go b/rest/api/v2010/model_list_recording_response.go index 23123590c..85b6454d0 100644 --- a/rest/api/v2010/model_list_recording_response.go +++ b/rest/api/v2010/model_list_recording_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRecordingResponse struct for ListRecordingResponse type ListRecordingResponse struct { - Recordings []ApiV2010Recording `json:"recordings,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Recordings []ApiV2010Recording `json:"recordings,omitempty"` } + + diff --git a/rest/api/v2010/model_list_recording_transcription_response.go b/rest/api/v2010/model_list_recording_transcription_response.go index 16ab144a5..eea36c4fc 100644 --- a/rest/api/v2010/model_list_recording_transcription_response.go +++ b/rest/api/v2010/model_list_recording_transcription_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRecordingTranscriptionResponse struct for ListRecordingTranscriptionResponse type ListRecordingTranscriptionResponse struct { - Transcriptions []ApiV2010RecordingTranscription `json:"transcriptions,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Transcriptions []ApiV2010RecordingTranscription `json:"transcriptions,omitempty"` } + + diff --git a/rest/api/v2010/model_list_short_code_response.go b/rest/api/v2010/model_list_short_code_response.go index 408938f16..a180dd5ca 100644 --- a/rest/api/v2010/model_list_short_code_response.go +++ b/rest/api/v2010/model_list_short_code_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListShortCodeResponse struct for ListShortCodeResponse type ListShortCodeResponse struct { - ShortCodes []ApiV2010ShortCode `json:"short_codes,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + ShortCodes []ApiV2010ShortCode `json:"short_codes,omitempty"` } + + diff --git a/rest/api/v2010/model_list_signing_key_response.go b/rest/api/v2010/model_list_signing_key_response.go index cd1c7edd9..f4b9d5461 100644 --- a/rest/api/v2010/model_list_signing_key_response.go +++ b/rest/api/v2010/model_list_signing_key_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSigningKeyResponse struct for ListSigningKeyResponse type ListSigningKeyResponse struct { - SigningKeys []ApiV2010SigningKey `json:"signing_keys,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + SigningKeys []ApiV2010SigningKey `json:"signing_keys,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_auth_calls_credential_list_mapping_response.go b/rest/api/v2010/model_list_sip_auth_calls_credential_list_mapping_response.go index 2489b3b22..152b6fa0a 100644 --- a/rest/api/v2010/model_list_sip_auth_calls_credential_list_mapping_response.go +++ b/rest/api/v2010/model_list_sip_auth_calls_credential_list_mapping_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipAuthCallsCredentialListMappingResponse struct for ListSipAuthCallsCredentialListMappingResponse type ListSipAuthCallsCredentialListMappingResponse struct { - Contents []ApiV2010SipAuthCallsCredentialListMapping `json:"contents,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Contents []ApiV2010SipAuthCallsCredentialListMapping `json:"contents,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_auth_calls_ip_access_control_list_mapping_response.go b/rest/api/v2010/model_list_sip_auth_calls_ip_access_control_list_mapping_response.go index 0a2615d2a..09d17874c 100644 --- a/rest/api/v2010/model_list_sip_auth_calls_ip_access_control_list_mapping_response.go +++ b/rest/api/v2010/model_list_sip_auth_calls_ip_access_control_list_mapping_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipAuthCallsIpAccessControlListMappingResponse struct for ListSipAuthCallsIpAccessControlListMappingResponse type ListSipAuthCallsIpAccessControlListMappingResponse struct { - Contents []ApiV2010SipAuthCallsIpAccessControlListMapping `json:"contents,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Contents []ApiV2010SipAuthCallsIpAccessControlListMapping `json:"contents,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_auth_registrations_credential_list_mapping_response.go b/rest/api/v2010/model_list_sip_auth_registrations_credential_list_mapping_response.go index 73f8b93e7..67097e226 100644 --- a/rest/api/v2010/model_list_sip_auth_registrations_credential_list_mapping_response.go +++ b/rest/api/v2010/model_list_sip_auth_registrations_credential_list_mapping_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipAuthRegistrationsCredentialListMappingResponse struct for ListSipAuthRegistrationsCredentialListMappingResponse type ListSipAuthRegistrationsCredentialListMappingResponse struct { - Contents []ApiV2010SipAuthRegistrationsCredentialListMapping `json:"contents,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Contents []ApiV2010SipAuthRegistrationsCredentialListMapping `json:"contents,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_credential_list_mapping_response.go b/rest/api/v2010/model_list_sip_credential_list_mapping_response.go index 4a73b162b..22ea11b32 100644 --- a/rest/api/v2010/model_list_sip_credential_list_mapping_response.go +++ b/rest/api/v2010/model_list_sip_credential_list_mapping_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipCredentialListMappingResponse struct for ListSipCredentialListMappingResponse type ListSipCredentialListMappingResponse struct { CredentialListMappings []ApiV2010SipCredentialListMapping `json:"credential_list_mappings,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_credential_list_response.go b/rest/api/v2010/model_list_sip_credential_list_response.go index 23cb57b12..333753bde 100644 --- a/rest/api/v2010/model_list_sip_credential_list_response.go +++ b/rest/api/v2010/model_list_sip_credential_list_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipCredentialListResponse struct for ListSipCredentialListResponse type ListSipCredentialListResponse struct { CredentialLists []ApiV2010SipCredentialList `json:"credential_lists,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_credential_response.go b/rest/api/v2010/model_list_sip_credential_response.go index 6e79cba1d..168a69cc9 100644 --- a/rest/api/v2010/model_list_sip_credential_response.go +++ b/rest/api/v2010/model_list_sip_credential_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipCredentialResponse struct for ListSipCredentialResponse type ListSipCredentialResponse struct { - Credentials []ApiV2010SipCredential `json:"credentials,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Credentials []ApiV2010SipCredential `json:"credentials,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_domain_response.go b/rest/api/v2010/model_list_sip_domain_response.go index 539e1350d..8f7387d10 100644 --- a/rest/api/v2010/model_list_sip_domain_response.go +++ b/rest/api/v2010/model_list_sip_domain_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipDomainResponse struct for ListSipDomainResponse type ListSipDomainResponse struct { - Domains []ApiV2010SipDomain `json:"domains,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Domains []ApiV2010SipDomain `json:"domains,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_ip_access_control_list_mapping_response.go b/rest/api/v2010/model_list_sip_ip_access_control_list_mapping_response.go index 9621ce8cf..89253b04d 100644 --- a/rest/api/v2010/model_list_sip_ip_access_control_list_mapping_response.go +++ b/rest/api/v2010/model_list_sip_ip_access_control_list_mapping_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipIpAccessControlListMappingResponse struct for ListSipIpAccessControlListMappingResponse type ListSipIpAccessControlListMappingResponse struct { IpAccessControlListMappings []ApiV2010SipIpAccessControlListMapping `json:"ip_access_control_list_mappings,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_ip_access_control_list_response.go b/rest/api/v2010/model_list_sip_ip_access_control_list_response.go index 0d5b2cbea..cc96e322d 100644 --- a/rest/api/v2010/model_list_sip_ip_access_control_list_response.go +++ b/rest/api/v2010/model_list_sip_ip_access_control_list_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipIpAccessControlListResponse struct for ListSipIpAccessControlListResponse type ListSipIpAccessControlListResponse struct { IpAccessControlLists []ApiV2010SipIpAccessControlList `json:"ip_access_control_lists,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` } + + diff --git a/rest/api/v2010/model_list_sip_ip_address_response.go b/rest/api/v2010/model_list_sip_ip_address_response.go index b0c13f486..cc01f97d9 100644 --- a/rest/api/v2010/model_list_sip_ip_address_response.go +++ b/rest/api/v2010/model_list_sip_ip_address_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSipIpAddressResponse struct for ListSipIpAddressResponse type ListSipIpAddressResponse struct { - IpAddresses []ApiV2010SipIpAddress `json:"ip_addresses,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + IpAddresses []ApiV2010SipIpAddress `json:"ip_addresses,omitempty"` } + + diff --git a/rest/api/v2010/model_list_transcription_response.go b/rest/api/v2010/model_list_transcription_response.go index 24cc34ecc..6b50b451c 100644 --- a/rest/api/v2010/model_list_transcription_response.go +++ b/rest/api/v2010/model_list_transcription_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTranscriptionResponse struct for ListTranscriptionResponse type ListTranscriptionResponse struct { - Transcriptions []ApiV2010Transcription `json:"transcriptions,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + Transcriptions []ApiV2010Transcription `json:"transcriptions,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_all_time_response.go b/rest/api/v2010/model_list_usage_record_all_time_response.go index 669ec58ef..2d0b26eea 100644 --- a/rest/api/v2010/model_list_usage_record_all_time_response.go +++ b/rest/api/v2010/model_list_usage_record_all_time_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordAllTimeResponse struct for ListUsageRecordAllTimeResponse type ListUsageRecordAllTimeResponse struct { - UsageRecords []ApiV2010UsageRecordAllTime `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordAllTime `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_daily_response.go b/rest/api/v2010/model_list_usage_record_daily_response.go index 2ba82669a..35be1bada 100644 --- a/rest/api/v2010/model_list_usage_record_daily_response.go +++ b/rest/api/v2010/model_list_usage_record_daily_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordDailyResponse struct for ListUsageRecordDailyResponse type ListUsageRecordDailyResponse struct { - UsageRecords []ApiV2010UsageRecordDaily `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordDaily `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_last_month_response.go b/rest/api/v2010/model_list_usage_record_last_month_response.go index 3bec92618..701767c84 100644 --- a/rest/api/v2010/model_list_usage_record_last_month_response.go +++ b/rest/api/v2010/model_list_usage_record_last_month_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordLastMonthResponse struct for ListUsageRecordLastMonthResponse type ListUsageRecordLastMonthResponse struct { - UsageRecords []ApiV2010UsageRecordLastMonth `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordLastMonth `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_monthly_response.go b/rest/api/v2010/model_list_usage_record_monthly_response.go index 3781c88ee..75f0fb24a 100644 --- a/rest/api/v2010/model_list_usage_record_monthly_response.go +++ b/rest/api/v2010/model_list_usage_record_monthly_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordMonthlyResponse struct for ListUsageRecordMonthlyResponse type ListUsageRecordMonthlyResponse struct { - UsageRecords []ApiV2010UsageRecordMonthly `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordMonthly `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_response.go b/rest/api/v2010/model_list_usage_record_response.go index 4a31e5cad..f6cc90df4 100644 --- a/rest/api/v2010/model_list_usage_record_response.go +++ b/rest/api/v2010/model_list_usage_record_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordResponse struct for ListUsageRecordResponse type ListUsageRecordResponse struct { - UsageRecords []ApiV2010UsageRecord `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecord `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_this_month_response.go b/rest/api/v2010/model_list_usage_record_this_month_response.go index 295841eba..1d15e62d0 100644 --- a/rest/api/v2010/model_list_usage_record_this_month_response.go +++ b/rest/api/v2010/model_list_usage_record_this_month_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordThisMonthResponse struct for ListUsageRecordThisMonthResponse type ListUsageRecordThisMonthResponse struct { - UsageRecords []ApiV2010UsageRecordThisMonth `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordThisMonth `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_today_response.go b/rest/api/v2010/model_list_usage_record_today_response.go index 95ec1a7ed..887987b47 100644 --- a/rest/api/v2010/model_list_usage_record_today_response.go +++ b/rest/api/v2010/model_list_usage_record_today_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordTodayResponse struct for ListUsageRecordTodayResponse type ListUsageRecordTodayResponse struct { - UsageRecords []ApiV2010UsageRecordToday `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordToday `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_yearly_response.go b/rest/api/v2010/model_list_usage_record_yearly_response.go index 992a7f7de..860cfe44c 100644 --- a/rest/api/v2010/model_list_usage_record_yearly_response.go +++ b/rest/api/v2010/model_list_usage_record_yearly_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordYearlyResponse struct for ListUsageRecordYearlyResponse type ListUsageRecordYearlyResponse struct { - UsageRecords []ApiV2010UsageRecordYearly `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordYearly `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_record_yesterday_response.go b/rest/api/v2010/model_list_usage_record_yesterday_response.go index fca198a20..5426fc863 100644 --- a/rest/api/v2010/model_list_usage_record_yesterday_response.go +++ b/rest/api/v2010/model_list_usage_record_yesterday_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordYesterdayResponse struct for ListUsageRecordYesterdayResponse type ListUsageRecordYesterdayResponse struct { - UsageRecords []ApiV2010UsageRecordYesterday `json:"usage_records,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageRecords []ApiV2010UsageRecordYesterday `json:"usage_records,omitempty"` } + + diff --git a/rest/api/v2010/model_list_usage_trigger_response.go b/rest/api/v2010/model_list_usage_trigger_response.go index 87228b9cd..becf42a33 100644 --- a/rest/api/v2010/model_list_usage_trigger_response.go +++ b/rest/api/v2010/model_list_usage_trigger_response.go @@ -13,16 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageTriggerResponse struct for ListUsageTriggerResponse type ListUsageTriggerResponse struct { - UsageTriggers []ApiV2010UsageTrigger `json:"usage_triggers,omitempty"` - End int `json:"end,omitempty"` - FirstPageUri string `json:"first_page_uri,omitempty"` - NextPageUri *string `json:"next_page_uri,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` - PreviousPageUri *string `json:"previous_page_uri,omitempty"` - Start int `json:"start,omitempty"` - Uri string `json:"uri,omitempty"` + UsageTriggers []ApiV2010UsageTrigger `json:"usage_triggers,omitempty"` } + + diff --git a/rest/autopilot/v1/README.md b/rest/autopilot/v1/README.md index bbed2c42e..a94fb11a0 100644 --- a/rest/autopilot/v1/README.md +++ b/rest/autopilot/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/autopilot/v1/api_service.go b/rest/autopilot/v1/api_service.go index 87ab7481e..d235f9220 100644 --- a/rest/autopilot/v1/api_service.go +++ b/rest/autopilot/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://autopilot.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/autopilot/v1/assistants.go b/rest/autopilot/v1/assistants.go index 38e5c7736..86efde2fb 100644 --- a/rest/autopilot/v1/assistants.go +++ b/rest/autopilot/v1/assistants.go @@ -18,203 +18,209 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAssistant' type CreateAssistantParams struct { - // A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - LogQueries *bool `json:"LogQueries,omitempty"` - // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - UniqueName *string `json:"UniqueName,omitempty"` - // Reserved. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // Reserved. - CallbackEvents *string `json:"CallbackEvents,omitempty"` - // The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) - StyleSheet *interface{} `json:"StyleSheet,omitempty"` - // A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. - Defaults *interface{} `json:"Defaults,omitempty"` + // A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + LogQueries *bool `json:"LogQueries,omitempty"` + // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + UniqueName *string `json:"UniqueName,omitempty"` + // Reserved. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // Reserved. + CallbackEvents *string `json:"CallbackEvents,omitempty"` + // The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + StyleSheet *interface{} `json:"StyleSheet,omitempty"` + // A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + Defaults *interface{} `json:"Defaults,omitempty"` } -func (params *CreateAssistantParams) SetFriendlyName(FriendlyName string) *CreateAssistantParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateAssistantParams) SetFriendlyName(FriendlyName string) (*CreateAssistantParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateAssistantParams) SetLogQueries(LogQueries bool) *CreateAssistantParams { - params.LogQueries = &LogQueries - return params +func (params *CreateAssistantParams) SetLogQueries(LogQueries bool) (*CreateAssistantParams){ + params.LogQueries = &LogQueries + return params } -func (params *CreateAssistantParams) SetUniqueName(UniqueName string) *CreateAssistantParams { - params.UniqueName = &UniqueName - return params +func (params *CreateAssistantParams) SetUniqueName(UniqueName string) (*CreateAssistantParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateAssistantParams) SetCallbackUrl(CallbackUrl string) *CreateAssistantParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *CreateAssistantParams) SetCallbackUrl(CallbackUrl string) (*CreateAssistantParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *CreateAssistantParams) SetCallbackEvents(CallbackEvents string) *CreateAssistantParams { - params.CallbackEvents = &CallbackEvents - return params +func (params *CreateAssistantParams) SetCallbackEvents(CallbackEvents string) (*CreateAssistantParams){ + params.CallbackEvents = &CallbackEvents + return params } -func (params *CreateAssistantParams) SetStyleSheet(StyleSheet interface{}) *CreateAssistantParams { - params.StyleSheet = &StyleSheet - return params +func (params *CreateAssistantParams) SetStyleSheet(StyleSheet interface{}) (*CreateAssistantParams){ + params.StyleSheet = &StyleSheet + return params } -func (params *CreateAssistantParams) SetDefaults(Defaults interface{}) *CreateAssistantParams { - params.Defaults = &Defaults - return params +func (params *CreateAssistantParams) SetDefaults(Defaults interface{}) (*CreateAssistantParams){ + params.Defaults = &Defaults + return params } -// +// func (c *ApiService) CreateAssistant(params *CreateAssistantParams) (*AutopilotV1Assistant, error) { - path := "/v1/Assistants" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.LogQueries != nil { - data.Set("LogQueries", fmt.Sprint(*params.LogQueries)) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.CallbackEvents != nil { - data.Set("CallbackEvents", *params.CallbackEvents) - } - if params != nil && params.StyleSheet != nil { - v, err := json.Marshal(params.StyleSheet) + path := "/v1/Assistants" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.LogQueries != nil { + data.Set("LogQueries", fmt.Sprint(*params.LogQueries)) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.CallbackEvents != nil { + data.Set("CallbackEvents", *params.CallbackEvents) + } + if params != nil && params.StyleSheet != nil { + v, err := json.Marshal(params.StyleSheet) + + if err != nil { + return nil, err + } + + data.Set("StyleSheet", string(v)) + } + if params != nil && params.Defaults != nil { + v, err := json.Marshal(params.Defaults) + + if err != nil { + return nil, err + } + + data.Set("Defaults", string(v)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Assistant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteAssistant(Sid string, ) (error) { + path := "/v1/Assistants/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data.Set("StyleSheet", string(v)) - } - if params != nil && params.Defaults != nil { - v, err := json.Marshal(params.Defaults) + data := url.Values{} + headers := make(map[string]interface{}) - if err != nil { - return nil, err - } - data.Set("Defaults", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1Assistant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return nil } -// -func (c *ApiService) DeleteAssistant(Sid string) error { - path := "/v1/Assistants/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchAssistant(Sid string, ) (*AutopilotV1Assistant, error) { + path := "/v1/Assistants/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchAssistant(Sid string) (*AutopilotV1Assistant, error) { - path := "/v1/Assistants/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &AutopilotV1Assistant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &AutopilotV1Assistant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListAssistant' type ListAssistantParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAssistantParams) SetPageSize(PageSize int) *ListAssistantParams { - params.PageSize = &PageSize - return params +func (params *ListAssistantParams) SetPageSize(PageSize int) (*ListAssistantParams){ + params.PageSize = &PageSize + return params } -func (params *ListAssistantParams) SetLimit(Limit int) *ListAssistantParams { - params.Limit = &Limit - return params +func (params *ListAssistantParams) SetLimit(Limit int) (*ListAssistantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Assistant records from the API. Request is executed immediately. func (c *ApiService) PageAssistant(params *ListAssistantParams, pageToken, pageNumber string) (*ListAssistantResponse, error) { - path := "/v1/Assistants" + path := "/v1/Assistants" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAssistantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAssistantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Assistant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -255,6 +261,7 @@ func (c *ApiService) StreamAssistant(params *ListAssistantParams) (chan Autopilo return recordChannel, errorChannel } + func (c *ApiService) streamAssistant(response *ListAssistantResponse, params *ListAssistantParams, recordChannel chan AutopilotV1Assistant, errorChannel chan error) { curRecord := 1 @@ -286,132 +293,134 @@ func (c *ApiService) streamAssistant(response *ListAssistantResponse, params *Li } func (c *ApiService) getNextListAssistantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAssistantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAssistantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateAssistant' type UpdateAssistantParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - LogQueries *bool `json:"LogQueries,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - UniqueName *string `json:"UniqueName,omitempty"` - // Reserved. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // Reserved. - CallbackEvents *string `json:"CallbackEvents,omitempty"` - // The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) - StyleSheet *interface{} `json:"StyleSheet,omitempty"` - // A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. - Defaults *interface{} `json:"Defaults,omitempty"` - // A string describing the state of the assistant. - DevelopmentStage *string `json:"DevelopmentStage,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + LogQueries *bool `json:"LogQueries,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + UniqueName *string `json:"UniqueName,omitempty"` + // Reserved. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // Reserved. + CallbackEvents *string `json:"CallbackEvents,omitempty"` + // The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) + StyleSheet *interface{} `json:"StyleSheet,omitempty"` + // A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. + Defaults *interface{} `json:"Defaults,omitempty"` + // A string describing the state of the assistant. + DevelopmentStage *string `json:"DevelopmentStage,omitempty"` } -func (params *UpdateAssistantParams) SetFriendlyName(FriendlyName string) *UpdateAssistantParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateAssistantParams) SetFriendlyName(FriendlyName string) (*UpdateAssistantParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateAssistantParams) SetLogQueries(LogQueries bool) *UpdateAssistantParams { - params.LogQueries = &LogQueries - return params +func (params *UpdateAssistantParams) SetLogQueries(LogQueries bool) (*UpdateAssistantParams){ + params.LogQueries = &LogQueries + return params } -func (params *UpdateAssistantParams) SetUniqueName(UniqueName string) *UpdateAssistantParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateAssistantParams) SetUniqueName(UniqueName string) (*UpdateAssistantParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateAssistantParams) SetCallbackUrl(CallbackUrl string) *UpdateAssistantParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *UpdateAssistantParams) SetCallbackUrl(CallbackUrl string) (*UpdateAssistantParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *UpdateAssistantParams) SetCallbackEvents(CallbackEvents string) *UpdateAssistantParams { - params.CallbackEvents = &CallbackEvents - return params +func (params *UpdateAssistantParams) SetCallbackEvents(CallbackEvents string) (*UpdateAssistantParams){ + params.CallbackEvents = &CallbackEvents + return params } -func (params *UpdateAssistantParams) SetStyleSheet(StyleSheet interface{}) *UpdateAssistantParams { - params.StyleSheet = &StyleSheet - return params +func (params *UpdateAssistantParams) SetStyleSheet(StyleSheet interface{}) (*UpdateAssistantParams){ + params.StyleSheet = &StyleSheet + return params } -func (params *UpdateAssistantParams) SetDefaults(Defaults interface{}) *UpdateAssistantParams { - params.Defaults = &Defaults - return params +func (params *UpdateAssistantParams) SetDefaults(Defaults interface{}) (*UpdateAssistantParams){ + params.Defaults = &Defaults + return params } -func (params *UpdateAssistantParams) SetDevelopmentStage(DevelopmentStage string) *UpdateAssistantParams { - params.DevelopmentStage = &DevelopmentStage - return params +func (params *UpdateAssistantParams) SetDevelopmentStage(DevelopmentStage string) (*UpdateAssistantParams){ + params.DevelopmentStage = &DevelopmentStage + return params } -// +// func (c *ApiService) UpdateAssistant(Sid string, params *UpdateAssistantParams) (*AutopilotV1Assistant, error) { - path := "/v1/Assistants/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.LogQueries != nil { - data.Set("LogQueries", fmt.Sprint(*params.LogQueries)) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.CallbackEvents != nil { - data.Set("CallbackEvents", *params.CallbackEvents) - } - if params != nil && params.StyleSheet != nil { - v, err := json.Marshal(params.StyleSheet) - - if err != nil { - return nil, err - } - - data.Set("StyleSheet", string(v)) - } - if params != nil && params.Defaults != nil { - v, err := json.Marshal(params.Defaults) - - if err != nil { - return nil, err - } - - data.Set("Defaults", string(v)) - } - if params != nil && params.DevelopmentStage != nil { - data.Set("DevelopmentStage", *params.DevelopmentStage) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &AutopilotV1Assistant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Assistants/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.LogQueries != nil { + data.Set("LogQueries", fmt.Sprint(*params.LogQueries)) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.CallbackEvents != nil { + data.Set("CallbackEvents", *params.CallbackEvents) + } + if params != nil && params.StyleSheet != nil { + v, err := json.Marshal(params.StyleSheet) + + if err != nil { + return nil, err + } + + data.Set("StyleSheet", string(v)) + } + if params != nil && params.Defaults != nil { + v, err := json.Marshal(params.Defaults) + + if err != nil { + return nil, err + } + + data.Set("Defaults", string(v)) + } + if params != nil && params.DevelopmentStage != nil { + data.Set("DevelopmentStage", *params.DevelopmentStage) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Assistant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/autopilot/v1/assistants_defaults.go b/rest/autopilot/v1/assistants_defaults.go index 1de206914..82af290fa 100644 --- a/rest/autopilot/v1/assistants_defaults.go +++ b/rest/autopilot/v1/assistants_defaults.go @@ -16,73 +16,79 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchDefaults(AssistantSid string) (*AutopilotV1Defaults, error) { - path := "/v1/Assistants/{AssistantSid}/Defaults" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchDefaults(AssistantSid string, ) (*AutopilotV1Defaults, error) { + path := "/v1/Assistants/{AssistantSid}/Defaults" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1Defaults{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1Defaults{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateDefaults' type UpdateDefaultsParams struct { - // A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. - Defaults *interface{} `json:"Defaults,omitempty"` + // A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + Defaults *interface{} `json:"Defaults,omitempty"` } -func (params *UpdateDefaultsParams) SetDefaults(Defaults interface{}) *UpdateDefaultsParams { - params.Defaults = &Defaults - return params +func (params *UpdateDefaultsParams) SetDefaults(Defaults interface{}) (*UpdateDefaultsParams){ + params.Defaults = &Defaults + return params } -// +// func (c *ApiService) UpdateDefaults(AssistantSid string, params *UpdateDefaultsParams) (*AutopilotV1Defaults, error) { - path := "/v1/Assistants/{AssistantSid}/Defaults" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path := "/v1/Assistants/{AssistantSid}/Defaults" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Defaults != nil { + v, err := json.Marshal(params.Defaults) - if params != nil && params.Defaults != nil { - v, err := json.Marshal(params.Defaults) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Defaults", string(v)) + } - data.Set("Defaults", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1Defaults{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1Defaults{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_dialogues.go b/rest/autopilot/v1/assistants_dialogues.go index c045a66ad..9a847b858 100644 --- a/rest/autopilot/v1/assistants_dialogues.go +++ b/rest/autopilot/v1/assistants_dialogues.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchDialogue(AssistantSid string, Sid string) (*AutopilotV1Dialogue, error) { - path := "/v1/Assistants/{AssistantSid}/Dialogues/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchDialogue(AssistantSid string, Sid string, ) (*AutopilotV1Dialogue, error) { + path := "/v1/Assistants/{AssistantSid}/Dialogues/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1Dialogue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1Dialogue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_field_types.go b/rest/autopilot/v1/assistants_field_types.go index c025306b3..4f6851bdb 100644 --- a/rest/autopilot/v1/assistants_field_types.go +++ b/rest/autopilot/v1/assistants_field_types.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateFieldType' type CreateFieldTypeParams struct { - // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - UniqueName *string `json:"UniqueName,omitempty"` - // A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + UniqueName *string `json:"UniqueName,omitempty"` + // A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateFieldTypeParams) SetUniqueName(UniqueName string) *CreateFieldTypeParams { - params.UniqueName = &UniqueName - return params +func (params *CreateFieldTypeParams) SetUniqueName(UniqueName string) (*CreateFieldTypeParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateFieldTypeParams) SetFriendlyName(FriendlyName string) *CreateFieldTypeParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateFieldTypeParams) SetFriendlyName(FriendlyName string) (*CreateFieldTypeParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateFieldType(AssistantSid string, params *CreateFieldTypeParams) (*AutopilotV1FieldType, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path := "/v1/Assistants/{AssistantSid}/FieldTypes" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1FieldType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AutopilotV1FieldType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteFieldType(AssistantSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteFieldType(AssistantSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchFieldType(AssistantSid string, Sid string) (*AutopilotV1FieldType, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchFieldType(AssistantSid string, Sid string, ) (*AutopilotV1FieldType, error) { + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AutopilotV1FieldType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &AutopilotV1FieldType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFieldType' type ListFieldTypeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFieldTypeParams) SetPageSize(PageSize int) *ListFieldTypeParams { - params.PageSize = &PageSize - return params +func (params *ListFieldTypeParams) SetPageSize(PageSize int) (*ListFieldTypeParams){ + params.PageSize = &PageSize + return params } -func (params *ListFieldTypeParams) SetLimit(Limit int) *ListFieldTypeParams { - params.Limit = &Limit - return params +func (params *ListFieldTypeParams) SetLimit(Limit int) (*ListFieldTypeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of FieldType records from the API. Request is executed immediately. func (c *ApiService) PageFieldType(AssistantSid string, params *ListFieldTypeParams, pageToken, pageNumber string) (*ListFieldTypeResponse, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes" + path := "/v1/Assistants/{AssistantSid}/FieldTypes" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFieldTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFieldTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists FieldType records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamFieldType(AssistantSid string, params *ListFieldTypeP return recordChannel, errorChannel } + func (c *ApiService) streamFieldType(response *ListFieldTypeResponse, params *ListFieldTypeParams, recordChannel chan AutopilotV1FieldType, errorChannel chan error) { curRecord := 1 @@ -234,67 +240,69 @@ func (c *ApiService) streamFieldType(response *ListFieldTypeResponse, params *Li } func (c *ApiService) getNextListFieldTypeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFieldTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFieldTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateFieldType' type UpdateFieldTypeParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - UniqueName *string `json:"UniqueName,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. + UniqueName *string `json:"UniqueName,omitempty"` } -func (params *UpdateFieldTypeParams) SetFriendlyName(FriendlyName string) *UpdateFieldTypeParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateFieldTypeParams) SetFriendlyName(FriendlyName string) (*UpdateFieldTypeParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateFieldTypeParams) SetUniqueName(UniqueName string) *UpdateFieldTypeParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateFieldTypeParams) SetUniqueName(UniqueName string) (*UpdateFieldTypeParams){ + params.UniqueName = &UniqueName + return params } -// +// func (c *ApiService) UpdateFieldType(AssistantSid string, Sid string, params *UpdateFieldTypeParams) (*AutopilotV1FieldType, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1FieldType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AutopilotV1FieldType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_field_types_field_values.go b/rest/autopilot/v1/assistants_field_types_field_values.go index af7e52632..e32f4e7cc 100644 --- a/rest/autopilot/v1/assistants_field_types_field_values.go +++ b/rest/autopilot/v1/assistants_field_types_field_values.go @@ -18,173 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateFieldValue' type CreateFieldValueParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - Language *string `json:"Language,omitempty"` - // The Field Value data. - Value *string `json:"Value,omitempty"` - // The string value that indicates which word the field value is a synonym of. - SynonymOf *string `json:"SynonymOf,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + Language *string `json:"Language,omitempty"` + // The Field Value data. + Value *string `json:"Value,omitempty"` + // The string value that indicates which word the field value is a synonym of. + SynonymOf *string `json:"SynonymOf,omitempty"` } -func (params *CreateFieldValueParams) SetLanguage(Language string) *CreateFieldValueParams { - params.Language = &Language - return params +func (params *CreateFieldValueParams) SetLanguage(Language string) (*CreateFieldValueParams){ + params.Language = &Language + return params } -func (params *CreateFieldValueParams) SetValue(Value string) *CreateFieldValueParams { - params.Value = &Value - return params +func (params *CreateFieldValueParams) SetValue(Value string) (*CreateFieldValueParams){ + params.Value = &Value + return params } -func (params *CreateFieldValueParams) SetSynonymOf(SynonymOf string) *CreateFieldValueParams { - params.SynonymOf = &SynonymOf - return params +func (params *CreateFieldValueParams) SetSynonymOf(SynonymOf string) (*CreateFieldValueParams){ + params.SynonymOf = &SynonymOf + return params } -// +// func (c *ApiService) CreateFieldValue(AssistantSid string, FieldTypeSid string, params *CreateFieldValueParams) (*AutopilotV1FieldValue, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } - if params != nil && params.SynonymOf != nil { - data.Set("SynonymOf", *params.SynonymOf) - } + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } + if params != nil && params.SynonymOf != nil { + data.Set("SynonymOf", *params.SynonymOf) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1FieldValue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AutopilotV1FieldValue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteFieldValue(AssistantSid string, FieldTypeSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteFieldValue(AssistantSid string, FieldTypeSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchFieldValue(AssistantSid string, FieldTypeSid string, Sid string) (*AutopilotV1FieldValue, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchFieldValue(AssistantSid string, FieldTypeSid string, Sid string, ) (*AutopilotV1FieldValue, error) { + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AutopilotV1FieldValue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1FieldValue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFieldValue' type ListFieldValueParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - Language *string `json:"Language,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + Language *string `json:"Language,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFieldValueParams) SetLanguage(Language string) *ListFieldValueParams { - params.Language = &Language - return params +func (params *ListFieldValueParams) SetLanguage(Language string) (*ListFieldValueParams){ + params.Language = &Language + return params } -func (params *ListFieldValueParams) SetPageSize(PageSize int) *ListFieldValueParams { - params.PageSize = &PageSize - return params +func (params *ListFieldValueParams) SetPageSize(PageSize int) (*ListFieldValueParams){ + params.PageSize = &PageSize + return params } -func (params *ListFieldValueParams) SetLimit(Limit int) *ListFieldValueParams { - params.Limit = &Limit - return params +func (params *ListFieldValueParams) SetLimit(Limit int) (*ListFieldValueParams){ + params.Limit = &Limit + return params } // Retrieve a single page of FieldValue records from the API. Request is executed immediately. func (c *ApiService) PageFieldValue(AssistantSid string, FieldTypeSid string, params *ListFieldValueParams, pageToken, pageNumber string) (*ListFieldValueResponse, error) { - path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues" + path := "/v1/Assistants/{AssistantSid}/FieldTypes/{FieldTypeSid}/FieldValues" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"FieldTypeSid"+"}", FieldTypeSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFieldValueResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFieldValueResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists FieldValue records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +230,7 @@ func (c *ApiService) StreamFieldValue(AssistantSid string, FieldTypeSid string, return recordChannel, errorChannel } + func (c *ApiService) streamFieldValue(response *ListFieldValueResponse, params *ListFieldValueParams, recordChannel chan AutopilotV1FieldValue, errorChannel chan error) { curRecord := 1 @@ -256,19 +262,20 @@ func (c *ApiService) streamFieldValue(response *ListFieldValueResponse, params * } func (c *ApiService) getNextListFieldValueResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFieldValueResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFieldValueResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/autopilot/v1/assistants_model_builds.go b/rest/autopilot/v1/assistants_model_builds.go index fcd4c67f9..fce7066b4 100644 --- a/rest/autopilot/v1/assistants_model_builds.go +++ b/rest/autopilot/v1/assistants_model_builds.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateModelBuild' type CreateModelBuildParams struct { - // The URL we should call using a POST method to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` + // The URL we should call using a POST method to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` } -func (params *CreateModelBuildParams) SetStatusCallback(StatusCallback string) *CreateModelBuildParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateModelBuildParams) SetStatusCallback(StatusCallback string) (*CreateModelBuildParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreateModelBuildParams) SetUniqueName(UniqueName string) *CreateModelBuildParams { - params.UniqueName = &UniqueName - return params +func (params *CreateModelBuildParams) SetUniqueName(UniqueName string) (*CreateModelBuildParams){ + params.UniqueName = &UniqueName + return params } -// +// func (c *ApiService) CreateModelBuild(AssistantSid string, params *CreateModelBuildParams) (*AutopilotV1ModelBuild, error) { - path := "/v1/Assistants/{AssistantSid}/ModelBuilds" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path := "/v1/Assistants/{AssistantSid}/ModelBuilds" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1ModelBuild{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AutopilotV1ModelBuild{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteModelBuild(AssistantSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteModelBuild(AssistantSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchModelBuild(AssistantSid string, Sid string) (*AutopilotV1ModelBuild, error) { - path := "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchModelBuild(AssistantSid string, Sid string, ) (*AutopilotV1ModelBuild, error) { + path := "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AutopilotV1ModelBuild{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &AutopilotV1ModelBuild{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListModelBuild' type ListModelBuildParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListModelBuildParams) SetPageSize(PageSize int) *ListModelBuildParams { - params.PageSize = &PageSize - return params +func (params *ListModelBuildParams) SetPageSize(PageSize int) (*ListModelBuildParams){ + params.PageSize = &PageSize + return params } -func (params *ListModelBuildParams) SetLimit(Limit int) *ListModelBuildParams { - params.Limit = &Limit - return params +func (params *ListModelBuildParams) SetLimit(Limit int) (*ListModelBuildParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ModelBuild records from the API. Request is executed immediately. func (c *ApiService) PageModelBuild(AssistantSid string, params *ListModelBuildParams, pageToken, pageNumber string) (*ListModelBuildResponse, error) { - path := "/v1/Assistants/{AssistantSid}/ModelBuilds" + path := "/v1/Assistants/{AssistantSid}/ModelBuilds" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListModelBuildResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListModelBuildResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ModelBuild records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamModelBuild(AssistantSid string, params *ListModelBuil return recordChannel, errorChannel } + func (c *ApiService) streamModelBuild(response *ListModelBuildResponse, params *ListModelBuildParams, recordChannel chan AutopilotV1ModelBuild, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamModelBuild(response *ListModelBuildResponse, params * } func (c *ApiService) getNextListModelBuildResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListModelBuildResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListModelBuildResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateModelBuild' type UpdateModelBuildParams struct { - // An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` } -func (params *UpdateModelBuildParams) SetUniqueName(UniqueName string) *UpdateModelBuildParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateModelBuildParams) SetUniqueName(UniqueName string) (*UpdateModelBuildParams){ + params.UniqueName = &UniqueName + return params } -// +// func (c *ApiService) UpdateModelBuild(AssistantSid string, Sid string, params *UpdateModelBuildParams) (*AutopilotV1ModelBuild, error) { - path := "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Assistants/{AssistantSid}/ModelBuilds/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1ModelBuild{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AutopilotV1ModelBuild{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_queries.go b/rest/autopilot/v1/assistants_queries.go index 8fef763b1..e11c0420d 100644 --- a/rest/autopilot/v1/assistants_queries.go +++ b/rest/autopilot/v1/assistants_queries.go @@ -18,205 +18,210 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateQuery' type CreateQueryParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`. - Language *string `json:"Language,omitempty"` - // The end-user's natural language input. It can be up to 2048 characters long. - Query *string `json:"Query,omitempty"` - // The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. - Tasks *string `json:"Tasks,omitempty"` - // The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. - ModelBuild *string `json:"ModelBuild,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`. + Language *string `json:"Language,omitempty"` + // The end-user's natural language input. It can be up to 2048 characters long. + Query *string `json:"Query,omitempty"` + // The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. + Tasks *string `json:"Tasks,omitempty"` + // The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + ModelBuild *string `json:"ModelBuild,omitempty"` } -func (params *CreateQueryParams) SetLanguage(Language string) *CreateQueryParams { - params.Language = &Language - return params +func (params *CreateQueryParams) SetLanguage(Language string) (*CreateQueryParams){ + params.Language = &Language + return params } -func (params *CreateQueryParams) SetQuery(Query string) *CreateQueryParams { - params.Query = &Query - return params +func (params *CreateQueryParams) SetQuery(Query string) (*CreateQueryParams){ + params.Query = &Query + return params } -func (params *CreateQueryParams) SetTasks(Tasks string) *CreateQueryParams { - params.Tasks = &Tasks - return params +func (params *CreateQueryParams) SetTasks(Tasks string) (*CreateQueryParams){ + params.Tasks = &Tasks + return params } -func (params *CreateQueryParams) SetModelBuild(ModelBuild string) *CreateQueryParams { - params.ModelBuild = &ModelBuild - return params +func (params *CreateQueryParams) SetModelBuild(ModelBuild string) (*CreateQueryParams){ + params.ModelBuild = &ModelBuild + return params } -// +// func (c *ApiService) CreateQuery(AssistantSid string, params *CreateQueryParams) (*AutopilotV1Query, error) { - path := "/v1/Assistants/{AssistantSid}/Queries" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.Query != nil { - data.Set("Query", *params.Query) - } - if params != nil && params.Tasks != nil { - data.Set("Tasks", *params.Tasks) - } - if params != nil && params.ModelBuild != nil { - data.Set("ModelBuild", *params.ModelBuild) - } + path := "/v1/Assistants/{AssistantSid}/Queries" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.Query != nil { + data.Set("Query", *params.Query) + } + if params != nil && params.Tasks != nil { + data.Set("Tasks", *params.Tasks) + } + if params != nil && params.ModelBuild != nil { + data.Set("ModelBuild", *params.ModelBuild) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Query{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteQuery(AssistantSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/Queries/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &AutopilotV1Query{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteQuery(AssistantSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/Queries/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchQuery(AssistantSid string, Sid string, ) (*AutopilotV1Query, error) { + path := "/v1/Assistants/{AssistantSid}/Queries/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchQuery(AssistantSid string, Sid string) (*AutopilotV1Query, error) { - path := "/v1/Assistants/{AssistantSid}/Queries/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1Query{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1Query{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListQuery' type ListQueryParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. - Language *string `json:"Language,omitempty"` - // The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. - ModelBuild *string `json:"ModelBuild,omitempty"` - // The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` - Status *string `json:"Status,omitempty"` - // The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - DialogueSid *string `json:"DialogueSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. + Language *string `json:"Language,omitempty"` + // The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. + ModelBuild *string `json:"ModelBuild,omitempty"` + // The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` + Status *string `json:"Status,omitempty"` + // The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + DialogueSid *string `json:"DialogueSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListQueryParams) SetLanguage(Language string) *ListQueryParams { - params.Language = &Language - return params +func (params *ListQueryParams) SetLanguage(Language string) (*ListQueryParams){ + params.Language = &Language + return params } -func (params *ListQueryParams) SetModelBuild(ModelBuild string) *ListQueryParams { - params.ModelBuild = &ModelBuild - return params +func (params *ListQueryParams) SetModelBuild(ModelBuild string) (*ListQueryParams){ + params.ModelBuild = &ModelBuild + return params } -func (params *ListQueryParams) SetStatus(Status string) *ListQueryParams { - params.Status = &Status - return params +func (params *ListQueryParams) SetStatus(Status string) (*ListQueryParams){ + params.Status = &Status + return params } -func (params *ListQueryParams) SetDialogueSid(DialogueSid string) *ListQueryParams { - params.DialogueSid = &DialogueSid - return params +func (params *ListQueryParams) SetDialogueSid(DialogueSid string) (*ListQueryParams){ + params.DialogueSid = &DialogueSid + return params } -func (params *ListQueryParams) SetPageSize(PageSize int) *ListQueryParams { - params.PageSize = &PageSize - return params +func (params *ListQueryParams) SetPageSize(PageSize int) (*ListQueryParams){ + params.PageSize = &PageSize + return params } -func (params *ListQueryParams) SetLimit(Limit int) *ListQueryParams { - params.Limit = &Limit - return params +func (params *ListQueryParams) SetLimit(Limit int) (*ListQueryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Query records from the API. Request is executed immediately. func (c *ApiService) PageQuery(AssistantSid string, params *ListQueryParams, pageToken, pageNumber string) (*ListQueryResponse, error) { - path := "/v1/Assistants/{AssistantSid}/Queries" - - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.ModelBuild != nil { - data.Set("ModelBuild", *params.ModelBuild) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.DialogueSid != nil { - data.Set("DialogueSid", *params.DialogueSid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListQueryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Assistants/{AssistantSid}/Queries" + + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.ModelBuild != nil { + data.Set("ModelBuild", *params.ModelBuild) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.DialogueSid != nil { + data.Set("DialogueSid", *params.DialogueSid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListQueryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Query records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -257,6 +262,7 @@ func (c *ApiService) StreamQuery(AssistantSid string, params *ListQueryParams) ( return recordChannel, errorChannel } + func (c *ApiService) streamQuery(response *ListQueryResponse, params *ListQueryParams, recordChannel chan AutopilotV1Query, errorChannel chan error) { curRecord := 1 @@ -288,67 +294,69 @@ func (c *ApiService) streamQuery(response *ListQueryResponse, params *ListQueryP } func (c *ApiService) getNextListQueryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListQueryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListQueryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateQuery' type UpdateQueryParams struct { - // The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. - SampleSid *string `json:"SampleSid,omitempty"` - // The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` - Status *string `json:"Status,omitempty"` + // The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + SampleSid *string `json:"SampleSid,omitempty"` + // The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` + Status *string `json:"Status,omitempty"` } -func (params *UpdateQueryParams) SetSampleSid(SampleSid string) *UpdateQueryParams { - params.SampleSid = &SampleSid - return params +func (params *UpdateQueryParams) SetSampleSid(SampleSid string) (*UpdateQueryParams){ + params.SampleSid = &SampleSid + return params } -func (params *UpdateQueryParams) SetStatus(Status string) *UpdateQueryParams { - params.Status = &Status - return params +func (params *UpdateQueryParams) SetStatus(Status string) (*UpdateQueryParams){ + params.Status = &Status + return params } -// +// func (c *ApiService) UpdateQuery(AssistantSid string, Sid string, params *UpdateQueryParams) (*AutopilotV1Query, error) { - path := "/v1/Assistants/{AssistantSid}/Queries/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Assistants/{AssistantSid}/Queries/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.SampleSid != nil { - data.Set("SampleSid", *params.SampleSid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.SampleSid != nil { + data.Set("SampleSid", *params.SampleSid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1Query{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &AutopilotV1Query{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_restore.go b/rest/autopilot/v1/assistants_restore.go index bbf3f5457..ea846c843 100644 --- a/rest/autopilot/v1/assistants_restore.go +++ b/rest/autopilot/v1/assistants_restore.go @@ -16,42 +16,47 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'UpdateRestoreAssistant' type UpdateRestoreAssistantParams struct { - // The Twilio-provided string that uniquely identifies the Assistant resource to restore. - Assistant *string `json:"Assistant,omitempty"` + // The Twilio-provided string that uniquely identifies the Assistant resource to restore. + Assistant *string `json:"Assistant,omitempty"` } -func (params *UpdateRestoreAssistantParams) SetAssistant(Assistant string) *UpdateRestoreAssistantParams { - params.Assistant = &Assistant - return params +func (params *UpdateRestoreAssistantParams) SetAssistant(Assistant string) (*UpdateRestoreAssistantParams){ + params.Assistant = &Assistant + return params } -// +// func (c *ApiService) UpdateRestoreAssistant(params *UpdateRestoreAssistantParams) (*AutopilotV1RestoreAssistant, error) { - path := "/v1/Assistants/Restore" + path := "/v1/Assistants/Restore" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Assistant != nil { + data.Set("Assistant", *params.Assistant) + } - if params != nil && params.Assistant != nil { - data.Set("Assistant", *params.Assistant) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1RestoreAssistant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1RestoreAssistant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_style_sheet.go b/rest/autopilot/v1/assistants_style_sheet.go index 2ac9acc04..8ccc83632 100644 --- a/rest/autopilot/v1/assistants_style_sheet.go +++ b/rest/autopilot/v1/assistants_style_sheet.go @@ -16,73 +16,79 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Returns Style sheet JSON object for the Assistant -func (c *ApiService) FetchStyleSheet(AssistantSid string) (*AutopilotV1StyleSheet, error) { - path := "/v1/Assistants/{AssistantSid}/StyleSheet" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) +func (c *ApiService) FetchStyleSheet(AssistantSid string, ) (*AutopilotV1StyleSheet, error) { + path := "/v1/Assistants/{AssistantSid}/StyleSheet" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1StyleSheet{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1StyleSheet{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateStyleSheet' type UpdateStyleSheetParams struct { - // The JSON string that describes the style sheet object. - StyleSheet *interface{} `json:"StyleSheet,omitempty"` + // The JSON string that describes the style sheet object. + StyleSheet *interface{} `json:"StyleSheet,omitempty"` } -func (params *UpdateStyleSheetParams) SetStyleSheet(StyleSheet interface{}) *UpdateStyleSheetParams { - params.StyleSheet = &StyleSheet - return params +func (params *UpdateStyleSheetParams) SetStyleSheet(StyleSheet interface{}) (*UpdateStyleSheetParams){ + params.StyleSheet = &StyleSheet + return params } // Updates the style sheet for an Assistant identified by `assistant_sid`. func (c *ApiService) UpdateStyleSheet(AssistantSid string, params *UpdateStyleSheetParams) (*AutopilotV1StyleSheet, error) { - path := "/v1/Assistants/{AssistantSid}/StyleSheet" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path := "/v1/Assistants/{AssistantSid}/StyleSheet" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.StyleSheet != nil { + v, err := json.Marshal(params.StyleSheet) - if params != nil && params.StyleSheet != nil { - v, err := json.Marshal(params.StyleSheet) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("StyleSheet", string(v)) + } - data.Set("StyleSheet", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1StyleSheet{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1StyleSheet{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_tasks.go b/rest/autopilot/v1/assistants_tasks.go index 5f706c91a..4e3b66272 100644 --- a/rest/autopilot/v1/assistants_tasks.go +++ b/rest/autopilot/v1/assistants_tasks.go @@ -18,175 +18,180 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTask' type CreateTaskParams struct { - // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - UniqueName *string `json:"UniqueName,omitempty"` - // A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. - Actions *interface{} `json:"Actions,omitempty"` - // The URL from which the Assistant can fetch actions. - ActionsUrl *string `json:"ActionsUrl,omitempty"` + // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + UniqueName *string `json:"UniqueName,omitempty"` + // A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. + Actions *interface{} `json:"Actions,omitempty"` + // The URL from which the Assistant can fetch actions. + ActionsUrl *string `json:"ActionsUrl,omitempty"` } -func (params *CreateTaskParams) SetUniqueName(UniqueName string) *CreateTaskParams { - params.UniqueName = &UniqueName - return params +func (params *CreateTaskParams) SetUniqueName(UniqueName string) (*CreateTaskParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateTaskParams) SetFriendlyName(FriendlyName string) *CreateTaskParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateTaskParams) SetFriendlyName(FriendlyName string) (*CreateTaskParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateTaskParams) SetActions(Actions interface{}) *CreateTaskParams { - params.Actions = &Actions - return params +func (params *CreateTaskParams) SetActions(Actions interface{}) (*CreateTaskParams){ + params.Actions = &Actions + return params } -func (params *CreateTaskParams) SetActionsUrl(ActionsUrl string) *CreateTaskParams { - params.ActionsUrl = &ActionsUrl - return params +func (params *CreateTaskParams) SetActionsUrl(ActionsUrl string) (*CreateTaskParams){ + params.ActionsUrl = &ActionsUrl + return params } -// +// func (c *ApiService) CreateTask(AssistantSid string, params *CreateTaskParams) (*AutopilotV1Task, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path := "/v1/Assistants/{AssistantSid}/Tasks" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Actions != nil { - v, err := json.Marshal(params.Actions) + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Actions != nil { + v, err := json.Marshal(params.Actions) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Actions", string(v)) - } - if params != nil && params.ActionsUrl != nil { - data.Set("ActionsUrl", *params.ActionsUrl) - } + data.Set("Actions", string(v)) + } + if params != nil && params.ActionsUrl != nil { + data.Set("ActionsUrl", *params.ActionsUrl) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1Task{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1Task{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteTask(AssistantSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/Tasks/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteTask(AssistantSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchTask(AssistantSid string, Sid string) (*AutopilotV1Task, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchTask(AssistantSid string, Sid string, ) (*AutopilotV1Task, error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AutopilotV1Task{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Task{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTask' type ListTaskParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTaskParams) SetPageSize(PageSize int) *ListTaskParams { - params.PageSize = &PageSize - return params +func (params *ListTaskParams) SetPageSize(PageSize int) (*ListTaskParams){ + params.PageSize = &PageSize + return params } -func (params *ListTaskParams) SetLimit(Limit int) *ListTaskParams { - params.Limit = &Limit - return params +func (params *ListTaskParams) SetLimit(Limit int) (*ListTaskParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Task records from the API. Request is executed immediately. func (c *ApiService) PageTask(AssistantSid string, params *ListTaskParams, pageToken, pageNumber string) (*ListTaskResponse, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks" + path := "/v1/Assistants/{AssistantSid}/Tasks" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTaskResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTaskResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Task records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -227,6 +232,7 @@ func (c *ApiService) StreamTask(AssistantSid string, params *ListTaskParams) (ch return recordChannel, errorChannel } + func (c *ApiService) streamTask(response *ListTaskResponse, params *ListTaskParams, recordChannel chan AutopilotV1Task, errorChannel chan error) { curRecord := 1 @@ -258,91 +264,93 @@ func (c *ApiService) streamTask(response *ListTaskResponse, params *ListTaskPara } func (c *ApiService) getNextListTaskResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTask' type UpdateTaskParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - Actions *interface{} `json:"Actions,omitempty"` - // The URL from which the Assistant can fetch actions. - ActionsUrl *string `json:"ActionsUrl,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + Actions *interface{} `json:"Actions,omitempty"` + // The URL from which the Assistant can fetch actions. + ActionsUrl *string `json:"ActionsUrl,omitempty"` } -func (params *UpdateTaskParams) SetFriendlyName(FriendlyName string) *UpdateTaskParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateTaskParams) SetFriendlyName(FriendlyName string) (*UpdateTaskParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateTaskParams) SetUniqueName(UniqueName string) *UpdateTaskParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateTaskParams) SetUniqueName(UniqueName string) (*UpdateTaskParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateTaskParams) SetActions(Actions interface{}) *UpdateTaskParams { - params.Actions = &Actions - return params +func (params *UpdateTaskParams) SetActions(Actions interface{}) (*UpdateTaskParams){ + params.Actions = &Actions + return params } -func (params *UpdateTaskParams) SetActionsUrl(ActionsUrl string) *UpdateTaskParams { - params.ActionsUrl = &ActionsUrl - return params +func (params *UpdateTaskParams) SetActionsUrl(ActionsUrl string) (*UpdateTaskParams){ + params.ActionsUrl = &ActionsUrl + return params } -// +// func (c *ApiService) UpdateTask(AssistantSid string, Sid string, params *UpdateTaskParams) (*AutopilotV1Task, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Actions != nil { - v, err := json.Marshal(params.Actions) - - if err != nil { - return nil, err - } - - data.Set("Actions", string(v)) - } - if params != nil && params.ActionsUrl != nil { - data.Set("ActionsUrl", *params.ActionsUrl) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &AutopilotV1Task{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Assistants/{AssistantSid}/Tasks/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Actions != nil { + v, err := json.Marshal(params.Actions) + + if err != nil { + return nil, err + } + + data.Set("Actions", string(v)) + } + if params != nil && params.ActionsUrl != nil { + data.Set("ActionsUrl", *params.ActionsUrl) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Task{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/autopilot/v1/assistants_tasks_actions.go b/rest/autopilot/v1/assistants_tasks_actions.go index 9c4097720..570ebfb68 100644 --- a/rest/autopilot/v1/assistants_tasks_actions.go +++ b/rest/autopilot/v1/assistants_tasks_actions.go @@ -16,75 +16,81 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Returns JSON actions for the Task. -func (c *ApiService) FetchTaskActions(AssistantSid string, TaskSid string) (*AutopilotV1TaskActions, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) +func (c *ApiService) FetchTaskActions(AssistantSid string, TaskSid string, ) (*AutopilotV1TaskActions, error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1TaskActions{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1TaskActions{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateTaskActions' type UpdateTaskActionsParams struct { - // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - Actions *interface{} `json:"Actions,omitempty"` + // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + Actions *interface{} `json:"Actions,omitempty"` } -func (params *UpdateTaskActionsParams) SetActions(Actions interface{}) *UpdateTaskActionsParams { - params.Actions = &Actions - return params +func (params *UpdateTaskActionsParams) SetActions(Actions interface{}) (*UpdateTaskActionsParams){ + params.Actions = &Actions + return params } // Updates the actions of an Task identified by {TaskSid} or {TaskUniqueName}. func (c *ApiService) UpdateTaskActions(AssistantSid string, TaskSid string, params *UpdateTaskActionsParams) (*AutopilotV1TaskActions, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Actions" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Actions != nil { + v, err := json.Marshal(params.Actions) - if params != nil && params.Actions != nil { - v, err := json.Marshal(params.Actions) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Actions", string(v)) + } - data.Set("Actions", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1TaskActions{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1TaskActions{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_tasks_fields.go b/rest/autopilot/v1/assistants_tasks_fields.go index df0c81afa..e1d5578e4 100644 --- a/rest/autopilot/v1/assistants_tasks_fields.go +++ b/rest/autopilot/v1/assistants_tasks_fields.go @@ -18,155 +18,160 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateField' type CreateFieldParams struct { - // The Field Type of the new field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the `unique_name`, or the `sid` of a custom Field Type. - FieldType *string `json:"FieldType,omitempty"` - // An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` + // The Field Type of the new field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the `unique_name`, or the `sid` of a custom Field Type. + FieldType *string `json:"FieldType,omitempty"` + // An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` } -func (params *CreateFieldParams) SetFieldType(FieldType string) *CreateFieldParams { - params.FieldType = &FieldType - return params +func (params *CreateFieldParams) SetFieldType(FieldType string) (*CreateFieldParams){ + params.FieldType = &FieldType + return params } -func (params *CreateFieldParams) SetUniqueName(UniqueName string) *CreateFieldParams { - params.UniqueName = &UniqueName - return params +func (params *CreateFieldParams) SetUniqueName(UniqueName string) (*CreateFieldParams){ + params.UniqueName = &UniqueName + return params } -// +// func (c *ApiService) CreateField(AssistantSid string, TaskSid string, params *CreateFieldParams) (*AutopilotV1Field, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FieldType != nil { - data.Set("FieldType", *params.FieldType) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } + if params != nil && params.FieldType != nil { + data.Set("FieldType", *params.FieldType) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1Field{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1Field{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteField(AssistantSid string, TaskSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteField(AssistantSid string, TaskSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchField(AssistantSid string, TaskSid string, Sid string) (*AutopilotV1Field, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchField(AssistantSid string, TaskSid string, Sid string, ) (*AutopilotV1Field, error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AutopilotV1Field{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1Field{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListField' type ListFieldParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFieldParams) SetPageSize(PageSize int) *ListFieldParams { - params.PageSize = &PageSize - return params +func (params *ListFieldParams) SetPageSize(PageSize int) (*ListFieldParams){ + params.PageSize = &PageSize + return params } -func (params *ListFieldParams) SetLimit(Limit int) *ListFieldParams { - params.Limit = &Limit - return params +func (params *ListFieldParams) SetLimit(Limit int) (*ListFieldParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Field records from the API. Request is executed immediately. func (c *ApiService) PageField(AssistantSid string, TaskSid string, params *ListFieldParams, pageToken, pageNumber string) (*ListFieldResponse, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields" + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Fields" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFieldResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFieldResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Field records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +212,7 @@ func (c *ApiService) StreamField(AssistantSid string, TaskSid string, params *Li return recordChannel, errorChannel } + func (c *ApiService) streamField(response *ListFieldResponse, params *ListFieldParams, recordChannel chan AutopilotV1Field, errorChannel chan error) { curRecord := 1 @@ -238,19 +244,20 @@ func (c *ApiService) streamField(response *ListFieldResponse, params *ListFieldP } func (c *ApiService) getNextListFieldResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFieldResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFieldResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/autopilot/v1/assistants_tasks_samples.go b/rest/autopilot/v1/assistants_tasks_samples.go index 410168e92..fbb405df3 100644 --- a/rest/autopilot/v1/assistants_tasks_samples.go +++ b/rest/autopilot/v1/assistants_tasks_samples.go @@ -18,173 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSample' type CreateSampleParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new sample. For example: `en-US`. - Language *string `json:"Language,omitempty"` - // The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - TaggedText *string `json:"TaggedText,omitempty"` - // The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - SourceChannel *string `json:"SourceChannel,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new sample. For example: `en-US`. + Language *string `json:"Language,omitempty"` + // The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + TaggedText *string `json:"TaggedText,omitempty"` + // The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + SourceChannel *string `json:"SourceChannel,omitempty"` } -func (params *CreateSampleParams) SetLanguage(Language string) *CreateSampleParams { - params.Language = &Language - return params +func (params *CreateSampleParams) SetLanguage(Language string) (*CreateSampleParams){ + params.Language = &Language + return params } -func (params *CreateSampleParams) SetTaggedText(TaggedText string) *CreateSampleParams { - params.TaggedText = &TaggedText - return params +func (params *CreateSampleParams) SetTaggedText(TaggedText string) (*CreateSampleParams){ + params.TaggedText = &TaggedText + return params } -func (params *CreateSampleParams) SetSourceChannel(SourceChannel string) *CreateSampleParams { - params.SourceChannel = &SourceChannel - return params +func (params *CreateSampleParams) SetSourceChannel(SourceChannel string) (*CreateSampleParams){ + params.SourceChannel = &SourceChannel + return params } -// +// func (c *ApiService) CreateSample(AssistantSid string, TaskSid string, params *CreateSampleParams) (*AutopilotV1Sample, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.TaggedText != nil { - data.Set("TaggedText", *params.TaggedText) - } - if params != nil && params.SourceChannel != nil { - data.Set("SourceChannel", *params.SourceChannel) - } + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.TaggedText != nil { + data.Set("TaggedText", *params.TaggedText) + } + if params != nil && params.SourceChannel != nil { + data.Set("SourceChannel", *params.SourceChannel) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &AutopilotV1Sample{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &AutopilotV1Sample{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteSample(AssistantSid string, TaskSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteSample(AssistantSid string, TaskSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchSample(AssistantSid string, TaskSid string, Sid string) (*AutopilotV1Sample, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchSample(AssistantSid string, TaskSid string, Sid string, ) (*AutopilotV1Sample, error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &AutopilotV1Sample{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Sample{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSample' type ListSampleParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - Language *string `json:"Language,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + Language *string `json:"Language,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSampleParams) SetLanguage(Language string) *ListSampleParams { - params.Language = &Language - return params +func (params *ListSampleParams) SetLanguage(Language string) (*ListSampleParams){ + params.Language = &Language + return params } -func (params *ListSampleParams) SetPageSize(PageSize int) *ListSampleParams { - params.PageSize = &PageSize - return params +func (params *ListSampleParams) SetPageSize(PageSize int) (*ListSampleParams){ + params.PageSize = &PageSize + return params } -func (params *ListSampleParams) SetLimit(Limit int) *ListSampleParams { - params.Limit = &Limit - return params +func (params *ListSampleParams) SetLimit(Limit int) (*ListSampleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Sample records from the API. Request is executed immediately. func (c *ApiService) PageSample(AssistantSid string, TaskSid string, params *ListSampleParams, pageToken, pageNumber string) (*ListSampleResponse, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples" + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSampleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSampleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Sample records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +230,7 @@ func (c *ApiService) StreamSample(AssistantSid string, TaskSid string, params *L return recordChannel, errorChannel } + func (c *ApiService) streamSample(response *ListSampleResponse, params *ListSampleParams, recordChannel chan AutopilotV1Sample, errorChannel chan error) { curRecord := 1 @@ -256,77 +262,79 @@ func (c *ApiService) streamSample(response *ListSampleResponse, params *ListSamp } func (c *ApiService) getNextListSampleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSampleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSampleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSample' type UpdateSampleParams struct { - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - Language *string `json:"Language,omitempty"` - // The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - TaggedText *string `json:"TaggedText,omitempty"` - // The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - SourceChannel *string `json:"SourceChannel,omitempty"` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + Language *string `json:"Language,omitempty"` + // The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + TaggedText *string `json:"TaggedText,omitempty"` + // The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + SourceChannel *string `json:"SourceChannel,omitempty"` } -func (params *UpdateSampleParams) SetLanguage(Language string) *UpdateSampleParams { - params.Language = &Language - return params +func (params *UpdateSampleParams) SetLanguage(Language string) (*UpdateSampleParams){ + params.Language = &Language + return params } -func (params *UpdateSampleParams) SetTaggedText(TaggedText string) *UpdateSampleParams { - params.TaggedText = &TaggedText - return params +func (params *UpdateSampleParams) SetTaggedText(TaggedText string) (*UpdateSampleParams){ + params.TaggedText = &TaggedText + return params } -func (params *UpdateSampleParams) SetSourceChannel(SourceChannel string) *UpdateSampleParams { - params.SourceChannel = &SourceChannel - return params +func (params *UpdateSampleParams) SetSourceChannel(SourceChannel string) (*UpdateSampleParams){ + params.SourceChannel = &SourceChannel + return params } -// +// func (c *ApiService) UpdateSample(AssistantSid string, TaskSid string, Sid string, params *UpdateSampleParams) (*AutopilotV1Sample, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Language != nil { - data.Set("Language", *params.Language) - } - if params != nil && params.TaggedText != nil { - data.Set("TaggedText", *params.TaggedText) - } - if params != nil && params.SourceChannel != nil { - data.Set("SourceChannel", *params.SourceChannel) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &AutopilotV1Sample{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Samples/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Language != nil { + data.Set("Language", *params.Language) + } + if params != nil && params.TaggedText != nil { + data.Set("TaggedText", *params.TaggedText) + } + if params != nil && params.SourceChannel != nil { + data.Set("SourceChannel", *params.SourceChannel) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Sample{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/autopilot/v1/assistants_tasks_statistics.go b/rest/autopilot/v1/assistants_tasks_statistics.go index d7b92fc1d..bc66de4cf 100644 --- a/rest/autopilot/v1/assistants_tasks_statistics.go +++ b/rest/autopilot/v1/assistants_tasks_statistics.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchTaskStatistics(AssistantSid string, TaskSid string) (*AutopilotV1TaskStatistics, error) { - path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Statistics" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchTaskStatistics(AssistantSid string, TaskSid string, ) (*AutopilotV1TaskStatistics, error) { + path := "/v1/Assistants/{AssistantSid}/Tasks/{TaskSid}/Statistics" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1TaskStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1TaskStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/autopilot/v1/assistants_webhooks.go b/rest/autopilot/v1/assistants_webhooks.go index 4562e47f5..7e1ffd839 100644 --- a/rest/autopilot/v1/assistants_webhooks.go +++ b/rest/autopilot/v1/assistants_webhooks.go @@ -18,169 +18,174 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWebhook' type CreateWebhookParams struct { - // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - UniqueName *string `json:"UniqueName,omitempty"` - // The list of space-separated events that this Webhook will subscribe to. - Events *string `json:"Events,omitempty"` - // The URL associated with this Webhook. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // The method to be used when calling the webhook's URL. - WebhookMethod *string `json:"WebhookMethod,omitempty"` + // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + UniqueName *string `json:"UniqueName,omitempty"` + // The list of space-separated events that this Webhook will subscribe to. + Events *string `json:"Events,omitempty"` + // The URL associated with this Webhook. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // The method to be used when calling the webhook's URL. + WebhookMethod *string `json:"WebhookMethod,omitempty"` } -func (params *CreateWebhookParams) SetUniqueName(UniqueName string) *CreateWebhookParams { - params.UniqueName = &UniqueName - return params +func (params *CreateWebhookParams) SetUniqueName(UniqueName string) (*CreateWebhookParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateWebhookParams) SetEvents(Events string) *CreateWebhookParams { - params.Events = &Events - return params +func (params *CreateWebhookParams) SetEvents(Events string) (*CreateWebhookParams){ + params.Events = &Events + return params } -func (params *CreateWebhookParams) SetWebhookUrl(WebhookUrl string) *CreateWebhookParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *CreateWebhookParams) SetWebhookUrl(WebhookUrl string) (*CreateWebhookParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *CreateWebhookParams) SetWebhookMethod(WebhookMethod string) *CreateWebhookParams { - params.WebhookMethod = &WebhookMethod - return params +func (params *CreateWebhookParams) SetWebhookMethod(WebhookMethod string) (*CreateWebhookParams){ + params.WebhookMethod = &WebhookMethod + return params } -// +// func (c *ApiService) CreateWebhook(AssistantSid string, params *CreateWebhookParams) (*AutopilotV1Webhook, error) { - path := "/v1/Assistants/{AssistantSid}/Webhooks" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Events != nil { - data.Set("Events", *params.Events) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } + path := "/v1/Assistants/{AssistantSid}/Webhooks" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Events != nil { + data.Set("Events", *params.Events) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Webhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteWebhook(AssistantSid string, Sid string, ) (error) { + path := "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &AutopilotV1Webhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteWebhook(AssistantSid string, Sid string) error { - path := "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchWebhook(AssistantSid string, Sid string, ) (*AutopilotV1Webhook, error) { + path := "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchWebhook(AssistantSid string, Sid string) (*AutopilotV1Webhook, error) { - path := "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &AutopilotV1Webhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &AutopilotV1Webhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListWebhook' type ListWebhookParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWebhookParams) SetPageSize(PageSize int) *ListWebhookParams { - params.PageSize = &PageSize - return params +func (params *ListWebhookParams) SetPageSize(PageSize int) (*ListWebhookParams){ + params.PageSize = &PageSize + return params } -func (params *ListWebhookParams) SetLimit(Limit int) *ListWebhookParams { - params.Limit = &Limit - return params +func (params *ListWebhookParams) SetLimit(Limit int) (*ListWebhookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Webhook records from the API. Request is executed immediately. func (c *ApiService) PageWebhook(AssistantSid string, params *ListWebhookParams, pageToken, pageNumber string) (*ListWebhookResponse, error) { - path := "/v1/Assistants/{AssistantSid}/Webhooks" + path := "/v1/Assistants/{AssistantSid}/Webhooks" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Webhook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -221,6 +226,7 @@ func (c *ApiService) StreamWebhook(AssistantSid string, params *ListWebhookParam return recordChannel, errorChannel } + func (c *ApiService) streamWebhook(response *ListWebhookResponse, params *ListWebhookParams, recordChannel chan AutopilotV1Webhook, errorChannel chan error) { curRecord := 1 @@ -252,85 +258,87 @@ func (c *ApiService) streamWebhook(response *ListWebhookResponse, params *ListWe } func (c *ApiService) getNextListWebhookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWebhook' type UpdateWebhookParams struct { - // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - UniqueName *string `json:"UniqueName,omitempty"` - // The list of space-separated events that this Webhook will subscribe to. - Events *string `json:"Events,omitempty"` - // The URL associated with this Webhook. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // The method to be used when calling the webhook's URL. - WebhookMethod *string `json:"WebhookMethod,omitempty"` + // An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. + UniqueName *string `json:"UniqueName,omitempty"` + // The list of space-separated events that this Webhook will subscribe to. + Events *string `json:"Events,omitempty"` + // The URL associated with this Webhook. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // The method to be used when calling the webhook's URL. + WebhookMethod *string `json:"WebhookMethod,omitempty"` } -func (params *UpdateWebhookParams) SetUniqueName(UniqueName string) *UpdateWebhookParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateWebhookParams) SetUniqueName(UniqueName string) (*UpdateWebhookParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateWebhookParams) SetEvents(Events string) *UpdateWebhookParams { - params.Events = &Events - return params +func (params *UpdateWebhookParams) SetEvents(Events string) (*UpdateWebhookParams){ + params.Events = &Events + return params } -func (params *UpdateWebhookParams) SetWebhookUrl(WebhookUrl string) *UpdateWebhookParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *UpdateWebhookParams) SetWebhookUrl(WebhookUrl string) (*UpdateWebhookParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *UpdateWebhookParams) SetWebhookMethod(WebhookMethod string) *UpdateWebhookParams { - params.WebhookMethod = &WebhookMethod - return params +func (params *UpdateWebhookParams) SetWebhookMethod(WebhookMethod string) (*UpdateWebhookParams){ + params.WebhookMethod = &WebhookMethod + return params } -// +// func (c *ApiService) UpdateWebhook(AssistantSid string, Sid string, params *UpdateWebhookParams) (*AutopilotV1Webhook, error) { - path := "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Events != nil { - data.Set("Events", *params.Events) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &AutopilotV1Webhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Assistants/{AssistantSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"AssistantSid"+"}", AssistantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Events != nil { + data.Set("Events", *params.Events) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &AutopilotV1Webhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/autopilot/v1/docs/ListAssistantResponseMeta.md b/rest/autopilot/v1/docs/ListAssistantResponseMeta.md index e31e71960..f267e1e42 100644 --- a/rest/autopilot/v1/docs/ListAssistantResponseMeta.md +++ b/rest/autopilot/v1/docs/ListAssistantResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/autopilot/v1/model_autopilot_v1_assistant.go b/rest/autopilot/v1/model_autopilot_v1_assistant.go index d996cb800..1933fc6b6 100644 --- a/rest/autopilot/v1/model_autopilot_v1_assistant.go +++ b/rest/autopilot/v1/model_autopilot_v1_assistant.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1Assistant struct for AutopilotV1Assistant type AutopilotV1Assistant struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // Reserved. + // Reserved. LatestModelBuildSid *string `json:"latest_model_build_sid,omitempty"` - // A list of the URLs of the Assistant's related resources. + // A list of the URLs of the Assistant's related resources. Links *map[string]interface{} `json:"links,omitempty"` - // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. LogQueries *bool `json:"log_queries,omitempty"` - // A string describing the state of the assistant. + // A string describing the state of the assistant. DevelopmentStage *string `json:"development_stage,omitempty"` - // Whether model needs to be rebuilt. + // Whether model needs to be rebuilt. NeedsModelBuild *bool `json:"needs_model_build,omitempty"` - // The unique string that we created to identify the Assistant resource. + // The unique string that we created to identify the Assistant resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It can be up to 64 characters long. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It can be up to 64 characters long. UniqueName *string `json:"unique_name,omitempty"` - // The absolute URL of the Assistant resource. + // The absolute URL of the Assistant resource. Url *string `json:"url,omitempty"` - // Reserved. + // Reserved. CallbackUrl *string `json:"callback_url,omitempty"` - // Reserved. + // Reserved. CallbackEvents *string `json:"callback_events,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_defaults.go b/rest/autopilot/v1/model_autopilot_v1_defaults.go index 0778fdda7..229b24fda 100644 --- a/rest/autopilot/v1/model_autopilot_v1_defaults.go +++ b/rest/autopilot/v1/model_autopilot_v1_defaults.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // AutopilotV1Defaults struct for AutopilotV1Defaults type AutopilotV1Defaults struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The absolute URL of the Defaults resource. + // The absolute URL of the Defaults resource. Url *string `json:"url,omitempty"` - // The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + // The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. Data *interface{} `json:"data,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_dialogue.go b/rest/autopilot/v1/model_autopilot_v1_dialogue.go index 32d51154c..2391ff5e7 100644 --- a/rest/autopilot/v1/model_autopilot_v1_dialogue.go +++ b/rest/autopilot/v1/model_autopilot_v1_dialogue.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // AutopilotV1Dialogue struct for AutopilotV1Dialogue type AutopilotV1Dialogue struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Dialogue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Dialogue resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the Dialogue resource. + // The unique string that we created to identify the Dialogue resource. Sid *string `json:"sid,omitempty"` - // The JSON string that describes the dialogue session object. + // The JSON string that describes the dialogue session object. Data *interface{} `json:"data,omitempty"` - // The absolute URL of the Dialogue resource. + // The absolute URL of the Dialogue resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_field.go b/rest/autopilot/v1/model_autopilot_v1_field.go index f23abe027..52f60a62b 100644 --- a/rest/autopilot/v1/model_autopilot_v1_field.go +++ b/rest/autopilot/v1/model_autopilot_v1_field.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1Field struct for AutopilotV1Field type AutopilotV1Field struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Field resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Field resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. + // The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. FieldType *string `json:"field_type,omitempty"` - // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. + // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. TaskSid *string `json:"task_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the Field resource. + // The unique string that we created to identify the Field resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The absolute URL of the Field resource. + // The absolute URL of the Field resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_field_type.go b/rest/autopilot/v1/model_autopilot_v1_field_type.go index a564d13d5..7e8097da1 100644 --- a/rest/autopilot/v1/model_autopilot_v1_field_type.go +++ b/rest/autopilot/v1/model_autopilot_v1_field_type.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1FieldType struct for AutopilotV1FieldType type AutopilotV1FieldType struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldType resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldType resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // A list of the URLs of related resources. + // A list of the URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the FieldType resource. + // The unique string that we created to identify the FieldType resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The absolute URL of the FieldType resource. + // The absolute URL of the FieldType resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_field_value.go b/rest/autopilot/v1/model_autopilot_v1_field_value.go index f452eecb7..b7a406503 100644 --- a/rest/autopilot/v1/model_autopilot_v1_field_value.go +++ b/rest/autopilot/v1/model_autopilot_v1_field_value.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1FieldValue struct for AutopilotV1FieldValue type AutopilotV1FieldValue struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldValue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldValue resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the Field Type associated with the Field Value. + // The SID of the Field Type associated with the Field Value. FieldTypeSid *string `json:"field_type_sid,omitempty"` - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` Language *string `json:"language,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the FieldValue resource. + // The unique string that we created to identify the FieldValue resource. Sid *string `json:"sid,omitempty"` - // The Field Value data. + // The Field Value data. Value *string `json:"value,omitempty"` - // The absolute URL of the FieldValue resource. + // The absolute URL of the FieldValue resource. Url *string `json:"url,omitempty"` - // The word for which the field value is a synonym of. + // The word for which the field value is a synonym of. SynonymOf *string `json:"synonym_of,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_model_build.go b/rest/autopilot/v1/model_autopilot_v1_model_build.go index 2dd2fdb0f..d8423ba5e 100644 --- a/rest/autopilot/v1/model_autopilot_v1_model_build.go +++ b/rest/autopilot/v1/model_autopilot_v1_model_build.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1ModelBuild struct for AutopilotV1ModelBuild type AutopilotV1ModelBuild struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ModelBuild resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ModelBuild resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the ModelBuild resource. - Sid *string `json:"sid,omitempty"` + // The unique string that we created to identify the ModelBuild resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The absolute URL of the ModelBuild resource. + // The absolute URL of the ModelBuild resource. Url *string `json:"url,omitempty"` - // The time in seconds it took to build the model. + // The time in seconds it took to build the model. BuildDuration *int `json:"build_duration,omitempty"` - // If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. + // If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. ErrorCode *int `json:"error_code,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_query.go b/rest/autopilot/v1/model_autopilot_v1_query.go index 1e6bd4075..be8b1cdaa 100644 --- a/rest/autopilot/v1/model_autopilot_v1_query.go +++ b/rest/autopilot/v1/model_autopilot_v1_query.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1Query struct for AutopilotV1Query type AutopilotV1Query struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). + // The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). Results *interface{} `json:"results,omitempty"` - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. Language *string `json:"language,omitempty"` - // The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. + // The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. ModelBuildSid *string `json:"model_build_sid,omitempty"` - // The end-user's natural language input. + // The end-user's natural language input. Query *string `json:"query,omitempty"` - // The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + // The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. SampleSid *string `json:"sample_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the Query resource. + // The unique string that we created to identify the Query resource. Sid *string `json:"sid,omitempty"` - // The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` + // The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` Status *string `json:"status,omitempty"` - // The absolute URL of the Query resource. + // The absolute URL of the Query resource. Url *string `json:"url,omitempty"` - // The communication channel from where the end-user input came. + // The communication channel from where the end-user input came. SourceChannel *string `json:"source_channel,omitempty"` - // The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + // The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). DialogueSid *string `json:"dialogue_sid,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_restore_assistant.go b/rest/autopilot/v1/model_autopilot_v1_restore_assistant.go index 4eb358943..2c6ddf49f 100644 --- a/rest/autopilot/v1/model_autopilot_v1_restore_assistant.go +++ b/rest/autopilot/v1/model_autopilot_v1_restore_assistant.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1RestoreAssistant struct for AutopilotV1RestoreAssistant type AutopilotV1RestoreAssistant struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the Assistant resource. + // The unique string that we created to identify the Assistant resource. Sid *string `json:"sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // Whether model needs to be rebuilt. + // Whether model needs to be rebuilt. NeedsModelBuild *bool `json:"needs_model_build,omitempty"` - // Reserved. + // Reserved. LatestModelBuildSid *string `json:"latest_model_build_sid,omitempty"` - // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + // Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. LogQueries *bool `json:"log_queries,omitempty"` - // A string describing the state of the assistant. + // A string describing the state of the assistant. DevelopmentStage *string `json:"development_stage,omitempty"` - // Reserved. + // Reserved. CallbackUrl *string `json:"callback_url,omitempty"` - // Reserved. + // Reserved. CallbackEvents *string `json:"callback_events,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_sample.go b/rest/autopilot/v1/model_autopilot_v1_sample.go index faff97fc8..b91f2ff35 100644 --- a/rest/autopilot/v1/model_autopilot_v1_sample.go +++ b/rest/autopilot/v1/model_autopilot_v1_sample.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1Sample struct for AutopilotV1Sample type AutopilotV1Sample struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sample resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sample resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. + // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. TaskSid *string `json:"task_sid,omitempty"` - // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + // The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. Language *string `json:"language,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the Sample resource. + // The unique string that we created to identify the Sample resource. Sid *string `json:"sid,omitempty"` - // The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + // The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). TaggedText *string `json:"tagged_text,omitempty"` - // The absolute URL of the Sample resource. + // The absolute URL of the Sample resource. Url *string `json:"url,omitempty"` - // The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + // The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. SourceChannel *string `json:"source_channel,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_style_sheet.go b/rest/autopilot/v1/model_autopilot_v1_style_sheet.go index 689f4f4e1..bd67787e3 100644 --- a/rest/autopilot/v1/model_autopilot_v1_style_sheet.go +++ b/rest/autopilot/v1/model_autopilot_v1_style_sheet.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // AutopilotV1StyleSheet struct for AutopilotV1StyleSheet type AutopilotV1StyleSheet struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The absolute URL of the StyleSheet resource. + // The absolute URL of the StyleSheet resource. Url *string `json:"url,omitempty"` - // The JSON string that describes the style sheet object. + // The JSON string that describes the style sheet object. Data *interface{} `json:"data,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_task.go b/rest/autopilot/v1/model_autopilot_v1_task.go index eb51b2e5b..fb1193a3e 100644 --- a/rest/autopilot/v1/model_autopilot_v1_task.go +++ b/rest/autopilot/v1/model_autopilot_v1_task.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1Task struct for AutopilotV1Task type AutopilotV1Task struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + // The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // A list of the URLs of related resources. + // A list of the URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the Task resource. + // The unique string that we created to identify the Task resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The URL from which the Assistant can fetch actions. + // The URL from which the Assistant can fetch actions. ActionsUrl *string `json:"actions_url,omitempty"` - // The absolute URL of the Task resource. + // The absolute URL of the Task resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_task_actions.go b/rest/autopilot/v1/model_autopilot_v1_task_actions.go index 597d064e8..0c60c1707 100644 --- a/rest/autopilot/v1/model_autopilot_v1_task_actions.go +++ b/rest/autopilot/v1/model_autopilot_v1_task_actions.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // AutopilotV1TaskActions struct for AutopilotV1TaskActions type AutopilotV1TaskActions struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. + // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. TaskSid *string `json:"task_sid,omitempty"` - // The absolute URL of the TaskActions resource. + // The absolute URL of the TaskActions resource. Url *string `json:"url,omitempty"` - // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + // The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. Data *interface{} `json:"data,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_task_statistics.go b/rest/autopilot/v1/model_autopilot_v1_task_statistics.go index 729637e0d..8b8482434 100644 --- a/rest/autopilot/v1/model_autopilot_v1_task_statistics.go +++ b/rest/autopilot/v1/model_autopilot_v1_task_statistics.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // AutopilotV1TaskStatistics struct for AutopilotV1TaskStatistics type AutopilotV1TaskStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. + // The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. TaskSid *string `json:"task_sid,omitempty"` - // The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. + // The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. SamplesCount *int `json:"samples_count,omitempty"` - // The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. + // The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. FieldsCount *int `json:"fields_count,omitempty"` - // The absolute URL of the TaskStatistics resource. + // The absolute URL of the TaskStatistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/autopilot/v1/model_autopilot_v1_webhook.go b/rest/autopilot/v1/model_autopilot_v1_webhook.go index 3375a224c..d60ea46b7 100644 --- a/rest/autopilot/v1/model_autopilot_v1_webhook.go +++ b/rest/autopilot/v1/model_autopilot_v1_webhook.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // AutopilotV1Webhook struct for AutopilotV1Webhook type AutopilotV1Webhook struct { - // The absolute URL of the Webhook resource. + // The absolute URL of the Webhook resource. Url *string `json:"url,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + // The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. AssistantSid *string `json:"assistant_sid,omitempty"` - // The unique string that we created to identify the Webhook resource. + // The unique string that we created to identify the Webhook resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The list of space-separated events that this Webhook is subscribed to. + // The list of space-separated events that this Webhook is subscribed to. Events *string `json:"events,omitempty"` - // The URL associated with this Webhook. + // The URL associated with this Webhook. WebhookUrl *string `json:"webhook_url,omitempty"` - // The method used when calling the webhook's URL. + // The method used when calling the webhook's URL. WebhookMethod *string `json:"webhook_method,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_assistant_response.go b/rest/autopilot/v1/model_list_assistant_response.go index 48f9a747a..6c65648ad 100644 --- a/rest/autopilot/v1/model_list_assistant_response.go +++ b/rest/autopilot/v1/model_list_assistant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAssistantResponse struct for ListAssistantResponse type ListAssistantResponse struct { - Assistants []AutopilotV1Assistant `json:"assistants,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + Assistants []AutopilotV1Assistant `json:"assistants,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_assistant_response_meta.go b/rest/autopilot/v1/model_list_assistant_response_meta.go index 738b0a261..b84020e70 100644 --- a/rest/autopilot/v1/model_list_assistant_response_meta.go +++ b/rest/autopilot/v1/model_list_assistant_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAssistantResponseMeta struct for ListAssistantResponseMeta type ListAssistantResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_field_response.go b/rest/autopilot/v1/model_list_field_response.go index 30d473192..cf9c2d103 100644 --- a/rest/autopilot/v1/model_list_field_response.go +++ b/rest/autopilot/v1/model_list_field_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFieldResponse struct for ListFieldResponse type ListFieldResponse struct { - Fields []AutopilotV1Field `json:"fields,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + Fields []AutopilotV1Field `json:"fields,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_field_type_response.go b/rest/autopilot/v1/model_list_field_type_response.go index a384c884b..e17138bf7 100644 --- a/rest/autopilot/v1/model_list_field_type_response.go +++ b/rest/autopilot/v1/model_list_field_type_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFieldTypeResponse struct for ListFieldTypeResponse type ListFieldTypeResponse struct { - FieldTypes []AutopilotV1FieldType `json:"field_types,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + FieldTypes []AutopilotV1FieldType `json:"field_types,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_field_value_response.go b/rest/autopilot/v1/model_list_field_value_response.go index 13a1d2463..bf7afff99 100644 --- a/rest/autopilot/v1/model_list_field_value_response.go +++ b/rest/autopilot/v1/model_list_field_value_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFieldValueResponse struct for ListFieldValueResponse type ListFieldValueResponse struct { - FieldValues []AutopilotV1FieldValue `json:"field_values,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + FieldValues []AutopilotV1FieldValue `json:"field_values,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_model_build_response.go b/rest/autopilot/v1/model_list_model_build_response.go index 4575ee206..7ad9b5ed5 100644 --- a/rest/autopilot/v1/model_list_model_build_response.go +++ b/rest/autopilot/v1/model_list_model_build_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListModelBuildResponse struct for ListModelBuildResponse type ListModelBuildResponse struct { - ModelBuilds []AutopilotV1ModelBuild `json:"model_builds,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + ModelBuilds []AutopilotV1ModelBuild `json:"model_builds,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_query_response.go b/rest/autopilot/v1/model_list_query_response.go index 1feaa91d9..e66dd48ea 100644 --- a/rest/autopilot/v1/model_list_query_response.go +++ b/rest/autopilot/v1/model_list_query_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListQueryResponse struct for ListQueryResponse type ListQueryResponse struct { - Queries []AutopilotV1Query `json:"queries,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + Queries []AutopilotV1Query `json:"queries,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_sample_response.go b/rest/autopilot/v1/model_list_sample_response.go index 8037f70e7..4ddfe863c 100644 --- a/rest/autopilot/v1/model_list_sample_response.go +++ b/rest/autopilot/v1/model_list_sample_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSampleResponse struct for ListSampleResponse type ListSampleResponse struct { - Samples []AutopilotV1Sample `json:"samples,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + Samples []AutopilotV1Sample `json:"samples,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_task_response.go b/rest/autopilot/v1/model_list_task_response.go index 4fbc3cb3f..4b948c10e 100644 --- a/rest/autopilot/v1/model_list_task_response.go +++ b/rest/autopilot/v1/model_list_task_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTaskResponse struct for ListTaskResponse type ListTaskResponse struct { - Tasks []AutopilotV1Task `json:"tasks,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + Tasks []AutopilotV1Task `json:"tasks,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/autopilot/v1/model_list_webhook_response.go b/rest/autopilot/v1/model_list_webhook_response.go index 233d31eac..5f3e7532d 100644 --- a/rest/autopilot/v1/model_list_webhook_response.go +++ b/rest/autopilot/v1/model_list_webhook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWebhookResponse struct for ListWebhookResponse type ListWebhookResponse struct { - Webhooks []AutopilotV1Webhook `json:"webhooks,omitempty"` - Meta ListAssistantResponseMeta `json:"meta,omitempty"` + Webhooks []AutopilotV1Webhook `json:"webhooks,omitempty"` + Meta ListAssistantResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/bulkexports/v1/README.md b/rest/bulkexports/v1/README.md index 3a66e8ad0..8026bf71b 100644 --- a/rest/bulkexports/v1/README.md +++ b/rest/bulkexports/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/bulkexports/v1/api_service.go b/rest/bulkexports/v1/api_service.go index f8054d712..05291a27d 100644 --- a/rest/bulkexports/v1/api_service.go +++ b/rest/bulkexports/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://bulkexports.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/bulkexports/v1/docs/ListDayResponseMeta.md b/rest/bulkexports/v1/docs/ListDayResponseMeta.md index 8cd1847b3..cc6ae2357 100644 --- a/rest/bulkexports/v1/docs/ListDayResponseMeta.md +++ b/rest/bulkexports/v1/docs/ListDayResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/bulkexports/v1/exports.go b/rest/bulkexports/v1/exports.go index 1cbbbe073..77768f8fe 100644 --- a/rest/bulkexports/v1/exports.go +++ b/rest/bulkexports/v1/exports.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Export. -func (c *ApiService) FetchExport(ResourceType string) (*BulkexportsV1Export, error) { - path := "/v1/Exports/{ResourceType}" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) +func (c *ApiService) FetchExport(ResourceType string, ) (*BulkexportsV1Export, error) { + path := "/v1/Exports/{ResourceType}" + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &BulkexportsV1Export{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &BulkexportsV1Export{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/bulkexports/v1/exports_configuration.go b/rest/bulkexports/v1/exports_configuration.go index 6c9468a05..872b322b3 100644 --- a/rest/bulkexports/v1/exports_configuration.go +++ b/rest/bulkexports/v1/exports_configuration.go @@ -18,84 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Export Configuration. -func (c *ApiService) FetchExportConfiguration(ResourceType string) (*BulkexportsV1ExportConfiguration, error) { - path := "/v1/Exports/{ResourceType}/Configuration" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) +func (c *ApiService) FetchExportConfiguration(ResourceType string, ) (*BulkexportsV1ExportConfiguration, error) { + path := "/v1/Exports/{ResourceType}/Configuration" + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &BulkexportsV1ExportConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &BulkexportsV1ExportConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateExportConfiguration' type UpdateExportConfigurationParams struct { - // If true, Twilio will automatically generate every day's file when the day is over. - Enabled *bool `json:"Enabled,omitempty"` - // Stores the URL destination for the method specified in webhook_method. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url - WebhookMethod *string `json:"WebhookMethod,omitempty"` + // If true, Twilio will automatically generate every day's file when the day is over. + Enabled *bool `json:"Enabled,omitempty"` + // Stores the URL destination for the method specified in webhook_method. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url + WebhookMethod *string `json:"WebhookMethod,omitempty"` } -func (params *UpdateExportConfigurationParams) SetEnabled(Enabled bool) *UpdateExportConfigurationParams { - params.Enabled = &Enabled - return params +func (params *UpdateExportConfigurationParams) SetEnabled(Enabled bool) (*UpdateExportConfigurationParams){ + params.Enabled = &Enabled + return params } -func (params *UpdateExportConfigurationParams) SetWebhookUrl(WebhookUrl string) *UpdateExportConfigurationParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *UpdateExportConfigurationParams) SetWebhookUrl(WebhookUrl string) (*UpdateExportConfigurationParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *UpdateExportConfigurationParams) SetWebhookMethod(WebhookMethod string) *UpdateExportConfigurationParams { - params.WebhookMethod = &WebhookMethod - return params +func (params *UpdateExportConfigurationParams) SetWebhookMethod(WebhookMethod string) (*UpdateExportConfigurationParams){ + params.WebhookMethod = &WebhookMethod + return params } // Update a specific Export Configuration. func (c *ApiService) UpdateExportConfiguration(ResourceType string, params *UpdateExportConfigurationParams) (*BulkexportsV1ExportConfiguration, error) { - path := "/v1/Exports/{ResourceType}/Configuration" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &BulkexportsV1ExportConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Exports/{ResourceType}/Configuration" + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &BulkexportsV1ExportConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/bulkexports/v1/exports_days.go b/rest/bulkexports/v1/exports_days.go index 528c39540..88adf3835 100644 --- a/rest/bulkexports/v1/exports_days.go +++ b/rest/bulkexports/v1/exports_days.go @@ -18,85 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Day. -func (c *ApiService) FetchDay(ResourceType string, Day string) (*BulkexportsV1DayInstance, error) { - path := "/v1/Exports/{ResourceType}/Days/{Day}" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) - path = strings.Replace(path, "{"+"Day"+"}", Day, -1) +func (c *ApiService) FetchDay(ResourceType string, Day string, ) (*BulkexportsV1DayInstance, error) { + path := "/v1/Exports/{ResourceType}/Days/{Day}" + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + path = strings.Replace(path, "{"+"Day"+"}", Day, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &BulkexportsV1DayInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &BulkexportsV1DayInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListDay' type ListDayParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDayParams) SetPageSize(PageSize int) *ListDayParams { - params.PageSize = &PageSize - return params +func (params *ListDayParams) SetPageSize(PageSize int) (*ListDayParams){ + params.PageSize = &PageSize + return params } -func (params *ListDayParams) SetLimit(Limit int) *ListDayParams { - params.Limit = &Limit - return params +func (params *ListDayParams) SetLimit(Limit int) (*ListDayParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Day records from the API. Request is executed immediately. func (c *ApiService) PageDay(ResourceType string, params *ListDayParams, pageToken, pageNumber string) (*ListDayResponse, error) { - path := "/v1/Exports/{ResourceType}/Days" + path := "/v1/Exports/{ResourceType}/Days" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDayResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDayResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Day records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -137,6 +139,7 @@ func (c *ApiService) StreamDay(ResourceType string, params *ListDayParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamDay(response *ListDayResponse, params *ListDayParams, recordChannel chan BulkexportsV1Day, errorChannel chan error) { curRecord := 1 @@ -168,19 +171,20 @@ func (c *ApiService) streamDay(response *ListDayResponse, params *ListDayParams, } func (c *ApiService) getNextListDayResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDayResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDayResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/bulkexports/v1/exports_jobs.go b/rest/bulkexports/v1/exports_jobs.go index 9f940eaf6..12349a461 100644 --- a/rest/bulkexports/v1/exports_jobs.go +++ b/rest/bulkexports/v1/exports_jobs.go @@ -18,185 +18,190 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateExportCustomJob' type CreateExportCustomJobParams struct { - // The start day for the custom export specified as a string in the format of yyyy-mm-dd - StartDay *string `json:"StartDay,omitempty"` - // The end day for the custom export specified as a string in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier than the current UTC day. - EndDay *string `json:"EndDay,omitempty"` - // The friendly name specified when creating the job - FriendlyName *string `json:"FriendlyName,omitempty"` - // The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. If you set neither webhook nor email, you will have to check your job's status manually. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. - WebhookMethod *string `json:"WebhookMethod,omitempty"` - // The optional email to send the completion notification to. You can set both webhook, and email, or one or the other. If you set neither, the job will run but you will have to query to determine your job's status. - Email *string `json:"Email,omitempty"` + // The start day for the custom export specified as a string in the format of yyyy-mm-dd + StartDay *string `json:"StartDay,omitempty"` + // The end day for the custom export specified as a string in the format of yyyy-mm-dd. End day is inclusive and must be 2 days earlier than the current UTC day. + EndDay *string `json:"EndDay,omitempty"` + // The friendly name specified when creating the job + FriendlyName *string `json:"FriendlyName,omitempty"` + // The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. If you set neither webhook nor email, you will have to check your job's status manually. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. + WebhookMethod *string `json:"WebhookMethod,omitempty"` + // The optional email to send the completion notification to. You can set both webhook, and email, or one or the other. If you set neither, the job will run but you will have to query to determine your job's status. + Email *string `json:"Email,omitempty"` } -func (params *CreateExportCustomJobParams) SetStartDay(StartDay string) *CreateExportCustomJobParams { - params.StartDay = &StartDay - return params +func (params *CreateExportCustomJobParams) SetStartDay(StartDay string) (*CreateExportCustomJobParams){ + params.StartDay = &StartDay + return params } -func (params *CreateExportCustomJobParams) SetEndDay(EndDay string) *CreateExportCustomJobParams { - params.EndDay = &EndDay - return params +func (params *CreateExportCustomJobParams) SetEndDay(EndDay string) (*CreateExportCustomJobParams){ + params.EndDay = &EndDay + return params } -func (params *CreateExportCustomJobParams) SetFriendlyName(FriendlyName string) *CreateExportCustomJobParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateExportCustomJobParams) SetFriendlyName(FriendlyName string) (*CreateExportCustomJobParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateExportCustomJobParams) SetWebhookUrl(WebhookUrl string) *CreateExportCustomJobParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *CreateExportCustomJobParams) SetWebhookUrl(WebhookUrl string) (*CreateExportCustomJobParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *CreateExportCustomJobParams) SetWebhookMethod(WebhookMethod string) *CreateExportCustomJobParams { - params.WebhookMethod = &WebhookMethod - return params +func (params *CreateExportCustomJobParams) SetWebhookMethod(WebhookMethod string) (*CreateExportCustomJobParams){ + params.WebhookMethod = &WebhookMethod + return params } -func (params *CreateExportCustomJobParams) SetEmail(Email string) *CreateExportCustomJobParams { - params.Email = &Email - return params +func (params *CreateExportCustomJobParams) SetEmail(Email string) (*CreateExportCustomJobParams){ + params.Email = &Email + return params } -// +// func (c *ApiService) CreateExportCustomJob(ResourceType string, params *CreateExportCustomJobParams) (*BulkexportsV1ExportCustomJob, error) { - path := "/v1/Exports/{ResourceType}/Jobs" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + path := "/v1/Exports/{ResourceType}/Jobs" + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.StartDay != nil { + data.Set("StartDay", *params.StartDay) + } + if params != nil && params.EndDay != nil { + data.Set("EndDay", *params.EndDay) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &BulkexportsV1ExportCustomJob{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteJob(JobSid string, ) (error) { + path := "/v1/Exports/Jobs/{JobSid}" + path = strings.Replace(path, "{"+"JobSid"+"}", JobSid, -1) - if params != nil && params.StartDay != nil { - data.Set("StartDay", *params.StartDay) - } - if params != nil && params.EndDay != nil { - data.Set("EndDay", *params.EndDay) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &BulkexportsV1ExportCustomJob{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteJob(JobSid string) error { - path := "/v1/Exports/Jobs/{JobSid}" - path = strings.Replace(path, "{"+"JobSid"+"}", JobSid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchJob(JobSid string, ) (*BulkexportsV1Job, error) { + path := "/v1/Exports/Jobs/{JobSid}" + path = strings.Replace(path, "{"+"JobSid"+"}", JobSid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchJob(JobSid string) (*BulkexportsV1Job, error) { - path := "/v1/Exports/Jobs/{JobSid}" - path = strings.Replace(path, "{"+"JobSid"+"}", JobSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &BulkexportsV1Job{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &BulkexportsV1Job{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListExportCustomJob' type ListExportCustomJobParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListExportCustomJobParams) SetPageSize(PageSize int) *ListExportCustomJobParams { - params.PageSize = &PageSize - return params +func (params *ListExportCustomJobParams) SetPageSize(PageSize int) (*ListExportCustomJobParams){ + params.PageSize = &PageSize + return params } -func (params *ListExportCustomJobParams) SetLimit(Limit int) *ListExportCustomJobParams { - params.Limit = &Limit - return params +func (params *ListExportCustomJobParams) SetLimit(Limit int) (*ListExportCustomJobParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ExportCustomJob records from the API. Request is executed immediately. func (c *ApiService) PageExportCustomJob(ResourceType string, params *ListExportCustomJobParams, pageToken, pageNumber string) (*ListExportCustomJobResponse, error) { - path := "/v1/Exports/{ResourceType}/Jobs" + path := "/v1/Exports/{ResourceType}/Jobs" - path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) + path = strings.Replace(path, "{"+"ResourceType"+"}", ResourceType, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListExportCustomJobResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListExportCustomJobResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ExportCustomJob records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -237,6 +242,7 @@ func (c *ApiService) StreamExportCustomJob(ResourceType string, params *ListExpo return recordChannel, errorChannel } + func (c *ApiService) streamExportCustomJob(response *ListExportCustomJobResponse, params *ListExportCustomJobParams, recordChannel chan BulkexportsV1ExportCustomJob, errorChannel chan error) { curRecord := 1 @@ -268,19 +274,20 @@ func (c *ApiService) streamExportCustomJob(response *ListExportCustomJobResponse } func (c *ApiService) getNextListExportCustomJobResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExportCustomJobResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExportCustomJobResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/bulkexports/v1/model_bulkexports_v1_day.go b/rest/bulkexports/v1/model_bulkexports_v1_day.go index eb7760a9b..c624df79a 100644 --- a/rest/bulkexports/v1/model_bulkexports_v1_day.go +++ b/rest/bulkexports/v1/model_bulkexports_v1_day.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // BulkexportsV1Day struct for BulkexportsV1Day type BulkexportsV1Day struct { - // The ISO 8601 format date of the resources in the file, for a UTC day + // The ISO 8601 format date of the resources in the file, for a UTC day Day *string `json:"day,omitempty"` - // The size of the day's data file in bytes + // The size of the day's data file in bytes Size *int `json:"size,omitempty"` - // The ISO 8601 format date when resources is created + // The ISO 8601 format date when resources is created CreateDate *string `json:"create_date,omitempty"` - // The friendly name specified when creating the job + // The friendly name specified when creating the job FriendlyName *string `json:"friendly_name,omitempty"` - // The type of communication – Messages, Calls, Conferences, and Participants + // The type of communication – Messages, Calls, Conferences, and Participants ResourceType *string `json:"resource_type,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_bulkexports_v1_day_instance.go b/rest/bulkexports/v1/model_bulkexports_v1_day_instance.go index db8c17690..3d875dad4 100644 --- a/rest/bulkexports/v1/model_bulkexports_v1_day_instance.go +++ b/rest/bulkexports/v1/model_bulkexports_v1_day_instance.go @@ -13,8 +13,13 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // BulkexportsV1DayInstance struct for BulkexportsV1DayInstance type BulkexportsV1DayInstance struct { RedirectTo *string `json:"redirect_to,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_bulkexports_v1_export.go b/rest/bulkexports/v1/model_bulkexports_v1_export.go index 9e893fcd0..783424b3f 100644 --- a/rest/bulkexports/v1/model_bulkexports_v1_export.go +++ b/rest/bulkexports/v1/model_bulkexports_v1_export.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // BulkexportsV1Export struct for BulkexportsV1Export type BulkexportsV1Export struct { - // The type of communication – Messages, Calls, Conferences, and Participants + // The type of communication – Messages, Calls, Conferences, and Participants ResourceType *string `json:"resource_type,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this Export. + // Contains a dictionary of URL links to nested resources of this Export. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_bulkexports_v1_export_configuration.go b/rest/bulkexports/v1/model_bulkexports_v1_export_configuration.go index 0a74e361a..a9f47d44a 100644 --- a/rest/bulkexports/v1/model_bulkexports_v1_export_configuration.go +++ b/rest/bulkexports/v1/model_bulkexports_v1_export_configuration.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // BulkexportsV1ExportConfiguration struct for BulkexportsV1ExportConfiguration type BulkexportsV1ExportConfiguration struct { - // If true, Twilio will automatically generate every day's file when the day is over. + // If true, Twilio will automatically generate every day's file when the day is over. Enabled *bool `json:"enabled,omitempty"` - // Stores the URL destination for the method specified in webhook_method. + // Stores the URL destination for the method specified in webhook_method. WebhookUrl *string `json:"webhook_url,omitempty"` - // Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url + // Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url WebhookMethod *string `json:"webhook_method,omitempty"` - // The type of communication – Messages, Calls, Conferences, and Participants + // The type of communication – Messages, Calls, Conferences, and Participants ResourceType *string `json:"resource_type,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_bulkexports_v1_export_custom_job.go b/rest/bulkexports/v1/model_bulkexports_v1_export_custom_job.go index c871433a7..d9b68d2cc 100644 --- a/rest/bulkexports/v1/model_bulkexports_v1_export_custom_job.go +++ b/rest/bulkexports/v1/model_bulkexports_v1_export_custom_job.go @@ -13,29 +13,34 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // BulkexportsV1ExportCustomJob struct for BulkexportsV1ExportCustomJob type BulkexportsV1ExportCustomJob struct { - // The friendly name specified when creating the job + // The friendly name specified when creating the job FriendlyName *string `json:"friendly_name,omitempty"` - // The type of communication – Messages, Calls, Conferences, and Participants + // The type of communication – Messages, Calls, Conferences, and Participants ResourceType *string `json:"resource_type,omitempty"` - // The start day for the custom export specified when creating the job + // The start day for the custom export specified when creating the job StartDay *string `json:"start_day,omitempty"` - // The end day for the export specified when creating the job + // The end day for the export specified when creating the job EndDay *string `json:"end_day,omitempty"` - // The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. + // The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. WebhookUrl *string `json:"webhook_url,omitempty"` - // This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. + // This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. WebhookMethod *string `json:"webhook_method,omitempty"` - // The optional email to send the completion notification to + // The optional email to send the completion notification to Email *string `json:"email,omitempty"` - // The unique job_sid returned when the custom export was created + // The unique job_sid returned when the custom export was created JobSid *string `json:"job_sid,omitempty"` - // The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. + // The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. Details *interface{} `json:"details,omitempty"` - // This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease + // This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease JobQueuePosition *string `json:"job_queue_position,omitempty"` - // this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position + // this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position EstimatedCompletionTime *string `json:"estimated_completion_time,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_bulkexports_v1_job.go b/rest/bulkexports/v1/model_bulkexports_v1_job.go index ba072f9d3..a526b455d 100644 --- a/rest/bulkexports/v1/model_bulkexports_v1_job.go +++ b/rest/bulkexports/v1/model_bulkexports_v1_job.go @@ -13,30 +13,35 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // BulkexportsV1Job struct for BulkexportsV1Job type BulkexportsV1Job struct { - // The type of communication – Messages, Calls, Conferences, and Participants + // The type of communication – Messages, Calls, Conferences, and Participants ResourceType *string `json:"resource_type,omitempty"` - // The friendly name specified when creating the job + // The friendly name specified when creating the job FriendlyName *string `json:"friendly_name,omitempty"` - // The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. + // The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. Details *interface{} `json:"details,omitempty"` - // The start time for the export specified when creating the job + // The start time for the export specified when creating the job StartDay *string `json:"start_day,omitempty"` - // The end time for the export specified when creating the job + // The end time for the export specified when creating the job EndDay *string `json:"end_day,omitempty"` - // The job_sid returned when the export was created + // The job_sid returned when the export was created JobSid *string `json:"job_sid,omitempty"` - // The optional webhook url called on completion + // The optional webhook url called on completion WebhookUrl *string `json:"webhook_url,omitempty"` - // This is the method used to call the webhook + // This is the method used to call the webhook WebhookMethod *string `json:"webhook_method,omitempty"` - // The optional email to send the completion notification to + // The optional email to send the completion notification to Email *string `json:"email,omitempty"` - Url *string `json:"url,omitempty"` - // This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease + Url *string `json:"url,omitempty"` + // This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease JobQueuePosition *string `json:"job_queue_position,omitempty"` - // this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position + // this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position EstimatedCompletionTime *string `json:"estimated_completion_time,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_list_day_response.go b/rest/bulkexports/v1/model_list_day_response.go index 426d1615e..5303851a3 100644 --- a/rest/bulkexports/v1/model_list_day_response.go +++ b/rest/bulkexports/v1/model_list_day_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDayResponse struct for ListDayResponse type ListDayResponse struct { - Days []BulkexportsV1Day `json:"days,omitempty"` + Days []BulkexportsV1Day `json:"days,omitempty"` Meta ListDayResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_list_day_response_meta.go b/rest/bulkexports/v1/model_list_day_response_meta.go index a2a6c591a..762ec7e3b 100644 --- a/rest/bulkexports/v1/model_list_day_response_meta.go +++ b/rest/bulkexports/v1/model_list_day_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDayResponseMeta struct for ListDayResponseMeta type ListDayResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/bulkexports/v1/model_list_export_custom_job_response.go b/rest/bulkexports/v1/model_list_export_custom_job_response.go index 7b8a57093..c31973eee 100644 --- a/rest/bulkexports/v1/model_list_export_custom_job_response.go +++ b/rest/bulkexports/v1/model_list_export_custom_job_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListExportCustomJobResponse struct for ListExportCustomJobResponse type ListExportCustomJobResponse struct { Jobs []BulkexportsV1ExportCustomJob `json:"jobs,omitempty"` - Meta ListDayResponseMeta `json:"meta,omitempty"` + Meta ListDayResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/README.md b/rest/chat/v1/README.md index bdd233625..dfcf96e3b 100644 --- a/rest/chat/v1/README.md +++ b/rest/chat/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/chat/v1/api_service.go b/rest/chat/v1/api_service.go index 8ffb94b7a..64d34bc28 100644 --- a/rest/chat/v1/api_service.go +++ b/rest/chat/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://chat.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/chat/v1/credentials.go b/rest/chat/v1/credentials.go index 7d1ce09c1..53a1b7f54 100644 --- a/rest/chat/v1/credentials.go +++ b/rest/chat/v1/credentials.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredential' type CreateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *CreateCredentialParams) SetType(Type string) *CreateCredentialParams { - params.Type = &Type - return params +func (params *CreateCredentialParams) SetType(Type string) (*CreateCredentialParams){ + params.Type = &Type + return params } -func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) *CreateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) (*CreateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialParams) SetCertificate(Certificate string) *CreateCredentialParams { - params.Certificate = &Certificate - return params +func (params *CreateCredentialParams) SetCertificate(Certificate string) (*CreateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) *CreateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) (*CreateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *CreateCredentialParams) SetSandbox(Sandbox bool) *CreateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *CreateCredentialParams) SetSandbox(Sandbox bool) (*CreateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *CreateCredentialParams) SetApiKey(ApiKey string) *CreateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *CreateCredentialParams) SetApiKey(ApiKey string) (*CreateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *CreateCredentialParams) SetSecret(Secret string) *CreateCredentialParams { - params.Secret = &Secret - return params +func (params *CreateCredentialParams) SetSecret(Secret string) (*CreateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) CreateCredential(params *CreateCredentialParams) (*ChatV1Credential, error) { - path := "/v1/Credentials" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Credentials" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } +// +func (c *ApiService) DeleteCredential(Sid string, ) (error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &ChatV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteCredential(Sid string) error { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchCredential(Sid string, ) (*ChatV1Credential, error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchCredential(Sid string) (*ChatV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &ChatV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &ChatV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListCredential' type ListCredentialParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialParams) SetPageSize(PageSize int) *ListCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialParams) SetPageSize(PageSize int) (*ListCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialParams) SetLimit(Limit int) *ListCredentialParams { - params.Limit = &Limit - return params +func (params *ListCredentialParams) SetLimit(Limit int) (*ListCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Credential records from the API. Request is executed immediately. func (c *ApiService) PageCredential(params *ListCredentialParams, pageToken, pageNumber string) (*ListCredentialResponse, error) { - path := "/v1/Credentials" + path := "/v1/Credentials" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Credential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCredential(params *ListCredentialParams) (chan ChatV1 return recordChannel, errorChannel } + func (c *ApiService) streamCredential(response *ListCredentialResponse, params *ListCredentialParams, recordChannel chan ChatV1Credential, errorChannel chan error) { curRecord := 1 @@ -274,102 +281,104 @@ func (c *ApiService) streamCredential(response *ListCredentialResponse, params * } func (c *ApiService) getNextListCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredential' type UpdateCredentialParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) *UpdateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCredentialParams) SetCertificate(Certificate string) *UpdateCredentialParams { - params.Certificate = &Certificate - return params +func (params *UpdateCredentialParams) SetCertificate(Certificate string) (*UpdateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) *UpdateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) (*UpdateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) *UpdateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) (*UpdateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *UpdateCredentialParams) SetApiKey(ApiKey string) *UpdateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *UpdateCredentialParams) SetApiKey(ApiKey string) (*UpdateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *UpdateCredentialParams) SetSecret(Secret string) *UpdateCredentialParams { - params.Secret = &Secret - return params +func (params *UpdateCredentialParams) SetSecret(Secret string) (*UpdateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) UpdateCredential(Sid string, params *UpdateCredentialParams) (*ChatV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ChatV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/chat/v1/docs/ListChannelResponseMeta.md b/rest/chat/v1/docs/ListChannelResponseMeta.md index d507879b9..b007fb5e6 100644 --- a/rest/chat/v1/docs/ListChannelResponseMeta.md +++ b/rest/chat/v1/docs/ListChannelResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/chat/v1/model_chat_v1_channel.go b/rest/chat/v1/model_chat_v1_channel.go index 0ec9468cb..7c65486da 100644 --- a/rest/chat/v1/model_chat_v1_channel.go +++ b/rest/chat/v1/model_chat_v1_channel.go @@ -13,38 +13,40 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Channel struct for ChatV1Channel type ChatV1Channel struct { - // The unique string that we created to identify the Channel resource. + // The unique string that we created to identify the Channel resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Channel resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Channel resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - // The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - Type *string `json:"type,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + Type *string `json:"type,omitempty"` + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. + // The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` - // The number of Members in the Channel. + // The number of Members in the Channel. MembersCount *int `json:"members_count,omitempty"` - // The number of Messages in the Channel. + // The number of Messages in the Channel. MessagesCount *int `json:"messages_count,omitempty"` - // The absolute URL of the Channel resource. + // The absolute URL of the Channel resource. Url *string `json:"url,omitempty"` - // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. + // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_credential.go b/rest/chat/v1/model_chat_v1_credential.go index bb23fa460..35b537c33 100644 --- a/rest/chat/v1/model_chat_v1_credential.go +++ b/rest/chat/v1/model_chat_v1_credential.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Credential struct for ChatV1Credential type ChatV1Credential struct { - // The unique string that we created to identify the Credential resource. + // The unique string that we created to identify the Credential resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Credential resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Credential resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Type *string `json:"type,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. Sandbox *string `json:"sandbox,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Credential resource. + // The absolute URL of the Credential resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_invite.go b/rest/chat/v1/model_chat_v1_invite.go index 81e300346..90233c1ce 100644 --- a/rest/chat/v1/model_chat_v1_invite.go +++ b/rest/chat/v1/model_chat_v1_invite.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Invite struct for ChatV1Invite type ChatV1Invite struct { - // The unique string that we created to identify the Invite resource. + // The unique string that we created to identify the Invite resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Invite resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Invite resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the resource. + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the resource. RoleSid *string `json:"role_sid,omitempty"` - // The `identity` of the User that created the invite. + // The `identity` of the User that created the invite. CreatedBy *string `json:"created_by,omitempty"` - // The absolute URL of the Invite resource. + // The absolute URL of the Invite resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_member.go b/rest/chat/v1/model_chat_v1_member.go index 46dfd37ca..9a5afca87 100644 --- a/rest/chat/v1/model_chat_v1_member.go +++ b/rest/chat/v1/model_chat_v1_member.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Member struct for ChatV1Member type ChatV1Member struct { - // The unique string that we created to identify the Member resource. + // The unique string that we created to identify the Member resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for the member. + // The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for the member. ChannelSid *string `json:"channel_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the member. + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the member. RoleSid *string `json:"role_sid,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. + // The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` - // The ISO 8601 timestamp string that represents the date-time of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) read event for the Member within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). + // The ISO 8601 timestamp string that represents the date-time of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) read event for the Member within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). LastConsumptionTimestamp *time.Time `json:"last_consumption_timestamp,omitempty"` - // The absolute URL of the Member resource. + // The absolute URL of the Member resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_message.go b/rest/chat/v1/model_chat_v1_message.go index 1000b1796..97b3563ca 100644 --- a/rest/chat/v1/model_chat_v1_message.go +++ b/rest/chat/v1/model_chat_v1_message.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Message struct for ChatV1Message type ChatV1Message struct { - // The unique string that we created to identify the Message resource. + // The unique string that we created to identify the Message resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Message resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Message resource. AccountSid *string `json:"account_sid,omitempty"` - // The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/api/channels) that the message was sent to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/api/channels) that the message was sent to. To *string `json:"to,omitempty"` - // The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the Message resource belongs to. + // The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the Message resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Whether the message has been edited since it was created. + // Whether the message has been edited since it was created. WasEdited *bool `json:"was_edited,omitempty"` - // The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the message's author. The default value is `system`. + // The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the message's author. The default value is `system`. From *string `json:"from,omitempty"` - // The content of the message. + // The content of the message. Body *string `json:"body,omitempty"` - // The index of the message within the [Channel](https://www.twilio.com/docs/chat/api/channels). + // The index of the message within the [Channel](https://www.twilio.com/docs/chat/api/channels). Index *int `json:"index,omitempty"` - // The absolute URL of the Message resource. + // The absolute URL of the Message resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_role.go b/rest/chat/v1/model_chat_v1_role.go index 349084063..002c1e41a 100644 --- a/rest/chat/v1/model_chat_v1_role.go +++ b/rest/chat/v1/model_chat_v1_role.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Role struct for ChatV1Role type ChatV1Role struct { - // The unique string that we created to identify the Role resource. + // The unique string that we created to identify the Role resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Role resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Role resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // An array of the permissions the role has been granted, formatted as a JSON string. + Type *string `json:"type,omitempty"` + // An array of the permissions the role has been granted, formatted as a JSON string. Permissions *[]string `json:"permissions,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Role resource. + // The absolute URL of the Role resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_service.go b/rest/chat/v1/model_chat_v1_service.go index d19d239fb..a9a9cd345 100644 --- a/rest/chat/v1/model_chat_v1_service.go +++ b/rest/chat/v1/model_chat_v1_service.go @@ -13,53 +13,55 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1Service struct for ChatV1Service type ChatV1Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + // The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. DefaultServiceRoleSid *string `json:"default_service_role_sid,omitempty"` - // The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + // The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. DefaultChannelRoleSid *string `json:"default_channel_role_sid,omitempty"` - // The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + // The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. DefaultChannelCreatorRoleSid *string `json:"default_channel_creator_role_sid,omitempty"` - // Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. + // Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. ReadStatusEnabled *bool `json:"read_status_enabled,omitempty"` - // Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. + // Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` - // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. + // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. TypingIndicatorTimeout *int `json:"typing_indicator_timeout,omitempty"` - // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. + // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. ConsumptionReportInterval *int `json:"consumption_report_interval,omitempty"` - // An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. + // An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. Limits *interface{} `json:"limits,omitempty"` - // An object that contains information about the webhooks configured for this service. + // An object that contains information about the webhooks configured for this service. Webhooks *interface{} `json:"webhooks,omitempty"` - // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. + // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` - // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. + // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. PostWebhookUrl *string `json:"post_webhook_url,omitempty"` - // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. WebhookMethod *string `json:"webhook_method,omitempty"` - // The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + // The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. WebhookFilters *[]string `json:"webhook_filters,omitempty"` - // The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more information. + // The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more information. Notifications *interface{} `json:"notifications,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/api/channels), [Roles](https://www.twilio.com/docs/chat/api/roles), and [Users](https://www.twilio.com/docs/chat/api/users). + // The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/api/channels), [Roles](https://www.twilio.com/docs/chat/api/roles), and [Users](https://www.twilio.com/docs/chat/api/users). Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_user.go b/rest/chat/v1/model_chat_v1_user.go index e05384220..662416da3 100644 --- a/rest/chat/v1/model_chat_v1_user.go +++ b/rest/chat/v1/model_chat_v1_user.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV1User struct for ChatV1User type ChatV1User struct { - // The unique string that we created to identify the User resource. + // The unique string that we created to identify the User resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the user. + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the user. RoleSid *string `json:"role_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/api/chat/rest/services). This value is often a username or an email address. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/api/chat/rest/services). This value is often a username or an email address. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. + // Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. IsOnline *bool `json:"is_online,omitempty"` - // Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + // Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. IsNotifiable *bool `json:"is_notifiable,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The number of Channels this User is a Member of. + // The number of Channels this User is a Member of. JoinedChannelsCount *int `json:"joined_channels_count,omitempty"` - // The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/api/channels) and [Binding](https://www.twilio.com/docs/chat/rest/bindings-resource) resources related to the user. + // The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/api/channels) and [Binding](https://www.twilio.com/docs/chat/rest/bindings-resource) resources related to the user. Links *map[string]interface{} `json:"links,omitempty"` - // The absolute URL of the User resource. + // The absolute URL of the User resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_chat_v1_user_channel.go b/rest/chat/v1/model_chat_v1_user_channel.go index bebc59e47..d6097dbfd 100644 --- a/rest/chat/v1/model_chat_v1_user_channel.go +++ b/rest/chat/v1/model_chat_v1_user_channel.go @@ -13,22 +13,27 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ChatV1UserChannel struct for ChatV1UserChannel type ChatV1UserChannel struct { - // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User Channel resource. + // The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User Channel resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The SID of a [Member](https://www.twilio.com/docs/api/chat/rest/members) that represents the User on the Channel. + // The SID of a [Member](https://www.twilio.com/docs/api/chat/rest/members) that represents the User on the Channel. MemberSid *string `json:"member_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. + Status *string `json:"status,omitempty"` + // The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` - // The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](/docs/api/chat/guides/consumption-horizon) to learn how to mark messages as consumed. + // The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](/docs/api/chat/guides/consumption-horizon) to learn how to mark messages as consumed. UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` - // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. + // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/chat/v1/model_list_channel_response.go b/rest/chat/v1/model_list_channel_response.go index de6d21a5c..40a542432 100644 --- a/rest/chat/v1/model_list_channel_response.go +++ b/rest/chat/v1/model_list_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponse struct for ListChannelResponse type ListChannelResponse struct { - Channels []ChatV1Channel `json:"channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Channels []ChatV1Channel `json:"channels,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_channel_response_meta.go b/rest/chat/v1/model_list_channel_response_meta.go index 7d1a5e11d..0cbd5f844 100644 --- a/rest/chat/v1/model_list_channel_response_meta.go +++ b/rest/chat/v1/model_list_channel_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponseMeta struct for ListChannelResponseMeta type ListChannelResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/chat/v1/model_list_credential_response.go b/rest/chat/v1/model_list_credential_response.go index 8e4f62925..f709c07b4 100644 --- a/rest/chat/v1/model_list_credential_response.go +++ b/rest/chat/v1/model_list_credential_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialResponse struct for ListCredentialResponse type ListCredentialResponse struct { - Credentials []ChatV1Credential `json:"credentials,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Credentials []ChatV1Credential `json:"credentials,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_invite_response.go b/rest/chat/v1/model_list_invite_response.go index c5b5ae3a3..c1495b4a2 100644 --- a/rest/chat/v1/model_list_invite_response.go +++ b/rest/chat/v1/model_list_invite_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInviteResponse struct for ListInviteResponse type ListInviteResponse struct { - Invites []ChatV1Invite `json:"invites,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Invites []ChatV1Invite `json:"invites,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_member_response.go b/rest/chat/v1/model_list_member_response.go index c54024950..e7d83ca6f 100644 --- a/rest/chat/v1/model_list_member_response.go +++ b/rest/chat/v1/model_list_member_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMemberResponse struct for ListMemberResponse type ListMemberResponse struct { - Members []ChatV1Member `json:"members,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Members []ChatV1Member `json:"members,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_message_response.go b/rest/chat/v1/model_list_message_response.go index 926ca4d6b..a9920cec1 100644 --- a/rest/chat/v1/model_list_message_response.go +++ b/rest/chat/v1/model_list_message_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessageResponse struct for ListMessageResponse type ListMessageResponse struct { - Messages []ChatV1Message `json:"messages,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Messages []ChatV1Message `json:"messages,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_role_response.go b/rest/chat/v1/model_list_role_response.go index 252b9fb14..31c1727f9 100644 --- a/rest/chat/v1/model_list_role_response.go +++ b/rest/chat/v1/model_list_role_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoleResponse struct for ListRoleResponse type ListRoleResponse struct { - Roles []ChatV1Role `json:"roles,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Roles []ChatV1Role `json:"roles,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_service_response.go b/rest/chat/v1/model_list_service_response.go index 9eacd3433..0592942c8 100644 --- a/rest/chat/v1/model_list_service_response.go +++ b/rest/chat/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []ChatV1Service `json:"services,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Services []ChatV1Service `json:"services,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_user_channel_response.go b/rest/chat/v1/model_list_user_channel_response.go index 0f6d282c7..5a24c0ea4 100644 --- a/rest/chat/v1/model_list_user_channel_response.go +++ b/rest/chat/v1/model_list_user_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserChannelResponse struct for ListUserChannelResponse type ListUserChannelResponse struct { - Channels []ChatV1UserChannel `json:"channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Channels []ChatV1UserChannel `json:"channels,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/model_list_user_response.go b/rest/chat/v1/model_list_user_response.go index 7f598bae1..5a71343e1 100644 --- a/rest/chat/v1/model_list_user_response.go +++ b/rest/chat/v1/model_list_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserResponse struct for ListUserResponse type ListUserResponse struct { - Users []ChatV1User `json:"users,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Users []ChatV1User `json:"users,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v1/services.go b/rest/chat/v1/services.go index d5b8abda9..6f7e7b67a 100644 --- a/rest/chat/v1/services.go +++ b/rest/chat/v1/services.go @@ -18,137 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateService(params *CreateServiceParams) (*ChatV1Service, error) { - path := "/v1/Services" + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchService(Sid string) (*ChatV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchService(Sid string, ) (*ChatV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ChatV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +195,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan ChatV1Servic return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan ChatV1Service, errorChannel chan error) { curRecord := 1 @@ -220,536 +227,538 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. - DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` - // The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. - DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` - // The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. - DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` - // Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. - ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` - // Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. - ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` - // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. - TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` - // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. - ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` - // Whether to send a notification when a new message is added to a channel. Can be: `true` or `false` and the default is `false`. - NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` - // The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. - NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` - // Whether to send a notification when a member is added to a channel. Can be: `true` or `false` and the default is `false`. - NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` - // The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. - NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` - // Whether to send a notification to a user when they are removed from a channel. Can be: `true` or `false` and the default is `false`. - NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` - // The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. - NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` - // Whether to send a notification when a user is invited to a channel. Can be: `true` or `false` and the default is `false`. - NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` - // The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. - NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` - // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. - PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` - // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. - PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` - // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - WebhookMethod *string `json:"WebhookMethod,omitempty"` - // The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - WebhookFilters *[]string `json:"WebhookFilters,omitempty"` - // The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. - WebhooksOnMessageSendUrl *string `json:"Webhooks.OnMessageSend.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_message_send.url`. - WebhooksOnMessageSendMethod *string `json:"Webhooks.OnMessageSend.Method,omitempty"` - // The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. - WebhooksOnMessageUpdateUrl *string `json:"Webhooks.OnMessageUpdate.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_message_update.url`. - WebhooksOnMessageUpdateMethod *string `json:"Webhooks.OnMessageUpdate.Method,omitempty"` - // The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. - WebhooksOnMessageRemoveUrl *string `json:"Webhooks.OnMessageRemove.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_message_remove.url`. - WebhooksOnMessageRemoveMethod *string `json:"Webhooks.OnMessageRemove.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. - WebhooksOnChannelAddUrl *string `json:"Webhooks.OnChannelAdd.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_channel_add.url`. - WebhooksOnChannelAddMethod *string `json:"Webhooks.OnChannelAdd.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. - WebhooksOnChannelDestroyUrl *string `json:"Webhooks.OnChannelDestroy.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. - WebhooksOnChannelDestroyMethod *string `json:"Webhooks.OnChannelDestroy.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. - WebhooksOnChannelUpdateUrl *string `json:"Webhooks.OnChannelUpdate.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_channel_update.url`. - WebhooksOnChannelUpdateMethod *string `json:"Webhooks.OnChannelUpdate.Method,omitempty"` - // The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. - WebhooksOnMemberAddUrl *string `json:"Webhooks.OnMemberAdd.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_member_add.url`. - WebhooksOnMemberAddMethod *string `json:"Webhooks.OnMemberAdd.Method,omitempty"` - // The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. - WebhooksOnMemberRemoveUrl *string `json:"Webhooks.OnMemberRemove.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_member_remove.url`. - WebhooksOnMemberRemoveMethod *string `json:"Webhooks.OnMemberRemove.Method,omitempty"` - // The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. - WebhooksOnMessageSentUrl *string `json:"Webhooks.OnMessageSent.Url,omitempty"` - // The URL of the webhook to call in response to the `on_message_sent` event`. - WebhooksOnMessageSentMethod *string `json:"Webhooks.OnMessageSent.Method,omitempty"` - // The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. - WebhooksOnMessageUpdatedUrl *string `json:"Webhooks.OnMessageUpdated.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_message_updated.url`. - WebhooksOnMessageUpdatedMethod *string `json:"Webhooks.OnMessageUpdated.Method,omitempty"` - // The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. - WebhooksOnMessageRemovedUrl *string `json:"Webhooks.OnMessageRemoved.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_message_removed.url`. - WebhooksOnMessageRemovedMethod *string `json:"Webhooks.OnMessageRemoved.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. - WebhooksOnChannelAddedUrl *string `json:"Webhooks.OnChannelAdded.Url,omitempty"` - // The URL of the webhook to call in response to the `on_channel_added` event`. - WebhooksOnChannelAddedMethod *string `json:"Webhooks.OnChannelAdded.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. - WebhooksOnChannelDestroyedUrl *string `json:"Webhooks.OnChannelDestroyed.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. - WebhooksOnChannelDestroyedMethod *string `json:"Webhooks.OnChannelDestroyed.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. - WebhooksOnChannelUpdatedUrl *string `json:"Webhooks.OnChannelUpdated.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_channel_updated.url`. - WebhooksOnChannelUpdatedMethod *string `json:"Webhooks.OnChannelUpdated.Method,omitempty"` - // The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. - WebhooksOnMemberAddedUrl *string `json:"Webhooks.OnMemberAdded.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_channel_updated.url`. - WebhooksOnMemberAddedMethod *string `json:"Webhooks.OnMemberAdded.Method,omitempty"` - // The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. - WebhooksOnMemberRemovedUrl *string `json:"Webhooks.OnMemberRemoved.Url,omitempty"` - // The HTTP method to use when calling the `webhooks.on_member_removed.url`. - WebhooksOnMemberRemovedMethod *string `json:"Webhooks.OnMemberRemoved.Method,omitempty"` - // The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. - LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` - // The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. - LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) *UpdateServiceParams { - params.DefaultServiceRoleSid = &DefaultServiceRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) *UpdateServiceParams { - params.DefaultChannelRoleSid = &DefaultChannelRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) *UpdateServiceParams { - params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid - return params -} -func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) *UpdateServiceParams { - params.ReadStatusEnabled = &ReadStatusEnabled - return params -} -func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) *UpdateServiceParams { - params.ReachabilityEnabled = &ReachabilityEnabled - return params -} -func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) *UpdateServiceParams { - params.TypingIndicatorTimeout = &TypingIndicatorTimeout - return params -} -func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) *UpdateServiceParams { - params.ConsumptionReportInterval = &ConsumptionReportInterval - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) *UpdateServiceParams { - params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) *UpdateServiceParams { - params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) *UpdateServiceParams { - params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) *UpdateServiceParams { - params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) *UpdateServiceParams { - params.PreWebhookUrl = &PreWebhookUrl - return params -} -func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) *UpdateServiceParams { - params.PostWebhookUrl = &PostWebhookUrl - return params -} -func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) *UpdateServiceParams { - params.WebhookMethod = &WebhookMethod - return params -} -func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) *UpdateServiceParams { - params.WebhookFilters = &WebhookFilters - return params -} -func (params *UpdateServiceParams) SetWebhooksOnMessageSendUrl(WebhooksOnMessageSendUrl string) *UpdateServiceParams { - params.WebhooksOnMessageSendUrl = &WebhooksOnMessageSendUrl - return params -} -func (params *UpdateServiceParams) SetWebhooksOnMessageSendMethod(WebhooksOnMessageSendMethod string) *UpdateServiceParams { - params.WebhooksOnMessageSendMethod = &WebhooksOnMessageSendMethod - return params -} -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateUrl(WebhooksOnMessageUpdateUrl string) *UpdateServiceParams { - params.WebhooksOnMessageUpdateUrl = &WebhooksOnMessageUpdateUrl - return params + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` + // The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` + // The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` + // Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. + ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` + // Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. + ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` + // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. + TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` + // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. + ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` + // Whether to send a notification when a new message is added to a channel. Can be: `true` or `false` and the default is `false`. + NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` + // The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. + NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` + // Whether to send a notification when a member is added to a channel. Can be: `true` or `false` and the default is `false`. + NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` + // The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. + NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` + // Whether to send a notification to a user when they are removed from a channel. Can be: `true` or `false` and the default is `false`. + NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` + // The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. + NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` + // Whether to send a notification when a user is invited to a channel. Can be: `true` or `false` and the default is `false`. + NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` + // The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. + NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` + // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. + PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` + // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. + PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` + // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + WebhookMethod *string `json:"WebhookMethod,omitempty"` + // The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + WebhookFilters *[]string `json:"WebhookFilters,omitempty"` + // The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. + WebhooksOnMessageSendUrl *string `json:"Webhooks.OnMessageSend.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_message_send.url`. + WebhooksOnMessageSendMethod *string `json:"Webhooks.OnMessageSend.Method,omitempty"` + // The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. + WebhooksOnMessageUpdateUrl *string `json:"Webhooks.OnMessageUpdate.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_message_update.url`. + WebhooksOnMessageUpdateMethod *string `json:"Webhooks.OnMessageUpdate.Method,omitempty"` + // The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. + WebhooksOnMessageRemoveUrl *string `json:"Webhooks.OnMessageRemove.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_message_remove.url`. + WebhooksOnMessageRemoveMethod *string `json:"Webhooks.OnMessageRemove.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. + WebhooksOnChannelAddUrl *string `json:"Webhooks.OnChannelAdd.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_channel_add.url`. + WebhooksOnChannelAddMethod *string `json:"Webhooks.OnChannelAdd.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. + WebhooksOnChannelDestroyUrl *string `json:"Webhooks.OnChannelDestroy.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. + WebhooksOnChannelDestroyMethod *string `json:"Webhooks.OnChannelDestroy.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. + WebhooksOnChannelUpdateUrl *string `json:"Webhooks.OnChannelUpdate.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_channel_update.url`. + WebhooksOnChannelUpdateMethod *string `json:"Webhooks.OnChannelUpdate.Method,omitempty"` + // The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. + WebhooksOnMemberAddUrl *string `json:"Webhooks.OnMemberAdd.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_member_add.url`. + WebhooksOnMemberAddMethod *string `json:"Webhooks.OnMemberAdd.Method,omitempty"` + // The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. + WebhooksOnMemberRemoveUrl *string `json:"Webhooks.OnMemberRemove.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_member_remove.url`. + WebhooksOnMemberRemoveMethod *string `json:"Webhooks.OnMemberRemove.Method,omitempty"` + // The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. + WebhooksOnMessageSentUrl *string `json:"Webhooks.OnMessageSent.Url,omitempty"` + // The URL of the webhook to call in response to the `on_message_sent` event`. + WebhooksOnMessageSentMethod *string `json:"Webhooks.OnMessageSent.Method,omitempty"` + // The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. + WebhooksOnMessageUpdatedUrl *string `json:"Webhooks.OnMessageUpdated.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_message_updated.url`. + WebhooksOnMessageUpdatedMethod *string `json:"Webhooks.OnMessageUpdated.Method,omitempty"` + // The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. + WebhooksOnMessageRemovedUrl *string `json:"Webhooks.OnMessageRemoved.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_message_removed.url`. + WebhooksOnMessageRemovedMethod *string `json:"Webhooks.OnMessageRemoved.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. + WebhooksOnChannelAddedUrl *string `json:"Webhooks.OnChannelAdded.Url,omitempty"` + // The URL of the webhook to call in response to the `on_channel_added` event`. + WebhooksOnChannelAddedMethod *string `json:"Webhooks.OnChannelAdded.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. + WebhooksOnChannelDestroyedUrl *string `json:"Webhooks.OnChannelDestroyed.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. + WebhooksOnChannelDestroyedMethod *string `json:"Webhooks.OnChannelDestroyed.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. + WebhooksOnChannelUpdatedUrl *string `json:"Webhooks.OnChannelUpdated.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + WebhooksOnChannelUpdatedMethod *string `json:"Webhooks.OnChannelUpdated.Method,omitempty"` + // The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. + WebhooksOnMemberAddedUrl *string `json:"Webhooks.OnMemberAdded.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_channel_updated.url`. + WebhooksOnMemberAddedMethod *string `json:"Webhooks.OnMemberAdded.Method,omitempty"` + // The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. + WebhooksOnMemberRemovedUrl *string `json:"Webhooks.OnMemberRemoved.Url,omitempty"` + // The HTTP method to use when calling the `webhooks.on_member_removed.url`. + WebhooksOnMemberRemovedMethod *string `json:"Webhooks.OnMemberRemoved.Method,omitempty"` + // The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. + LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` + // The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. + LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) (*UpdateServiceParams){ + params.DefaultServiceRoleSid = &DefaultServiceRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelRoleSid = &DefaultChannelRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid + return params +} +func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) (*UpdateServiceParams){ + params.ReadStatusEnabled = &ReadStatusEnabled + return params +} +func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) (*UpdateServiceParams){ + params.ReachabilityEnabled = &ReachabilityEnabled + return params +} +func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) (*UpdateServiceParams){ + params.TypingIndicatorTimeout = &TypingIndicatorTimeout + return params +} +func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) (*UpdateServiceParams){ + params.ConsumptionReportInterval = &ConsumptionReportInterval + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) (*UpdateServiceParams){ + params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) (*UpdateServiceParams){ + params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) (*UpdateServiceParams){ + params.PreWebhookUrl = &PreWebhookUrl + return params +} +func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) (*UpdateServiceParams){ + params.PostWebhookUrl = &PostWebhookUrl + return params +} +func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) (*UpdateServiceParams){ + params.WebhookMethod = &WebhookMethod + return params +} +func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) (*UpdateServiceParams){ + params.WebhookFilters = &WebhookFilters + return params +} +func (params *UpdateServiceParams) SetWebhooksOnMessageSendUrl(WebhooksOnMessageSendUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageSendUrl = &WebhooksOnMessageSendUrl + return params +} +func (params *UpdateServiceParams) SetWebhooksOnMessageSendMethod(WebhooksOnMessageSendMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageSendMethod = &WebhooksOnMessageSendMethod + return params +} +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateUrl(WebhooksOnMessageUpdateUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdateUrl = &WebhooksOnMessageUpdateUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateMethod(WebhooksOnMessageUpdateMethod string) *UpdateServiceParams { - params.WebhooksOnMessageUpdateMethod = &WebhooksOnMessageUpdateMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateMethod(WebhooksOnMessageUpdateMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdateMethod = &WebhooksOnMessageUpdateMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveUrl(WebhooksOnMessageRemoveUrl string) *UpdateServiceParams { - params.WebhooksOnMessageRemoveUrl = &WebhooksOnMessageRemoveUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveUrl(WebhooksOnMessageRemoveUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemoveUrl = &WebhooksOnMessageRemoveUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveMethod(WebhooksOnMessageRemoveMethod string) *UpdateServiceParams { - params.WebhooksOnMessageRemoveMethod = &WebhooksOnMessageRemoveMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveMethod(WebhooksOnMessageRemoveMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemoveMethod = &WebhooksOnMessageRemoveMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddUrl(WebhooksOnChannelAddUrl string) *UpdateServiceParams { - params.WebhooksOnChannelAddUrl = &WebhooksOnChannelAddUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddUrl(WebhooksOnChannelAddUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddUrl = &WebhooksOnChannelAddUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddMethod(WebhooksOnChannelAddMethod string) *UpdateServiceParams { - params.WebhooksOnChannelAddMethod = &WebhooksOnChannelAddMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddMethod(WebhooksOnChannelAddMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddMethod = &WebhooksOnChannelAddMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyUrl(WebhooksOnChannelDestroyUrl string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyUrl = &WebhooksOnChannelDestroyUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyUrl(WebhooksOnChannelDestroyUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyUrl = &WebhooksOnChannelDestroyUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyMethod(WebhooksOnChannelDestroyMethod string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyMethod = &WebhooksOnChannelDestroyMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyMethod(WebhooksOnChannelDestroyMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyMethod = &WebhooksOnChannelDestroyMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateUrl(WebhooksOnChannelUpdateUrl string) *UpdateServiceParams { - params.WebhooksOnChannelUpdateUrl = &WebhooksOnChannelUpdateUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateUrl(WebhooksOnChannelUpdateUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdateUrl = &WebhooksOnChannelUpdateUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateMethod(WebhooksOnChannelUpdateMethod string) *UpdateServiceParams { - params.WebhooksOnChannelUpdateMethod = &WebhooksOnChannelUpdateMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateMethod(WebhooksOnChannelUpdateMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdateMethod = &WebhooksOnChannelUpdateMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddUrl(WebhooksOnMemberAddUrl string) *UpdateServiceParams { - params.WebhooksOnMemberAddUrl = &WebhooksOnMemberAddUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddUrl(WebhooksOnMemberAddUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddUrl = &WebhooksOnMemberAddUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddMethod(WebhooksOnMemberAddMethod string) *UpdateServiceParams { - params.WebhooksOnMemberAddMethod = &WebhooksOnMemberAddMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddMethod(WebhooksOnMemberAddMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddMethod = &WebhooksOnMemberAddMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveUrl(WebhooksOnMemberRemoveUrl string) *UpdateServiceParams { - params.WebhooksOnMemberRemoveUrl = &WebhooksOnMemberRemoveUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveUrl(WebhooksOnMemberRemoveUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemoveUrl = &WebhooksOnMemberRemoveUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveMethod(WebhooksOnMemberRemoveMethod string) *UpdateServiceParams { - params.WebhooksOnMemberRemoveMethod = &WebhooksOnMemberRemoveMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveMethod(WebhooksOnMemberRemoveMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemoveMethod = &WebhooksOnMemberRemoveMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageSentUrl(WebhooksOnMessageSentUrl string) *UpdateServiceParams { - params.WebhooksOnMessageSentUrl = &WebhooksOnMessageSentUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageSentUrl(WebhooksOnMessageSentUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageSentUrl = &WebhooksOnMessageSentUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageSentMethod(WebhooksOnMessageSentMethod string) *UpdateServiceParams { - params.WebhooksOnMessageSentMethod = &WebhooksOnMessageSentMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageSentMethod(WebhooksOnMessageSentMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageSentMethod = &WebhooksOnMessageSentMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedUrl(WebhooksOnMessageUpdatedUrl string) *UpdateServiceParams { - params.WebhooksOnMessageUpdatedUrl = &WebhooksOnMessageUpdatedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedUrl(WebhooksOnMessageUpdatedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdatedUrl = &WebhooksOnMessageUpdatedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedMethod(WebhooksOnMessageUpdatedMethod string) *UpdateServiceParams { - params.WebhooksOnMessageUpdatedMethod = &WebhooksOnMessageUpdatedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedMethod(WebhooksOnMessageUpdatedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdatedMethod = &WebhooksOnMessageUpdatedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedUrl(WebhooksOnMessageRemovedUrl string) *UpdateServiceParams { - params.WebhooksOnMessageRemovedUrl = &WebhooksOnMessageRemovedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedUrl(WebhooksOnMessageRemovedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemovedUrl = &WebhooksOnMessageRemovedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedMethod(WebhooksOnMessageRemovedMethod string) *UpdateServiceParams { - params.WebhooksOnMessageRemovedMethod = &WebhooksOnMessageRemovedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedMethod(WebhooksOnMessageRemovedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemovedMethod = &WebhooksOnMessageRemovedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddedUrl(WebhooksOnChannelAddedUrl string) *UpdateServiceParams { - params.WebhooksOnChannelAddedUrl = &WebhooksOnChannelAddedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddedUrl(WebhooksOnChannelAddedUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddedUrl = &WebhooksOnChannelAddedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddedMethod(WebhooksOnChannelAddedMethod string) *UpdateServiceParams { - params.WebhooksOnChannelAddedMethod = &WebhooksOnChannelAddedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddedMethod(WebhooksOnChannelAddedMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddedMethod = &WebhooksOnChannelAddedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedUrl(WebhooksOnChannelDestroyedUrl string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyedUrl = &WebhooksOnChannelDestroyedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedUrl(WebhooksOnChannelDestroyedUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyedUrl = &WebhooksOnChannelDestroyedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedMethod(WebhooksOnChannelDestroyedMethod string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyedMethod = &WebhooksOnChannelDestroyedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedMethod(WebhooksOnChannelDestroyedMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyedMethod = &WebhooksOnChannelDestroyedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedUrl(WebhooksOnChannelUpdatedUrl string) *UpdateServiceParams { - params.WebhooksOnChannelUpdatedUrl = &WebhooksOnChannelUpdatedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedUrl(WebhooksOnChannelUpdatedUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdatedUrl = &WebhooksOnChannelUpdatedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedMethod(WebhooksOnChannelUpdatedMethod string) *UpdateServiceParams { - params.WebhooksOnChannelUpdatedMethod = &WebhooksOnChannelUpdatedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedMethod(WebhooksOnChannelUpdatedMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdatedMethod = &WebhooksOnChannelUpdatedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddedUrl(WebhooksOnMemberAddedUrl string) *UpdateServiceParams { - params.WebhooksOnMemberAddedUrl = &WebhooksOnMemberAddedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddedUrl(WebhooksOnMemberAddedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddedUrl = &WebhooksOnMemberAddedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddedMethod(WebhooksOnMemberAddedMethod string) *UpdateServiceParams { - params.WebhooksOnMemberAddedMethod = &WebhooksOnMemberAddedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddedMethod(WebhooksOnMemberAddedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddedMethod = &WebhooksOnMemberAddedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedUrl(WebhooksOnMemberRemovedUrl string) *UpdateServiceParams { - params.WebhooksOnMemberRemovedUrl = &WebhooksOnMemberRemovedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedUrl(WebhooksOnMemberRemovedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemovedUrl = &WebhooksOnMemberRemovedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedMethod(WebhooksOnMemberRemovedMethod string) *UpdateServiceParams { - params.WebhooksOnMemberRemovedMethod = &WebhooksOnMemberRemovedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedMethod(WebhooksOnMemberRemovedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemovedMethod = &WebhooksOnMemberRemovedMethod + return params } -func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) *UpdateServiceParams { - params.LimitsChannelMembers = &LimitsChannelMembers - return params +func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) (*UpdateServiceParams){ + params.LimitsChannelMembers = &LimitsChannelMembers + return params } -func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) *UpdateServiceParams { - params.LimitsUserChannels = &LimitsUserChannels - return params +func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) (*UpdateServiceParams){ + params.LimitsUserChannels = &LimitsUserChannels + return params } -// +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*ChatV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DefaultServiceRoleSid != nil { - data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) - } - if params != nil && params.DefaultChannelRoleSid != nil { - data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) - } - if params != nil && params.DefaultChannelCreatorRoleSid != nil { - data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) - } - if params != nil && params.ReadStatusEnabled != nil { - data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) - } - if params != nil && params.ReachabilityEnabled != nil { - data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) - } - if params != nil && params.TypingIndicatorTimeout != nil { - data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) - } - if params != nil && params.ConsumptionReportInterval != nil { - data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) - } - if params != nil && params.NotificationsNewMessageEnabled != nil { - data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) - } - if params != nil && params.NotificationsNewMessageTemplate != nil { - data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) - } - if params != nil && params.NotificationsAddedToChannelEnabled != nil { - data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) - } - if params != nil && params.NotificationsAddedToChannelTemplate != nil { - data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) - } - if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { - data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) - } - if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { - data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) - } - if params != nil && params.NotificationsInvitedToChannelEnabled != nil { - data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) - } - if params != nil && params.NotificationsInvitedToChannelTemplate != nil { - data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) - } - if params != nil && params.PreWebhookUrl != nil { - data.Set("PreWebhookUrl", *params.PreWebhookUrl) - } - if params != nil && params.PostWebhookUrl != nil { - data.Set("PostWebhookUrl", *params.PostWebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - if params != nil && params.WebhookFilters != nil { - for _, item := range *params.WebhookFilters { - data.Add("WebhookFilters", item) - } - } - if params != nil && params.WebhooksOnMessageSendUrl != nil { - data.Set("Webhooks.OnMessageSend.Url", *params.WebhooksOnMessageSendUrl) - } - if params != nil && params.WebhooksOnMessageSendMethod != nil { - data.Set("Webhooks.OnMessageSend.Method", *params.WebhooksOnMessageSendMethod) - } - if params != nil && params.WebhooksOnMessageUpdateUrl != nil { - data.Set("Webhooks.OnMessageUpdate.Url", *params.WebhooksOnMessageUpdateUrl) - } - if params != nil && params.WebhooksOnMessageUpdateMethod != nil { - data.Set("Webhooks.OnMessageUpdate.Method", *params.WebhooksOnMessageUpdateMethod) - } - if params != nil && params.WebhooksOnMessageRemoveUrl != nil { - data.Set("Webhooks.OnMessageRemove.Url", *params.WebhooksOnMessageRemoveUrl) - } - if params != nil && params.WebhooksOnMessageRemoveMethod != nil { - data.Set("Webhooks.OnMessageRemove.Method", *params.WebhooksOnMessageRemoveMethod) - } - if params != nil && params.WebhooksOnChannelAddUrl != nil { - data.Set("Webhooks.OnChannelAdd.Url", *params.WebhooksOnChannelAddUrl) - } - if params != nil && params.WebhooksOnChannelAddMethod != nil { - data.Set("Webhooks.OnChannelAdd.Method", *params.WebhooksOnChannelAddMethod) - } - if params != nil && params.WebhooksOnChannelDestroyUrl != nil { - data.Set("Webhooks.OnChannelDestroy.Url", *params.WebhooksOnChannelDestroyUrl) - } - if params != nil && params.WebhooksOnChannelDestroyMethod != nil { - data.Set("Webhooks.OnChannelDestroy.Method", *params.WebhooksOnChannelDestroyMethod) - } - if params != nil && params.WebhooksOnChannelUpdateUrl != nil { - data.Set("Webhooks.OnChannelUpdate.Url", *params.WebhooksOnChannelUpdateUrl) - } - if params != nil && params.WebhooksOnChannelUpdateMethod != nil { - data.Set("Webhooks.OnChannelUpdate.Method", *params.WebhooksOnChannelUpdateMethod) - } - if params != nil && params.WebhooksOnMemberAddUrl != nil { - data.Set("Webhooks.OnMemberAdd.Url", *params.WebhooksOnMemberAddUrl) - } - if params != nil && params.WebhooksOnMemberAddMethod != nil { - data.Set("Webhooks.OnMemberAdd.Method", *params.WebhooksOnMemberAddMethod) - } - if params != nil && params.WebhooksOnMemberRemoveUrl != nil { - data.Set("Webhooks.OnMemberRemove.Url", *params.WebhooksOnMemberRemoveUrl) - } - if params != nil && params.WebhooksOnMemberRemoveMethod != nil { - data.Set("Webhooks.OnMemberRemove.Method", *params.WebhooksOnMemberRemoveMethod) - } - if params != nil && params.WebhooksOnMessageSentUrl != nil { - data.Set("Webhooks.OnMessageSent.Url", *params.WebhooksOnMessageSentUrl) - } - if params != nil && params.WebhooksOnMessageSentMethod != nil { - data.Set("Webhooks.OnMessageSent.Method", *params.WebhooksOnMessageSentMethod) - } - if params != nil && params.WebhooksOnMessageUpdatedUrl != nil { - data.Set("Webhooks.OnMessageUpdated.Url", *params.WebhooksOnMessageUpdatedUrl) - } - if params != nil && params.WebhooksOnMessageUpdatedMethod != nil { - data.Set("Webhooks.OnMessageUpdated.Method", *params.WebhooksOnMessageUpdatedMethod) - } - if params != nil && params.WebhooksOnMessageRemovedUrl != nil { - data.Set("Webhooks.OnMessageRemoved.Url", *params.WebhooksOnMessageRemovedUrl) - } - if params != nil && params.WebhooksOnMessageRemovedMethod != nil { - data.Set("Webhooks.OnMessageRemoved.Method", *params.WebhooksOnMessageRemovedMethod) - } - if params != nil && params.WebhooksOnChannelAddedUrl != nil { - data.Set("Webhooks.OnChannelAdded.Url", *params.WebhooksOnChannelAddedUrl) - } - if params != nil && params.WebhooksOnChannelAddedMethod != nil { - data.Set("Webhooks.OnChannelAdded.Method", *params.WebhooksOnChannelAddedMethod) - } - if params != nil && params.WebhooksOnChannelDestroyedUrl != nil { - data.Set("Webhooks.OnChannelDestroyed.Url", *params.WebhooksOnChannelDestroyedUrl) - } - if params != nil && params.WebhooksOnChannelDestroyedMethod != nil { - data.Set("Webhooks.OnChannelDestroyed.Method", *params.WebhooksOnChannelDestroyedMethod) - } - if params != nil && params.WebhooksOnChannelUpdatedUrl != nil { - data.Set("Webhooks.OnChannelUpdated.Url", *params.WebhooksOnChannelUpdatedUrl) - } - if params != nil && params.WebhooksOnChannelUpdatedMethod != nil { - data.Set("Webhooks.OnChannelUpdated.Method", *params.WebhooksOnChannelUpdatedMethod) - } - if params != nil && params.WebhooksOnMemberAddedUrl != nil { - data.Set("Webhooks.OnMemberAdded.Url", *params.WebhooksOnMemberAddedUrl) - } - if params != nil && params.WebhooksOnMemberAddedMethod != nil { - data.Set("Webhooks.OnMemberAdded.Method", *params.WebhooksOnMemberAddedMethod) - } - if params != nil && params.WebhooksOnMemberRemovedUrl != nil { - data.Set("Webhooks.OnMemberRemoved.Url", *params.WebhooksOnMemberRemovedUrl) - } - if params != nil && params.WebhooksOnMemberRemovedMethod != nil { - data.Set("Webhooks.OnMemberRemoved.Method", *params.WebhooksOnMemberRemovedMethod) - } - if params != nil && params.LimitsChannelMembers != nil { - data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) - } - if params != nil && params.LimitsUserChannels != nil { - data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ChatV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DefaultServiceRoleSid != nil { + data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) + } + if params != nil && params.DefaultChannelRoleSid != nil { + data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) + } + if params != nil && params.DefaultChannelCreatorRoleSid != nil { + data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) + } + if params != nil && params.ReadStatusEnabled != nil { + data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) + } + if params != nil && params.ReachabilityEnabled != nil { + data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) + } + if params != nil && params.TypingIndicatorTimeout != nil { + data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) + } + if params != nil && params.ConsumptionReportInterval != nil { + data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) + } + if params != nil && params.NotificationsNewMessageEnabled != nil { + data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) + } + if params != nil && params.NotificationsNewMessageTemplate != nil { + data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) + } + if params != nil && params.NotificationsAddedToChannelEnabled != nil { + data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) + } + if params != nil && params.NotificationsAddedToChannelTemplate != nil { + data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) + } + if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { + data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) + } + if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { + data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) + } + if params != nil && params.NotificationsInvitedToChannelEnabled != nil { + data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) + } + if params != nil && params.NotificationsInvitedToChannelTemplate != nil { + data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) + } + if params != nil && params.PreWebhookUrl != nil { + data.Set("PreWebhookUrl", *params.PreWebhookUrl) + } + if params != nil && params.PostWebhookUrl != nil { + data.Set("PostWebhookUrl", *params.PostWebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + if params != nil && params.WebhookFilters != nil { + for _, item := range *params.WebhookFilters { + data.Add("WebhookFilters", item) + } + } + if params != nil && params.WebhooksOnMessageSendUrl != nil { + data.Set("Webhooks.OnMessageSend.Url", *params.WebhooksOnMessageSendUrl) + } + if params != nil && params.WebhooksOnMessageSendMethod != nil { + data.Set("Webhooks.OnMessageSend.Method", *params.WebhooksOnMessageSendMethod) + } + if params != nil && params.WebhooksOnMessageUpdateUrl != nil { + data.Set("Webhooks.OnMessageUpdate.Url", *params.WebhooksOnMessageUpdateUrl) + } + if params != nil && params.WebhooksOnMessageUpdateMethod != nil { + data.Set("Webhooks.OnMessageUpdate.Method", *params.WebhooksOnMessageUpdateMethod) + } + if params != nil && params.WebhooksOnMessageRemoveUrl != nil { + data.Set("Webhooks.OnMessageRemove.Url", *params.WebhooksOnMessageRemoveUrl) + } + if params != nil && params.WebhooksOnMessageRemoveMethod != nil { + data.Set("Webhooks.OnMessageRemove.Method", *params.WebhooksOnMessageRemoveMethod) + } + if params != nil && params.WebhooksOnChannelAddUrl != nil { + data.Set("Webhooks.OnChannelAdd.Url", *params.WebhooksOnChannelAddUrl) + } + if params != nil && params.WebhooksOnChannelAddMethod != nil { + data.Set("Webhooks.OnChannelAdd.Method", *params.WebhooksOnChannelAddMethod) + } + if params != nil && params.WebhooksOnChannelDestroyUrl != nil { + data.Set("Webhooks.OnChannelDestroy.Url", *params.WebhooksOnChannelDestroyUrl) + } + if params != nil && params.WebhooksOnChannelDestroyMethod != nil { + data.Set("Webhooks.OnChannelDestroy.Method", *params.WebhooksOnChannelDestroyMethod) + } + if params != nil && params.WebhooksOnChannelUpdateUrl != nil { + data.Set("Webhooks.OnChannelUpdate.Url", *params.WebhooksOnChannelUpdateUrl) + } + if params != nil && params.WebhooksOnChannelUpdateMethod != nil { + data.Set("Webhooks.OnChannelUpdate.Method", *params.WebhooksOnChannelUpdateMethod) + } + if params != nil && params.WebhooksOnMemberAddUrl != nil { + data.Set("Webhooks.OnMemberAdd.Url", *params.WebhooksOnMemberAddUrl) + } + if params != nil && params.WebhooksOnMemberAddMethod != nil { + data.Set("Webhooks.OnMemberAdd.Method", *params.WebhooksOnMemberAddMethod) + } + if params != nil && params.WebhooksOnMemberRemoveUrl != nil { + data.Set("Webhooks.OnMemberRemove.Url", *params.WebhooksOnMemberRemoveUrl) + } + if params != nil && params.WebhooksOnMemberRemoveMethod != nil { + data.Set("Webhooks.OnMemberRemove.Method", *params.WebhooksOnMemberRemoveMethod) + } + if params != nil && params.WebhooksOnMessageSentUrl != nil { + data.Set("Webhooks.OnMessageSent.Url", *params.WebhooksOnMessageSentUrl) + } + if params != nil && params.WebhooksOnMessageSentMethod != nil { + data.Set("Webhooks.OnMessageSent.Method", *params.WebhooksOnMessageSentMethod) + } + if params != nil && params.WebhooksOnMessageUpdatedUrl != nil { + data.Set("Webhooks.OnMessageUpdated.Url", *params.WebhooksOnMessageUpdatedUrl) + } + if params != nil && params.WebhooksOnMessageUpdatedMethod != nil { + data.Set("Webhooks.OnMessageUpdated.Method", *params.WebhooksOnMessageUpdatedMethod) + } + if params != nil && params.WebhooksOnMessageRemovedUrl != nil { + data.Set("Webhooks.OnMessageRemoved.Url", *params.WebhooksOnMessageRemovedUrl) + } + if params != nil && params.WebhooksOnMessageRemovedMethod != nil { + data.Set("Webhooks.OnMessageRemoved.Method", *params.WebhooksOnMessageRemovedMethod) + } + if params != nil && params.WebhooksOnChannelAddedUrl != nil { + data.Set("Webhooks.OnChannelAdded.Url", *params.WebhooksOnChannelAddedUrl) + } + if params != nil && params.WebhooksOnChannelAddedMethod != nil { + data.Set("Webhooks.OnChannelAdded.Method", *params.WebhooksOnChannelAddedMethod) + } + if params != nil && params.WebhooksOnChannelDestroyedUrl != nil { + data.Set("Webhooks.OnChannelDestroyed.Url", *params.WebhooksOnChannelDestroyedUrl) + } + if params != nil && params.WebhooksOnChannelDestroyedMethod != nil { + data.Set("Webhooks.OnChannelDestroyed.Method", *params.WebhooksOnChannelDestroyedMethod) + } + if params != nil && params.WebhooksOnChannelUpdatedUrl != nil { + data.Set("Webhooks.OnChannelUpdated.Url", *params.WebhooksOnChannelUpdatedUrl) + } + if params != nil && params.WebhooksOnChannelUpdatedMethod != nil { + data.Set("Webhooks.OnChannelUpdated.Method", *params.WebhooksOnChannelUpdatedMethod) + } + if params != nil && params.WebhooksOnMemberAddedUrl != nil { + data.Set("Webhooks.OnMemberAdded.Url", *params.WebhooksOnMemberAddedUrl) + } + if params != nil && params.WebhooksOnMemberAddedMethod != nil { + data.Set("Webhooks.OnMemberAdded.Method", *params.WebhooksOnMemberAddedMethod) + } + if params != nil && params.WebhooksOnMemberRemovedUrl != nil { + data.Set("Webhooks.OnMemberRemoved.Url", *params.WebhooksOnMemberRemovedUrl) + } + if params != nil && params.WebhooksOnMemberRemovedMethod != nil { + data.Set("Webhooks.OnMemberRemoved.Method", *params.WebhooksOnMemberRemovedMethod) + } + if params != nil && params.LimitsChannelMembers != nil { + data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) + } + if params != nil && params.LimitsUserChannels != nil { + data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/chat/v1/services_channels.go b/rest/chat/v1/services_channels.go index a4d54b7ea..f53e63cff 100644 --- a/rest/chat/v1/services_channels.go +++ b/rest/chat/v1/services_channels.go @@ -18,180 +18,185 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannel' type CreateChannelParams struct { - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. - UniqueName *string `json:"UniqueName,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // - Type *string `json:"Type,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. + UniqueName *string `json:"UniqueName,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // + Type *string `json:"Type,omitempty"` } -func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) *CreateChannelParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) (*CreateChannelParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateChannelParams) SetUniqueName(UniqueName string) *CreateChannelParams { - params.UniqueName = &UniqueName - return params +func (params *CreateChannelParams) SetUniqueName(UniqueName string) (*CreateChannelParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateChannelParams) SetAttributes(Attributes string) *CreateChannelParams { - params.Attributes = &Attributes - return params +func (params *CreateChannelParams) SetAttributes(Attributes string) (*CreateChannelParams){ + params.Attributes = &Attributes + return params } -func (params *CreateChannelParams) SetType(Type string) *CreateChannelParams { - params.Type = &Type - return params +func (params *CreateChannelParams) SetType(Type string) (*CreateChannelParams){ + params.Type = &Type + return params } -// +// func (c *ApiService) CreateChannel(ServiceSid string, params *CreateChannelParams) (*ChatV1Channel, error) { - path := "/v1/Services/{ServiceSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Channels" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteChannel(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return ps, err -} + defer resp.Body.Close() -// -func (c *ApiService) DeleteChannel(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchChannel(ServiceSid string, Sid string, ) (*ChatV1Channel, error) { + path := "/v1/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchChannel(ServiceSid string, Sid string) (*ChatV1Channel, error) { - path := "/v1/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListChannel' type ListChannelParams struct { - // The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. - Type *[]string `json:"Type,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. + Type *[]string `json:"Type,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelParams) SetType(Type []string) *ListChannelParams { - params.Type = &Type - return params +func (params *ListChannelParams) SetType(Type []string) (*ListChannelParams){ + params.Type = &Type + return params } -func (params *ListChannelParams) SetPageSize(PageSize int) *ListChannelParams { - params.PageSize = &PageSize - return params +func (params *ListChannelParams) SetPageSize(PageSize int) (*ListChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelParams) SetLimit(Limit int) *ListChannelParams { - params.Limit = &Limit - return params +func (params *ListChannelParams) SetLimit(Limit int) (*ListChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Channel records from the API. Request is executed immediately. func (c *ApiService) PageChannel(ServiceSid string, params *ListChannelParams, pageToken, pageNumber string) (*ListChannelResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Type != nil { - for _, item := range *params.Type { - data.Add("Type", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Channels" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + for _, item := range *params.Type { + data.Add("Type", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Channel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -232,6 +237,7 @@ func (c *ApiService) StreamChannel(ServiceSid string, params *ListChannelParams) return recordChannel, errorChannel } + func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListChannelParams, recordChannel chan ChatV1Channel, errorChannel chan error) { curRecord := 1 @@ -263,76 +269,78 @@ func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListCh } func (c *ApiService) getNextListChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChannel' type UpdateChannelParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. - UniqueName *string `json:"UniqueName,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. + UniqueName *string `json:"UniqueName,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` } -func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) *UpdateChannelParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) (*UpdateChannelParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateChannelParams) SetUniqueName(UniqueName string) *UpdateChannelParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateChannelParams) SetUniqueName(UniqueName string) (*UpdateChannelParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateChannelParams) SetAttributes(Attributes string) *UpdateChannelParams { - params.Attributes = &Attributes - return params +func (params *UpdateChannelParams) SetAttributes(Attributes string) (*UpdateChannelParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) UpdateChannel(ServiceSid string, Sid string, params *UpdateChannelParams) (*ChatV1Channel, error) { - path := "/v1/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v1/services_channels_invites.go b/rest/chat/v1/services_channels_invites.go index 9c7293663..f20c7795a 100644 --- a/rest/chat/v1/services_channels_invites.go +++ b/rest/chat/v1/services_channels_invites.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInvite' type CreateInviteParams struct { - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/v1/service). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. - Identity *string `json:"Identity,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new member. - RoleSid *string `json:"RoleSid,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/v1/service). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + Identity *string `json:"Identity,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new member. + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateInviteParams) SetIdentity(Identity string) *CreateInviteParams { - params.Identity = &Identity - return params +func (params *CreateInviteParams) SetIdentity(Identity string) (*CreateInviteParams){ + params.Identity = &Identity + return params } -func (params *CreateInviteParams) SetRoleSid(RoleSid string) *CreateInviteParams { - params.RoleSid = &RoleSid - return params +func (params *CreateInviteParams) SetRoleSid(RoleSid string) (*CreateInviteParams){ + params.RoleSid = &RoleSid + return params } -// +// func (c *ApiService) CreateInvite(ServiceSid string, ChannelSid string, params *CreateInviteParams) (*ChatV1Invite, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string) (*ChatV1Invite, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV1Invite, error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV1Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ChatV1Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListInvite' type ListInviteParams struct { - // The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInviteParams) SetIdentity(Identity []string) *ListInviteParams { - params.Identity = &Identity - return params +func (params *ListInviteParams) SetIdentity(Identity []string) (*ListInviteParams){ + params.Identity = &Identity + return params } -func (params *ListInviteParams) SetPageSize(PageSize int) *ListInviteParams { - params.PageSize = &PageSize - return params +func (params *ListInviteParams) SetPageSize(PageSize int) (*ListInviteParams){ + params.PageSize = &PageSize + return params } -func (params *ListInviteParams) SetLimit(Limit int) *ListInviteParams { - params.Limit = &Limit - return params +func (params *ListInviteParams) SetLimit(Limit int) (*ListInviteParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Invite records from the API. Request is executed immediately. func (c *ApiService) PageInvite(ServiceSid string, ChannelSid string, params *ListInviteParams, pageToken, pageNumber string) (*ListInviteResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Invite records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamInvite(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInviteParams, recordChannel chan ChatV1Invite, errorChannel chan error) { curRecord := 1 @@ -249,19 +255,20 @@ func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInvi } func (c *ApiService) getNextListInviteResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/chat/v1/services_channels_members.go b/rest/chat/v1/services_channels_members.go index 43c63e650..420e55e42 100644 --- a/rest/chat/v1/services_channels_members.go +++ b/rest/chat/v1/services_channels_members.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMember' type CreateMemberParams struct { - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. - Identity *string `json:"Identity,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). - RoleSid *string `json:"RoleSid,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. + Identity *string `json:"Identity,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateMemberParams) SetIdentity(Identity string) *CreateMemberParams { - params.Identity = &Identity - return params +func (params *CreateMemberParams) SetIdentity(Identity string) (*CreateMemberParams){ + params.Identity = &Identity + return params } -func (params *CreateMemberParams) SetRoleSid(RoleSid string) *CreateMemberParams { - params.RoleSid = &RoleSid - return params +func (params *CreateMemberParams) SetRoleSid(RoleSid string) (*CreateMemberParams){ + params.RoleSid = &RoleSid + return params } -// +// func (c *ApiService) CreateMember(ServiceSid string, ChannelSid string, params *CreateMemberParams) (*ChatV1Member, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string) (*ChatV1Member, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV1Member, error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV1Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ChatV1Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMember' type ListMemberParams struct { - // The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMemberParams) SetIdentity(Identity []string) *ListMemberParams { - params.Identity = &Identity - return params +func (params *ListMemberParams) SetIdentity(Identity []string) (*ListMemberParams){ + params.Identity = &Identity + return params } -func (params *ListMemberParams) SetPageSize(PageSize int) *ListMemberParams { - params.PageSize = &PageSize - return params +func (params *ListMemberParams) SetPageSize(PageSize int) (*ListMemberParams){ + params.PageSize = &PageSize + return params } -func (params *ListMemberParams) SetLimit(Limit int) *ListMemberParams { - params.Limit = &Limit - return params +func (params *ListMemberParams) SetLimit(Limit int) (*ListMemberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Member records from the API. Request is executed immediately. func (c *ApiService) PageMember(ServiceSid string, ChannelSid string, params *ListMemberParams, pageToken, pageNumber string) (*ListMemberResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Member records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamMember(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemberParams, recordChannel chan ChatV1Member, errorChannel chan error) { curRecord := 1 @@ -249,68 +255,70 @@ func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemb } func (c *ApiService) getNextListMemberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMember' type UpdateMemberParams struct { - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). - RoleSid *string `json:"RoleSid,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) that the Member has read within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). + RoleSid *string `json:"RoleSid,omitempty"` + // The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) that the Member has read within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` } -func (params *UpdateMemberParams) SetRoleSid(RoleSid string) *UpdateMemberParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateMemberParams) SetRoleSid(RoleSid string) (*UpdateMemberParams){ + params.RoleSid = &RoleSid + return params } -func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *UpdateMemberParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params +func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*UpdateMemberParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params } -// +// func (c *ApiService) UpdateMember(ServiceSid string, ChannelSid string, Sid string, params *UpdateMemberParams) (*ChatV1Member, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v1/services_channels_messages.go b/rest/chat/v1/services_channels_messages.go index d66d42370..52feab276 100644 --- a/rest/chat/v1/services_channels_messages.go +++ b/rest/chat/v1/services_channels_messages.go @@ -18,173 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessage' type CreateMessageParams struct { - // The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. - Body *string `json:"Body,omitempty"` - // The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new message's author. The default value is `system`. - From *string `json:"From,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` + // The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. + Body *string `json:"Body,omitempty"` + // The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new message's author. The default value is `system`. + From *string `json:"From,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` } -func (params *CreateMessageParams) SetBody(Body string) *CreateMessageParams { - params.Body = &Body - return params +func (params *CreateMessageParams) SetBody(Body string) (*CreateMessageParams){ + params.Body = &Body + return params } -func (params *CreateMessageParams) SetFrom(From string) *CreateMessageParams { - params.From = &From - return params +func (params *CreateMessageParams) SetFrom(From string) (*CreateMessageParams){ + params.From = &From + return params } -func (params *CreateMessageParams) SetAttributes(Attributes string) *CreateMessageParams { - params.Attributes = &Attributes - return params +func (params *CreateMessageParams) SetAttributes(Attributes string) (*CreateMessageParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) CreateMessage(ServiceSid string, ChannelSid string, params *CreateMessageParams) (*ChatV1Message, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ChatV1Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string) (*ChatV1Message, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV1Message, error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV1Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListMessage' type ListMessageParams struct { - // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessageParams) SetOrder(Order string) *ListMessageParams { - params.Order = &Order - return params +func (params *ListMessageParams) SetOrder(Order string) (*ListMessageParams){ + params.Order = &Order + return params } -func (params *ListMessageParams) SetPageSize(PageSize int) *ListMessageParams { - params.PageSize = &PageSize - return params +func (params *ListMessageParams) SetPageSize(PageSize int) (*ListMessageParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessageParams) SetLimit(Limit int) *ListMessageParams { - params.Limit = &Limit - return params +func (params *ListMessageParams) SetLimit(Limit int) (*ListMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Message records from the API. Request is executed immediately. func (c *ApiService) PageMessage(ServiceSid string, ChannelSid string, params *ListMessageParams, pageToken, pageNumber string) (*ListMessageResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Message records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +230,7 @@ func (c *ApiService) StreamMessage(ServiceSid string, ChannelSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMessageParams, recordChannel chan ChatV1Message, errorChannel chan error) { curRecord := 1 @@ -256,68 +262,70 @@ func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMe } func (c *ApiService) getNextListMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMessage' type UpdateMessageParams struct { - // The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. - Body *string `json:"Body,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` + // The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. + Body *string `json:"Body,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` } -func (params *UpdateMessageParams) SetBody(Body string) *UpdateMessageParams { - params.Body = &Body - return params +func (params *UpdateMessageParams) SetBody(Body string) (*UpdateMessageParams){ + params.Body = &Body + return params } -func (params *UpdateMessageParams) SetAttributes(Attributes string) *UpdateMessageParams { - params.Attributes = &Attributes - return params +func (params *UpdateMessageParams) SetAttributes(Attributes string) (*UpdateMessageParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) UpdateMessage(ServiceSid string, ChannelSid string, Sid string, params *UpdateMessageParams) (*ChatV1Message, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v1/services_roles.go b/rest/chat/v1/services_roles.go index f7474658b..ec8494d09 100644 --- a/rest/chat/v1/services_roles.go +++ b/rest/chat/v1/services_roles.go @@ -18,162 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRole' type CreateRoleParams struct { - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type` and are described in the documentation. - Permission *[]string `json:"Permission,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type` and are described in the documentation. + Permission *[]string `json:"Permission,omitempty"` } -func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) *CreateRoleParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) (*CreateRoleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRoleParams) SetType(Type string) *CreateRoleParams { - params.Type = &Type - return params +func (params *CreateRoleParams) SetType(Type string) (*CreateRoleParams){ + params.Type = &Type + return params } -func (params *CreateRoleParams) SetPermission(Permission []string) *CreateRoleParams { - params.Permission = &Permission - return params +func (params *CreateRoleParams) SetPermission(Permission []string) (*CreateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) CreateRole(ServiceSid string, params *CreateRoleParams) (*ChatV1Role, error) { - path := "/v1/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Roles" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteRole(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - ps := &ChatV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteRole(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchRole(ServiceSid string, Sid string, ) (*ChatV1Role, error) { + path := "/v1/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchRole(ServiceSid string, Sid string) (*ChatV1Role, error) { - path := "/v1/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRole' type ListRoleParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoleParams) SetPageSize(PageSize int) *ListRoleParams { - params.PageSize = &PageSize - return params +func (params *ListRoleParams) SetPageSize(PageSize int) (*ListRoleParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoleParams) SetLimit(Limit int) *ListRoleParams { - params.Limit = &Limit - return params +func (params *ListRoleParams) SetLimit(Limit int) (*ListRoleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Role records from the API. Request is executed immediately. func (c *ApiService) PageRole(ServiceSid string, params *ListRoleParams, pageToken, pageNumber string) (*ListRoleResponse, error) { - path := "/v1/Services/{ServiceSid}/Roles" + path := "/v1/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Role records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -214,6 +219,7 @@ func (c *ApiService) StreamRole(ServiceSid string, params *ListRoleParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRoleParams, recordChannel chan ChatV1Role, errorChannel chan error) { curRecord := 1 @@ -245,60 +251,62 @@ func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRolePara } func (c *ApiService) getNextListRoleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRole' type UpdateRoleParams struct { - // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type` and are described in the documentation. - Permission *[]string `json:"Permission,omitempty"` + // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type` and are described in the documentation. + Permission *[]string `json:"Permission,omitempty"` } -func (params *UpdateRoleParams) SetPermission(Permission []string) *UpdateRoleParams { - params.Permission = &Permission - return params +func (params *UpdateRoleParams) SetPermission(Permission []string) (*UpdateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) UpdateRole(ServiceSid string, Sid string, params *UpdateRoleParams) (*ChatV1Role, error) { - path := "/v1/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v1/services_users.go b/rest/chat/v1/services_users.go index 7a58491fd..00b1b672d 100644 --- a/rest/chat/v1/services_users.go +++ b/rest/chat/v1/services_users.go @@ -18,169 +18,174 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUser' type CreateUserParams struct { - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/v1/service). This value is often a username or email address. See the Identity documentation for more details. - Identity *string `json:"Identity,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new User. - RoleSid *string `json:"RoleSid,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // A descriptive string that you create to describe the new resource. This value is often used for display purposes. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/v1/service). This value is often a username or email address. See the Identity documentation for more details. + Identity *string `json:"Identity,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new User. + RoleSid *string `json:"RoleSid,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the new resource. This value is often used for display purposes. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateUserParams) SetIdentity(Identity string) *CreateUserParams { - params.Identity = &Identity - return params +func (params *CreateUserParams) SetIdentity(Identity string) (*CreateUserParams){ + params.Identity = &Identity + return params } -func (params *CreateUserParams) SetRoleSid(RoleSid string) *CreateUserParams { - params.RoleSid = &RoleSid - return params +func (params *CreateUserParams) SetRoleSid(RoleSid string) (*CreateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *CreateUserParams) SetAttributes(Attributes string) *CreateUserParams { - params.Attributes = &Attributes - return params +func (params *CreateUserParams) SetAttributes(Attributes string) (*CreateUserParams){ + params.Attributes = &Attributes + return params } -func (params *CreateUserParams) SetFriendlyName(FriendlyName string) *CreateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateUserParams) SetFriendlyName(FriendlyName string) (*CreateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateUser(ServiceSid string, params *CreateUserParams) (*ChatV1User, error) { - path := "/v1/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Users" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteUser(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - ps := &ChatV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteUser(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchUser(ServiceSid string, Sid string, ) (*ChatV1User, error) { + path := "/v1/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchUser(ServiceSid string, Sid string) (*ChatV1User, error) { - path := "/v1/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListUser' type ListUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserParams) SetPageSize(PageSize int) *ListUserParams { - params.PageSize = &PageSize - return params +func (params *ListUserParams) SetPageSize(PageSize int) (*ListUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserParams) SetLimit(Limit int) *ListUserParams { - params.Limit = &Limit - return params +func (params *ListUserParams) SetLimit(Limit int) (*ListUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of User records from the API. Request is executed immediately. func (c *ApiService) PageUser(ServiceSid string, params *ListUserParams, pageToken, pageNumber string) (*ListUserResponse, error) { - path := "/v1/Services/{ServiceSid}/Users" + path := "/v1/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists User records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -221,6 +226,7 @@ func (c *ApiService) StreamUser(ServiceSid string, params *ListUserParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserParams, recordChannel chan ChatV1User, errorChannel chan error) { curRecord := 1 @@ -252,76 +258,78 @@ func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserPara } func (c *ApiService) getNextListUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUser' type UpdateUserParams struct { - // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to this user. - RoleSid *string `json:"RoleSid,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // A descriptive string that you create to describe the resource. It is often used for display purposes. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to this user. + RoleSid *string `json:"RoleSid,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the resource. It is often used for display purposes. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateUserParams) SetRoleSid(RoleSid string) *UpdateUserParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateUserParams) SetRoleSid(RoleSid string) (*UpdateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *UpdateUserParams) SetAttributes(Attributes string) *UpdateUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateUserParams) SetAttributes(Attributes string) (*UpdateUserParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) *UpdateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) (*UpdateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateUser(ServiceSid string, Sid string, params *UpdateUserParams) (*ChatV1User, error) { - path := "/v1/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v1/services_users_channels.go b/rest/chat/v1/services_users_channels.go index eb3c21f9a..f7d0772ed 100644 --- a/rest/chat/v1/services_users_channels.go +++ b/rest/chat/v1/services_users_channels.go @@ -18,62 +18,62 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUserChannel' type ListUserChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserChannelParams) SetPageSize(PageSize int) *ListUserChannelParams { - params.PageSize = &PageSize - return params +func (params *ListUserChannelParams) SetPageSize(PageSize int) (*ListUserChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserChannelParams) SetLimit(Limit int) *ListUserChannelParams { - params.Limit = &Limit - return params +func (params *ListUserChannelParams) SetLimit(Limit int) (*ListUserChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserChannel records from the API. Request is executed immediately. func (c *ApiService) PageUserChannel(ServiceSid string, UserSid string, params *ListUserChannelParams, pageToken, pageNumber string) (*ListUserChannelResponse, error) { - path := "/v1/Services/{ServiceSid}/Users/{UserSid}/Channels" + path := "/v1/Services/{ServiceSid}/Users/{UserSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UserChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -114,6 +114,7 @@ func (c *ApiService) StreamUserChannel(ServiceSid string, UserSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params *ListUserChannelParams, recordChannel chan ChatV1UserChannel, errorChannel chan error) { curRecord := 1 @@ -145,19 +146,20 @@ func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params } func (c *ApiService) getNextListUserChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/chat/v2/README.md b/rest/chat/v2/README.md index 3cf47722b..71a6bdf0b 100644 --- a/rest/chat/v2/README.md +++ b/rest/chat/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/chat/v2/api_service.go b/rest/chat/v2/api_service.go index 8ffb94b7a..64d34bc28 100644 --- a/rest/chat/v2/api_service.go +++ b/rest/chat/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://chat.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/chat/v2/credentials.go b/rest/chat/v2/credentials.go index 376caa738..5f99afd20 100644 --- a/rest/chat/v2/credentials.go +++ b/rest/chat/v2/credentials.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredential' type CreateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *CreateCredentialParams) SetType(Type string) *CreateCredentialParams { - params.Type = &Type - return params +func (params *CreateCredentialParams) SetType(Type string) (*CreateCredentialParams){ + params.Type = &Type + return params } -func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) *CreateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) (*CreateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialParams) SetCertificate(Certificate string) *CreateCredentialParams { - params.Certificate = &Certificate - return params +func (params *CreateCredentialParams) SetCertificate(Certificate string) (*CreateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) *CreateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) (*CreateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *CreateCredentialParams) SetSandbox(Sandbox bool) *CreateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *CreateCredentialParams) SetSandbox(Sandbox bool) (*CreateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *CreateCredentialParams) SetApiKey(ApiKey string) *CreateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *CreateCredentialParams) SetApiKey(ApiKey string) (*CreateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *CreateCredentialParams) SetSecret(Secret string) *CreateCredentialParams { - params.Secret = &Secret - return params +func (params *CreateCredentialParams) SetSecret(Secret string) (*CreateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) CreateCredential(params *CreateCredentialParams) (*ChatV2Credential, error) { - path := "/v2/Credentials" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Credentials" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } +// +func (c *ApiService) DeleteCredential(Sid string, ) (error) { + path := "/v2/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &ChatV2Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteCredential(Sid string) error { - path := "/v2/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchCredential(Sid string, ) (*ChatV2Credential, error) { + path := "/v2/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchCredential(Sid string) (*ChatV2Credential, error) { - path := "/v2/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &ChatV2Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &ChatV2Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListCredential' type ListCredentialParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialParams) SetPageSize(PageSize int) *ListCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialParams) SetPageSize(PageSize int) (*ListCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialParams) SetLimit(Limit int) *ListCredentialParams { - params.Limit = &Limit - return params +func (params *ListCredentialParams) SetLimit(Limit int) (*ListCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Credential records from the API. Request is executed immediately. func (c *ApiService) PageCredential(params *ListCredentialParams, pageToken, pageNumber string) (*ListCredentialResponse, error) { - path := "/v2/Credentials" + path := "/v2/Credentials" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Credential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCredential(params *ListCredentialParams) (chan ChatV2 return recordChannel, errorChannel } + func (c *ApiService) streamCredential(response *ListCredentialResponse, params *ListCredentialParams, recordChannel chan ChatV2Credential, errorChannel chan error) { curRecord := 1 @@ -274,102 +281,104 @@ func (c *ApiService) streamCredential(response *ListCredentialResponse, params * } func (c *ApiService) getNextListCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredential' type UpdateCredentialParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) *UpdateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCredentialParams) SetCertificate(Certificate string) *UpdateCredentialParams { - params.Certificate = &Certificate - return params +func (params *UpdateCredentialParams) SetCertificate(Certificate string) (*UpdateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) *UpdateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) (*UpdateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) *UpdateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) (*UpdateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *UpdateCredentialParams) SetApiKey(ApiKey string) *UpdateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *UpdateCredentialParams) SetApiKey(ApiKey string) (*UpdateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *UpdateCredentialParams) SetSecret(Secret string) *UpdateCredentialParams { - params.Secret = &Secret - return params +func (params *UpdateCredentialParams) SetSecret(Secret string) (*UpdateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) UpdateCredential(Sid string, params *UpdateCredentialParams) (*ChatV2Credential, error) { - path := "/v2/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ChatV2Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/chat/v2/docs/ListBindingResponseMeta.md b/rest/chat/v2/docs/ListBindingResponseMeta.md index f40b7bc19..fcd580e38 100644 --- a/rest/chat/v2/docs/ListBindingResponseMeta.md +++ b/rest/chat/v2/docs/ListBindingResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/chat/v2/model_chat_v2_binding.go b/rest/chat/v2/model_chat_v2_binding.go index fdd884c9a..176942dab 100644 --- a/rest/chat/v2/model_chat_v2_binding.go +++ b/rest/chat/v2/model_chat_v2_binding.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Binding struct for ChatV2Binding type ChatV2Binding struct { - // The unique string that we created to identify the Binding resource. + // The unique string that we created to identify the Binding resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Binding resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Binding resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. + // The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. Endpoint *string `json:"endpoint,omitempty"` - // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + // The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. CredentialSid *string `json:"credential_sid,omitempty"` - BindingType *string `json:"binding_type,omitempty"` - // The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. + BindingType *string `json:"binding_type,omitempty"` + // The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. MessageTypes *[]string `json:"message_types,omitempty"` - // The absolute URL of the Binding resource. + // The absolute URL of the Binding resource. Url *string `json:"url,omitempty"` - // The absolute URLs of the Binding's [User](https://www.twilio.com/docs/chat/rest/user-resource). + // The absolute URLs of the Binding's [User](https://www.twilio.com/docs/chat/rest/user-resource). Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_channel.go b/rest/chat/v2/model_chat_v2_channel.go index 56915da6a..11b6d2480 100644 --- a/rest/chat/v2/model_chat_v2_channel.go +++ b/rest/chat/v2/model_chat_v2_channel.go @@ -13,38 +13,40 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Channel struct for ChatV2Channel type ChatV2Channel struct { - // The unique string that we created to identify the Channel resource. + // The unique string that we created to identify the Channel resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - Type *string `json:"type,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Type *string `json:"type,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. + // The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` - // The number of Members in the Channel. + // The number of Members in the Channel. MembersCount *int `json:"members_count,omitempty"` - // The number of Messages that have been passed in the Channel. + // The number of Messages that have been passed in the Channel. MessagesCount *int `json:"messages_count,omitempty"` - // The absolute URL of the Channel resource. + // The absolute URL of the Channel resource. Url *string `json:"url,omitempty"` - // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource), [Invites](https://www.twilio.com/docs/chat/rest/invite-resource), Webhooks and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. + // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource), [Invites](https://www.twilio.com/docs/chat/rest/invite-resource), Webhooks and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_channel_webhook.go b/rest/chat/v2/model_chat_v2_channel_webhook.go index 985ef93b5..543061a4f 100644 --- a/rest/chat/v2/model_chat_v2_channel_webhook.go +++ b/rest/chat/v2/model_chat_v2_channel_webhook.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2ChannelWebhook struct for ChatV2ChannelWebhook type ChatV2ChannelWebhook struct { - // The unique string that we created to identify the Channel Webhook resource. + // The unique string that we created to identify the Channel Webhook resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The type of webhook. Can be: `webhook`, `studio`, or `trigger`. + // The type of webhook. Can be: `webhook`, `studio`, or `trigger`. Type *string `json:"type,omitempty"` - // The absolute URL of the Channel Webhook resource. + // The absolute URL of the Channel Webhook resource. Url *string `json:"url,omitempty"` - // The JSON string that describes how the channel webhook is configured. The configuration object contains the `url`, `method`, `filters`, and `retry_count` values that are configured by the create and update actions. + // The JSON string that describes how the channel webhook is configured. The configuration object contains the `url`, `method`, `filters`, and `retry_count` values that are configured by the create and update actions. Configuration *interface{} `json:"configuration,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_credential.go b/rest/chat/v2/model_chat_v2_credential.go index 810ae0fbe..e8d8ef8ff 100644 --- a/rest/chat/v2/model_chat_v2_credential.go +++ b/rest/chat/v2/model_chat_v2_credential.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Credential struct for ChatV2Credential type ChatV2Credential struct { - // The unique string that we created to identify the Credential resource. + // The unique string that we created to identify the Credential resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Type *string `json:"type,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. Sandbox *string `json:"sandbox,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Credential resource. + // The absolute URL of the Credential resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_invite.go b/rest/chat/v2/model_chat_v2_invite.go index a12f97e7d..c452bae46 100644 --- a/rest/chat/v2/model_chat_v2_invite.go +++ b/rest/chat/v2/model_chat_v2_invite.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Invite struct for ChatV2Invite type ChatV2Invite struct { - // The unique string that we created to identify the Invite resource. + // The unique string that we created to identify the Invite resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Invite resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Invite resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the resource. + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the resource. RoleSid *string `json:"role_sid,omitempty"` - // The `identity` of the User that created the invite. + // The `identity` of the User that created the invite. CreatedBy *string `json:"created_by,omitempty"` - // The absolute URL of the Invite resource. + // The absolute URL of the Invite resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_member.go b/rest/chat/v2/model_chat_v2_member.go index 99b91d516..ef3e0dd7c 100644 --- a/rest/chat/v2/model_chat_v2_member.go +++ b/rest/chat/v2/model_chat_v2_member.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Member struct for ChatV2Member type ChatV2Member struct { - // The unique string that we created to identify the Member resource. + // The unique string that we created to identify the Member resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Member resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Member resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Member resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Member resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the member. + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the member. RoleSid *string `json:"role_sid,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. + // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). LastConsumptionTimestamp *time.Time `json:"last_consumption_timestamp,omitempty"` - // The absolute URL of the Member resource. + // The absolute URL of the Member resource. Url *string `json:"url,omitempty"` - // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_message.go b/rest/chat/v2/model_chat_v2_message.go index 1f6abd8b9..527a1d661 100644 --- a/rest/chat/v2/model_chat_v2_message.go +++ b/rest/chat/v2/model_chat_v2_message.go @@ -13,43 +13,45 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Message struct for ChatV2Message type ChatV2Message struct { - // The unique string that we created to identify the Message resource. + // The unique string that we created to identify the Message resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. AccountSid *string `json:"account_sid,omitempty"` - // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Message resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Message resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) that the message was sent to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) that the message was sent to. To *string `json:"to,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. + // The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. LastUpdatedBy *string `json:"last_updated_by,omitempty"` - // Whether the message has been edited since it was created. + // Whether the message has been edited since it was created. WasEdited *bool `json:"was_edited,omitempty"` - // The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. The default value is `system`. + // The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. The default value is `system`. From *string `json:"from,omitempty"` - // The content of the message. + // The content of the message. Body *string `json:"body,omitempty"` - // The index of the message within the [Channel](https://www.twilio.com/docs/chat/channels). Indices may skip numbers, but will always be in order of when the message was received. + // The index of the message within the [Channel](https://www.twilio.com/docs/chat/channels). Indices may skip numbers, but will always be in order of when the message was received. Index *int `json:"index,omitempty"` - // The Message type. Can be: `text` or `media`. + // The Message type. Can be: `text` or `media`. Type *string `json:"type,omitempty"` - // An object that describes the Message's media, if the message contains media. The object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. + // An object that describes the Message's media, if the message contains media. The object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. Media *interface{} `json:"media,omitempty"` - // The absolute URL of the Message resource. + // The absolute URL of the Message resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_role.go b/rest/chat/v2/model_chat_v2_role.go index 7549644de..eea8813c8 100644 --- a/rest/chat/v2/model_chat_v2_role.go +++ b/rest/chat/v2/model_chat_v2_role.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Role struct for ChatV2Role type ChatV2Role struct { - // The unique string that we created to identify the Role resource. + // The unique string that we created to identify the Role resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Role resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Role resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // An array of the permissions the role has been granted. + Type *string `json:"type,omitempty"` + // An array of the permissions the role has been granted. Permissions *[]string `json:"permissions,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Role resource. + // The absolute URL of the Role resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_service.go b/rest/chat/v2/model_chat_v2_service.go index d952e6626..52db29482 100644 --- a/rest/chat/v2/model_chat_v2_service.go +++ b/rest/chat/v2/model_chat_v2_service.go @@ -13,57 +13,59 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2Service struct for ChatV2Service type ChatV2Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + // The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. DefaultServiceRoleSid *string `json:"default_service_role_sid,omitempty"` - // The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + // The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. DefaultChannelRoleSid *string `json:"default_channel_role_sid,omitempty"` - // The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + // The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. DefaultChannelCreatorRoleSid *string `json:"default_channel_creator_role_sid,omitempty"` - // Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. + // Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. ReadStatusEnabled *bool `json:"read_status_enabled,omitempty"` - // Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. + // Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` - // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. + // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. TypingIndicatorTimeout *int `json:"typing_indicator_timeout,omitempty"` - // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. + // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. ConsumptionReportInterval *int `json:"consumption_report_interval,omitempty"` - // An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. + // An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. Limits *interface{} `json:"limits,omitempty"` - // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` - // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. PostWebhookUrl *string `json:"post_webhook_url,omitempty"` - // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. WebhookMethod *string `json:"webhook_method,omitempty"` - // The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + // The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. WebhookFilters *[]string `json:"webhook_filters,omitempty"` - // The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. + // The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. PreWebhookRetryCount *int `json:"pre_webhook_retry_count,omitempty"` - // The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. + // The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. PostWebhookRetryCount *int `json:"post_webhook_retry_count,omitempty"` - // The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + // The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. Notifications *interface{} `json:"notifications,omitempty"` - // An object that describes the properties of media that the service supports. The object contains the `size_limit_mb` property, which describes the size of the largest media file in MB; and the `compatibility_message` property, which contains the message text to send when a media message does not have any text. + // An object that describes the properties of media that the service supports. The object contains the `size_limit_mb` property, which describes the size of the largest media file in MB; and the `compatibility_message` property, which contains the message text to send when a media message does not have any text. Media *interface{} `json:"media,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/channels), [Roles](https://www.twilio.com/docs/chat/rest/role-resource), [Bindings](https://www.twilio.com/docs/chat/rest/binding-resource), and [Users](https://www.twilio.com/docs/chat/rest/user-resource). + // The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/channels), [Roles](https://www.twilio.com/docs/chat/rest/role-resource), [Bindings](https://www.twilio.com/docs/chat/rest/binding-resource), and [Users](https://www.twilio.com/docs/chat/rest/user-resource). Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_user.go b/rest/chat/v2/model_chat_v2_user.go index b8c44077a..61ae1becf 100644 --- a/rest/chat/v2/model_chat_v2_user.go +++ b/rest/chat/v2/model_chat_v2_user.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2User struct for ChatV2User type ChatV2User struct { - // The unique string that we created to identify the User resource. + // The unique string that we created to identify the User resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the user. + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the user. RoleSid *string `json:"role_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or an email address, and is case-sensitive. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or an email address, and is case-sensitive. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. + // Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. IsOnline *bool `json:"is_online,omitempty"` - // Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + // Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. IsNotifiable *bool `json:"is_notifiable,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The number of Channels the User is a Member of. + // The number of Channels the User is a Member of. JoinedChannelsCount *int `json:"joined_channels_count,omitempty"` - // The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/channels) and [Binding](https://www.twilio.com/docs/chat/rest/binding-resource) resources related to the user. + // The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/channels) and [Binding](https://www.twilio.com/docs/chat/rest/binding-resource) resources related to the user. Links *map[string]interface{} `json:"links,omitempty"` - // The absolute URL of the User resource. + // The absolute URL of the User resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_user_binding.go b/rest/chat/v2/model_chat_v2_user_binding.go index 54540b546..c528963a0 100644 --- a/rest/chat/v2/model_chat_v2_user_binding.go +++ b/rest/chat/v2/model_chat_v2_user_binding.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV2UserBinding struct for ChatV2UserBinding type ChatV2UserBinding struct { - // The unique string that we created to identify the User Binding resource. + // The unique string that we created to identify the User Binding resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Binding resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Binding resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Binding resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Binding resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique endpoint identifier for the User Binding. The format of the value depends on the `binding_type`. + // The unique endpoint identifier for the User Binding. The format of the value depends on the `binding_type`. Endpoint *string `json:"endpoint,omitempty"` - // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + // The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. Identity *string `json:"identity,omitempty"` - // The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) with the User Binding resource. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + // The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) with the User Binding resource. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. UserSid *string `json:"user_sid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + // The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. CredentialSid *string `json:"credential_sid,omitempty"` - BindingType *string `json:"binding_type,omitempty"` - // The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. + BindingType *string `json:"binding_type,omitempty"` + // The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. MessageTypes *[]string `json:"message_types,omitempty"` - // The absolute URL of the User Binding resource. + // The absolute URL of the User Binding resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_chat_v2_user_channel.go b/rest/chat/v2/model_chat_v2_user_channel.go index 011315191..205b27300 100644 --- a/rest/chat/v2/model_chat_v2_user_channel.go +++ b/rest/chat/v2/model_chat_v2_user_channel.go @@ -13,27 +13,32 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ChatV2UserChannel struct for ChatV2UserChannel type ChatV2UserChannel struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Channel resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Channel resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Channel resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Channel resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the User Channel resource belongs to. + // The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the User Channel resource belongs to. ChannelSid *string `json:"channel_sid,omitempty"` - // The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) the User Channel belongs to. + // The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) the User Channel belongs to. UserSid *string `json:"user_sid,omitempty"` - // The SID of a [Member](https://www.twilio.com/docs/chat/rest/member-resource) that represents the User on the Channel. + // The SID of a [Member](https://www.twilio.com/docs/chat/rest/member-resource) that represents the User on the Channel. MemberSid *string `json:"member_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. + Status *string `json:"status,omitempty"` + // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` - // The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](https://www.twilio.com/docs/chat/consumption-horizon) to learn how to mark messages as consumed. + // The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](https://www.twilio.com/docs/chat/consumption-horizon) to learn how to mark messages as consumed. UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` - // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource) , [Invites](https://www.twilio.com/docs/chat/rest/invite-resource) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. + // The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource) , [Invites](https://www.twilio.com/docs/chat/rest/invite-resource) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. Links *map[string]interface{} `json:"links,omitempty"` - // The absolute URL of the User Channel resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the User Channel resource. + Url *string `json:"url,omitempty"` NotificationLevel *string `json:"notification_level,omitempty"` } + + diff --git a/rest/chat/v2/model_list_binding_response.go b/rest/chat/v2/model_list_binding_response.go index 48c6cb2d3..5594a5154 100644 --- a/rest/chat/v2/model_list_binding_response.go +++ b/rest/chat/v2/model_list_binding_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBindingResponse struct for ListBindingResponse type ListBindingResponse struct { - Bindings []ChatV2Binding `json:"bindings,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Bindings []ChatV2Binding `json:"bindings,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_binding_response_meta.go b/rest/chat/v2/model_list_binding_response_meta.go index 6cf840e20..789836fc4 100644 --- a/rest/chat/v2/model_list_binding_response_meta.go +++ b/rest/chat/v2/model_list_binding_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBindingResponseMeta struct for ListBindingResponseMeta type ListBindingResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/chat/v2/model_list_channel_response.go b/rest/chat/v2/model_list_channel_response.go index 6f17878b3..470db4bbd 100644 --- a/rest/chat/v2/model_list_channel_response.go +++ b/rest/chat/v2/model_list_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponse struct for ListChannelResponse type ListChannelResponse struct { - Channels []ChatV2Channel `json:"channels,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Channels []ChatV2Channel `json:"channels,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_channel_webhook_response.go b/rest/chat/v2/model_list_channel_webhook_response.go index 9df73f622..01ab60ca8 100644 --- a/rest/chat/v2/model_list_channel_webhook_response.go +++ b/rest/chat/v2/model_list_channel_webhook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelWebhookResponse struct for ListChannelWebhookResponse type ListChannelWebhookResponse struct { - Webhooks []ChatV2ChannelWebhook `json:"webhooks,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Webhooks []ChatV2ChannelWebhook `json:"webhooks,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_credential_response.go b/rest/chat/v2/model_list_credential_response.go index c78283761..95aa7ad79 100644 --- a/rest/chat/v2/model_list_credential_response.go +++ b/rest/chat/v2/model_list_credential_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialResponse struct for ListCredentialResponse type ListCredentialResponse struct { - Credentials []ChatV2Credential `json:"credentials,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Credentials []ChatV2Credential `json:"credentials,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_invite_response.go b/rest/chat/v2/model_list_invite_response.go index c640aceb5..1ef4bf23b 100644 --- a/rest/chat/v2/model_list_invite_response.go +++ b/rest/chat/v2/model_list_invite_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInviteResponse struct for ListInviteResponse type ListInviteResponse struct { - Invites []ChatV2Invite `json:"invites,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Invites []ChatV2Invite `json:"invites,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_member_response.go b/rest/chat/v2/model_list_member_response.go index 7d1fc5178..3f3ff49f1 100644 --- a/rest/chat/v2/model_list_member_response.go +++ b/rest/chat/v2/model_list_member_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMemberResponse struct for ListMemberResponse type ListMemberResponse struct { - Members []ChatV2Member `json:"members,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Members []ChatV2Member `json:"members,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_message_response.go b/rest/chat/v2/model_list_message_response.go index b67ae0f43..b00a74d29 100644 --- a/rest/chat/v2/model_list_message_response.go +++ b/rest/chat/v2/model_list_message_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessageResponse struct for ListMessageResponse type ListMessageResponse struct { - Messages []ChatV2Message `json:"messages,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Messages []ChatV2Message `json:"messages,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_role_response.go b/rest/chat/v2/model_list_role_response.go index cec1927ee..bcfe7573a 100644 --- a/rest/chat/v2/model_list_role_response.go +++ b/rest/chat/v2/model_list_role_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoleResponse struct for ListRoleResponse type ListRoleResponse struct { - Roles []ChatV2Role `json:"roles,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Roles []ChatV2Role `json:"roles,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_service_response.go b/rest/chat/v2/model_list_service_response.go index 0174ff561..b6316b6b2 100644 --- a/rest/chat/v2/model_list_service_response.go +++ b/rest/chat/v2/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []ChatV2Service `json:"services,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Services []ChatV2Service `json:"services,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_user_binding_response.go b/rest/chat/v2/model_list_user_binding_response.go index 76febfd2d..d9c1edc42 100644 --- a/rest/chat/v2/model_list_user_binding_response.go +++ b/rest/chat/v2/model_list_user_binding_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserBindingResponse struct for ListUserBindingResponse type ListUserBindingResponse struct { - Bindings []ChatV2UserBinding `json:"bindings,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Bindings []ChatV2UserBinding `json:"bindings,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_user_channel_response.go b/rest/chat/v2/model_list_user_channel_response.go index 779ca3d0b..cfdd35823 100644 --- a/rest/chat/v2/model_list_user_channel_response.go +++ b/rest/chat/v2/model_list_user_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserChannelResponse struct for ListUserChannelResponse type ListUserChannelResponse struct { - Channels []ChatV2UserChannel `json:"channels,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Channels []ChatV2UserChannel `json:"channels,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/model_list_user_response.go b/rest/chat/v2/model_list_user_response.go index 94d67e033..2c33c9d84 100644 --- a/rest/chat/v2/model_list_user_response.go +++ b/rest/chat/v2/model_list_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserResponse struct for ListUserResponse type ListUserResponse struct { - Users []ChatV2User `json:"users,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Users []ChatV2User `json:"users,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/chat/v2/services.go b/rest/chat/v2/services.go index 8a5a3e2a1..0aebb60e0 100644 --- a/rest/chat/v2/services.go +++ b/rest/chat/v2/services.go @@ -18,137 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A descriptive string that you create to describe the new resource. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the new resource. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateService(params *CreateServiceParams) (*ChatV2Service, error) { - path := "/v2/Services" + path := "/v2/Services" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchService(Sid string) (*ChatV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchService(Sid string, ) (*ChatV2Service, error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v2/Services" + path := "/v2/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +195,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan ChatV2Servic return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan ChatV2Service, errorChannel chan error) { curRecord := 1 @@ -220,329 +227,331 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // A descriptive string that you create to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. - DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` - // The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. - DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` - // The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. - DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` - // Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. - ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` - // Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. - ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` - // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. - TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` - // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. - ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` - // Whether to send a notification when a new message is added to a channel. The default is `false`. - NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` - // The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. - NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` - // The name of the sound to play when a new message is added to a channel and `notifications.new_message.enabled` is `true`. - NotificationsNewMessageSound *string `json:"Notifications.NewMessage.Sound,omitempty"` - // Whether the new message badge is enabled. The default is `false`. - NotificationsNewMessageBadgeCountEnabled *bool `json:"Notifications.NewMessage.BadgeCountEnabled,omitempty"` - // Whether to send a notification when a member is added to a channel. The default is `false`. - NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` - // The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. - NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` - // The name of the sound to play when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. - NotificationsAddedToChannelSound *string `json:"Notifications.AddedToChannel.Sound,omitempty"` - // Whether to send a notification to a user when they are removed from a channel. The default is `false`. - NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` - // The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. - NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` - // The name of the sound to play to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. - NotificationsRemovedFromChannelSound *string `json:"Notifications.RemovedFromChannel.Sound,omitempty"` - // Whether to send a notification when a user is invited to a channel. The default is `false`. - NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` - // The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. - NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` - // The name of the sound to play when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. - NotificationsInvitedToChannelSound *string `json:"Notifications.InvitedToChannel.Sound,omitempty"` - // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` - // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` - // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - WebhookMethod *string `json:"WebhookMethod,omitempty"` - // The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - WebhookFilters *[]string `json:"WebhookFilters,omitempty"` - // The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. - LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` - // The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. - LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` - // The message to send when a media message has no text. Can be used as placeholder message. - MediaCompatibilityMessage *string `json:"Media.CompatibilityMessage,omitempty"` - // The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. - PreWebhookRetryCount *int `json:"PreWebhookRetryCount,omitempty"` - // The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. - PostWebhookRetryCount *int `json:"PostWebhookRetryCount,omitempty"` - // Whether to log notifications. The default is `false`. - NotificationsLogEnabled *bool `json:"Notifications.LogEnabled,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) *UpdateServiceParams { - params.DefaultServiceRoleSid = &DefaultServiceRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) *UpdateServiceParams { - params.DefaultChannelRoleSid = &DefaultChannelRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) *UpdateServiceParams { - params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid - return params -} -func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) *UpdateServiceParams { - params.ReadStatusEnabled = &ReadStatusEnabled - return params -} -func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) *UpdateServiceParams { - params.ReachabilityEnabled = &ReachabilityEnabled - return params -} -func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) *UpdateServiceParams { - params.TypingIndicatorTimeout = &TypingIndicatorTimeout - return params -} -func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) *UpdateServiceParams { - params.ConsumptionReportInterval = &ConsumptionReportInterval - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) *UpdateServiceParams { - params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) *UpdateServiceParams { - params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageSound(NotificationsNewMessageSound string) *UpdateServiceParams { - params.NotificationsNewMessageSound = &NotificationsNewMessageSound - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageBadgeCountEnabled(NotificationsNewMessageBadgeCountEnabled bool) *UpdateServiceParams { - params.NotificationsNewMessageBadgeCountEnabled = &NotificationsNewMessageBadgeCountEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelSound(NotificationsAddedToChannelSound string) *UpdateServiceParams { - params.NotificationsAddedToChannelSound = &NotificationsAddedToChannelSound - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) *UpdateServiceParams { - params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) *UpdateServiceParams { - params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelSound(NotificationsRemovedFromChannelSound string) *UpdateServiceParams { - params.NotificationsRemovedFromChannelSound = &NotificationsRemovedFromChannelSound - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelSound(NotificationsInvitedToChannelSound string) *UpdateServiceParams { - params.NotificationsInvitedToChannelSound = &NotificationsInvitedToChannelSound - return params -} -func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) *UpdateServiceParams { - params.PreWebhookUrl = &PreWebhookUrl - return params + // A descriptive string that you create to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` + // The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` + // The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` + // Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. + ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` + // Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. + ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` + // How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. + TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` + // DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. + ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` + // Whether to send a notification when a new message is added to a channel. The default is `false`. + NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` + // The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. + NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` + // The name of the sound to play when a new message is added to a channel and `notifications.new_message.enabled` is `true`. + NotificationsNewMessageSound *string `json:"Notifications.NewMessage.Sound,omitempty"` + // Whether the new message badge is enabled. The default is `false`. + NotificationsNewMessageBadgeCountEnabled *bool `json:"Notifications.NewMessage.BadgeCountEnabled,omitempty"` + // Whether to send a notification when a member is added to a channel. The default is `false`. + NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` + // The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. + NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` + // The name of the sound to play when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. + NotificationsAddedToChannelSound *string `json:"Notifications.AddedToChannel.Sound,omitempty"` + // Whether to send a notification to a user when they are removed from a channel. The default is `false`. + NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` + // The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. + NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` + // The name of the sound to play to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. + NotificationsRemovedFromChannelSound *string `json:"Notifications.RemovedFromChannel.Sound,omitempty"` + // Whether to send a notification when a user is invited to a channel. The default is `false`. + NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` + // The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. + NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` + // The name of the sound to play when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. + NotificationsInvitedToChannelSound *string `json:"Notifications.InvitedToChannel.Sound,omitempty"` + // The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` + // The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` + // The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + WebhookMethod *string `json:"WebhookMethod,omitempty"` + // The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + WebhookFilters *[]string `json:"WebhookFilters,omitempty"` + // The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. + LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` + // The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. + LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` + // The message to send when a media message has no text. Can be used as placeholder message. + MediaCompatibilityMessage *string `json:"Media.CompatibilityMessage,omitempty"` + // The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. + PreWebhookRetryCount *int `json:"PreWebhookRetryCount,omitempty"` + // The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. + PostWebhookRetryCount *int `json:"PostWebhookRetryCount,omitempty"` + // Whether to log notifications. The default is `false`. + NotificationsLogEnabled *bool `json:"Notifications.LogEnabled,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) (*UpdateServiceParams){ + params.DefaultServiceRoleSid = &DefaultServiceRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelRoleSid = &DefaultChannelRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid + return params +} +func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) (*UpdateServiceParams){ + params.ReadStatusEnabled = &ReadStatusEnabled + return params +} +func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) (*UpdateServiceParams){ + params.ReachabilityEnabled = &ReachabilityEnabled + return params +} +func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) (*UpdateServiceParams){ + params.TypingIndicatorTimeout = &TypingIndicatorTimeout + return params +} +func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) (*UpdateServiceParams){ + params.ConsumptionReportInterval = &ConsumptionReportInterval + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) (*UpdateServiceParams){ + params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) (*UpdateServiceParams){ + params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageSound(NotificationsNewMessageSound string) (*UpdateServiceParams){ + params.NotificationsNewMessageSound = &NotificationsNewMessageSound + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageBadgeCountEnabled(NotificationsNewMessageBadgeCountEnabled bool) (*UpdateServiceParams){ + params.NotificationsNewMessageBadgeCountEnabled = &NotificationsNewMessageBadgeCountEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelSound(NotificationsAddedToChannelSound string) (*UpdateServiceParams){ + params.NotificationsAddedToChannelSound = &NotificationsAddedToChannelSound + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelSound(NotificationsRemovedFromChannelSound string) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelSound = &NotificationsRemovedFromChannelSound + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelSound(NotificationsInvitedToChannelSound string) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelSound = &NotificationsInvitedToChannelSound + return params +} +func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) (*UpdateServiceParams){ + params.PreWebhookUrl = &PreWebhookUrl + return params } -func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) *UpdateServiceParams { - params.PostWebhookUrl = &PostWebhookUrl - return params +func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) (*UpdateServiceParams){ + params.PostWebhookUrl = &PostWebhookUrl + return params } -func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) *UpdateServiceParams { - params.WebhookMethod = &WebhookMethod - return params +func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) (*UpdateServiceParams){ + params.WebhookMethod = &WebhookMethod + return params } -func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) *UpdateServiceParams { - params.WebhookFilters = &WebhookFilters - return params +func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) (*UpdateServiceParams){ + params.WebhookFilters = &WebhookFilters + return params } -func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) *UpdateServiceParams { - params.LimitsChannelMembers = &LimitsChannelMembers - return params +func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) (*UpdateServiceParams){ + params.LimitsChannelMembers = &LimitsChannelMembers + return params } -func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) *UpdateServiceParams { - params.LimitsUserChannels = &LimitsUserChannels - return params +func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) (*UpdateServiceParams){ + params.LimitsUserChannels = &LimitsUserChannels + return params } -func (params *UpdateServiceParams) SetMediaCompatibilityMessage(MediaCompatibilityMessage string) *UpdateServiceParams { - params.MediaCompatibilityMessage = &MediaCompatibilityMessage - return params +func (params *UpdateServiceParams) SetMediaCompatibilityMessage(MediaCompatibilityMessage string) (*UpdateServiceParams){ + params.MediaCompatibilityMessage = &MediaCompatibilityMessage + return params } -func (params *UpdateServiceParams) SetPreWebhookRetryCount(PreWebhookRetryCount int) *UpdateServiceParams { - params.PreWebhookRetryCount = &PreWebhookRetryCount - return params +func (params *UpdateServiceParams) SetPreWebhookRetryCount(PreWebhookRetryCount int) (*UpdateServiceParams){ + params.PreWebhookRetryCount = &PreWebhookRetryCount + return params } -func (params *UpdateServiceParams) SetPostWebhookRetryCount(PostWebhookRetryCount int) *UpdateServiceParams { - params.PostWebhookRetryCount = &PostWebhookRetryCount - return params +func (params *UpdateServiceParams) SetPostWebhookRetryCount(PostWebhookRetryCount int) (*UpdateServiceParams){ + params.PostWebhookRetryCount = &PostWebhookRetryCount + return params } -func (params *UpdateServiceParams) SetNotificationsLogEnabled(NotificationsLogEnabled bool) *UpdateServiceParams { - params.NotificationsLogEnabled = &NotificationsLogEnabled - return params +func (params *UpdateServiceParams) SetNotificationsLogEnabled(NotificationsLogEnabled bool) (*UpdateServiceParams){ + params.NotificationsLogEnabled = &NotificationsLogEnabled + return params } -// +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*ChatV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DefaultServiceRoleSid != nil { - data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) - } - if params != nil && params.DefaultChannelRoleSid != nil { - data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) - } - if params != nil && params.DefaultChannelCreatorRoleSid != nil { - data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) - } - if params != nil && params.ReadStatusEnabled != nil { - data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) - } - if params != nil && params.ReachabilityEnabled != nil { - data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) - } - if params != nil && params.TypingIndicatorTimeout != nil { - data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) - } - if params != nil && params.ConsumptionReportInterval != nil { - data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) - } - if params != nil && params.NotificationsNewMessageEnabled != nil { - data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) - } - if params != nil && params.NotificationsNewMessageTemplate != nil { - data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) - } - if params != nil && params.NotificationsNewMessageSound != nil { - data.Set("Notifications.NewMessage.Sound", *params.NotificationsNewMessageSound) - } - if params != nil && params.NotificationsNewMessageBadgeCountEnabled != nil { - data.Set("Notifications.NewMessage.BadgeCountEnabled", fmt.Sprint(*params.NotificationsNewMessageBadgeCountEnabled)) - } - if params != nil && params.NotificationsAddedToChannelEnabled != nil { - data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) - } - if params != nil && params.NotificationsAddedToChannelTemplate != nil { - data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) - } - if params != nil && params.NotificationsAddedToChannelSound != nil { - data.Set("Notifications.AddedToChannel.Sound", *params.NotificationsAddedToChannelSound) - } - if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { - data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) - } - if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { - data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) - } - if params != nil && params.NotificationsRemovedFromChannelSound != nil { - data.Set("Notifications.RemovedFromChannel.Sound", *params.NotificationsRemovedFromChannelSound) - } - if params != nil && params.NotificationsInvitedToChannelEnabled != nil { - data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) - } - if params != nil && params.NotificationsInvitedToChannelTemplate != nil { - data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) - } - if params != nil && params.NotificationsInvitedToChannelSound != nil { - data.Set("Notifications.InvitedToChannel.Sound", *params.NotificationsInvitedToChannelSound) - } - if params != nil && params.PreWebhookUrl != nil { - data.Set("PreWebhookUrl", *params.PreWebhookUrl) - } - if params != nil && params.PostWebhookUrl != nil { - data.Set("PostWebhookUrl", *params.PostWebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - if params != nil && params.WebhookFilters != nil { - for _, item := range *params.WebhookFilters { - data.Add("WebhookFilters", item) - } - } - if params != nil && params.LimitsChannelMembers != nil { - data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) - } - if params != nil && params.LimitsUserChannels != nil { - data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) - } - if params != nil && params.MediaCompatibilityMessage != nil { - data.Set("Media.CompatibilityMessage", *params.MediaCompatibilityMessage) - } - if params != nil && params.PreWebhookRetryCount != nil { - data.Set("PreWebhookRetryCount", fmt.Sprint(*params.PreWebhookRetryCount)) - } - if params != nil && params.PostWebhookRetryCount != nil { - data.Set("PostWebhookRetryCount", fmt.Sprint(*params.PostWebhookRetryCount)) - } - if params != nil && params.NotificationsLogEnabled != nil { - data.Set("Notifications.LogEnabled", fmt.Sprint(*params.NotificationsLogEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ChatV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DefaultServiceRoleSid != nil { + data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) + } + if params != nil && params.DefaultChannelRoleSid != nil { + data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) + } + if params != nil && params.DefaultChannelCreatorRoleSid != nil { + data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) + } + if params != nil && params.ReadStatusEnabled != nil { + data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) + } + if params != nil && params.ReachabilityEnabled != nil { + data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) + } + if params != nil && params.TypingIndicatorTimeout != nil { + data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) + } + if params != nil && params.ConsumptionReportInterval != nil { + data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) + } + if params != nil && params.NotificationsNewMessageEnabled != nil { + data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) + } + if params != nil && params.NotificationsNewMessageTemplate != nil { + data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) + } + if params != nil && params.NotificationsNewMessageSound != nil { + data.Set("Notifications.NewMessage.Sound", *params.NotificationsNewMessageSound) + } + if params != nil && params.NotificationsNewMessageBadgeCountEnabled != nil { + data.Set("Notifications.NewMessage.BadgeCountEnabled", fmt.Sprint(*params.NotificationsNewMessageBadgeCountEnabled)) + } + if params != nil && params.NotificationsAddedToChannelEnabled != nil { + data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) + } + if params != nil && params.NotificationsAddedToChannelTemplate != nil { + data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) + } + if params != nil && params.NotificationsAddedToChannelSound != nil { + data.Set("Notifications.AddedToChannel.Sound", *params.NotificationsAddedToChannelSound) + } + if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { + data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) + } + if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { + data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) + } + if params != nil && params.NotificationsRemovedFromChannelSound != nil { + data.Set("Notifications.RemovedFromChannel.Sound", *params.NotificationsRemovedFromChannelSound) + } + if params != nil && params.NotificationsInvitedToChannelEnabled != nil { + data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) + } + if params != nil && params.NotificationsInvitedToChannelTemplate != nil { + data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) + } + if params != nil && params.NotificationsInvitedToChannelSound != nil { + data.Set("Notifications.InvitedToChannel.Sound", *params.NotificationsInvitedToChannelSound) + } + if params != nil && params.PreWebhookUrl != nil { + data.Set("PreWebhookUrl", *params.PreWebhookUrl) + } + if params != nil && params.PostWebhookUrl != nil { + data.Set("PostWebhookUrl", *params.PostWebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + if params != nil && params.WebhookFilters != nil { + for _, item := range *params.WebhookFilters { + data.Add("WebhookFilters", item) + } + } + if params != nil && params.LimitsChannelMembers != nil { + data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) + } + if params != nil && params.LimitsUserChannels != nil { + data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) + } + if params != nil && params.MediaCompatibilityMessage != nil { + data.Set("Media.CompatibilityMessage", *params.MediaCompatibilityMessage) + } + if params != nil && params.PreWebhookRetryCount != nil { + data.Set("PreWebhookRetryCount", fmt.Sprint(*params.PreWebhookRetryCount)) + } + if params != nil && params.PostWebhookRetryCount != nil { + data.Set("PostWebhookRetryCount", fmt.Sprint(*params.PostWebhookRetryCount)) + } + if params != nil && params.NotificationsLogEnabled != nil { + data.Set("Notifications.LogEnabled", fmt.Sprint(*params.NotificationsLogEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/chat/v2/services_bindings.go b/rest/chat/v2/services_bindings.go index 74d6d4a21..716c0cc55 100644 --- a/rest/chat/v2/services_bindings.go +++ b/rest/chat/v2/services_bindings.go @@ -18,126 +18,130 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteBinding(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteBinding(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchBinding(ServiceSid string, Sid string) (*ChatV2Binding, error) { - path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchBinding(ServiceSid string, Sid string, ) (*ChatV2Binding, error) { + path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2Binding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ChatV2Binding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListBinding' type ListBindingParams struct { - // The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - BindingType *[]string `json:"BindingType,omitempty"` - // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + BindingType *[]string `json:"BindingType,omitempty"` + // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBindingParams) SetBindingType(BindingType []string) *ListBindingParams { - params.BindingType = &BindingType - return params +func (params *ListBindingParams) SetBindingType(BindingType []string) (*ListBindingParams){ + params.BindingType = &BindingType + return params } -func (params *ListBindingParams) SetIdentity(Identity []string) *ListBindingParams { - params.Identity = &Identity - return params +func (params *ListBindingParams) SetIdentity(Identity []string) (*ListBindingParams){ + params.Identity = &Identity + return params } -func (params *ListBindingParams) SetPageSize(PageSize int) *ListBindingParams { - params.PageSize = &PageSize - return params +func (params *ListBindingParams) SetPageSize(PageSize int) (*ListBindingParams){ + params.PageSize = &PageSize + return params } -func (params *ListBindingParams) SetLimit(Limit int) *ListBindingParams { - params.Limit = &Limit - return params +func (params *ListBindingParams) SetLimit(Limit int) (*ListBindingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Binding records from the API. Request is executed immediately. func (c *ApiService) PageBinding(ServiceSid string, params *ListBindingParams, pageToken, pageNumber string) (*ListBindingResponse, error) { - path := "/v2/Services/{ServiceSid}/Bindings" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BindingType != nil { - for _, item := range *params.BindingType { - data.Add("BindingType", item) - } - } - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Bindings" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BindingType != nil { + for _, item := range *params.BindingType { + data.Add("BindingType", item) + } + } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Binding records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -178,6 +182,7 @@ func (c *ApiService) StreamBinding(ServiceSid string, params *ListBindingParams) return recordChannel, errorChannel } + func (c *ApiService) streamBinding(response *ListBindingResponse, params *ListBindingParams, recordChannel chan ChatV2Binding, errorChannel chan error) { curRecord := 1 @@ -209,19 +214,20 @@ func (c *ApiService) streamBinding(response *ListBindingResponse, params *ListBi } func (c *ApiService) getNextListBindingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/chat/v2/services_channels.go b/rest/chat/v2/services_channels.go index 56b59eb66..1e2fe76c6 100644 --- a/rest/chat/v2/services_channels.go +++ b/rest/chat/v2/services_channels.go @@ -18,233 +18,235 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannel' type CreateChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. - UniqueName *string `json:"UniqueName,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // - Type *string `json:"Type,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used in cases where a Channel is being recreated from a backup/separate source and where a Message was previously updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // The `identity` of the User that created the channel. Default is: `system`. - CreatedBy *string `json:"CreatedBy,omitempty"` -} - -func (params *CreateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) *CreateChannelParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateChannelParams) SetUniqueName(UniqueName string) *CreateChannelParams { - params.UniqueName = &UniqueName - return params -} -func (params *CreateChannelParams) SetAttributes(Attributes string) *CreateChannelParams { - params.Attributes = &Attributes - return params -} -func (params *CreateChannelParams) SetType(Type string) *CreateChannelParams { - params.Type = &Type - return params -} -func (params *CreateChannelParams) SetDateCreated(DateCreated time.Time) *CreateChannelParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateChannelParams) SetDateUpdated(DateUpdated time.Time) *CreateChannelParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateChannelParams) SetCreatedBy(CreatedBy string) *CreateChannelParams { - params.CreatedBy = &CreatedBy - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. + UniqueName *string `json:"UniqueName,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // + Type *string `json:"Type,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used in cases where a Channel is being recreated from a backup/separate source and where a Message was previously updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The `identity` of the User that created the channel. Default is: `system`. + CreatedBy *string `json:"CreatedBy,omitempty"` +} + +func (params *CreateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) (*CreateChannelParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateChannelParams) SetUniqueName(UniqueName string) (*CreateChannelParams){ + params.UniqueName = &UniqueName + return params +} +func (params *CreateChannelParams) SetAttributes(Attributes string) (*CreateChannelParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateChannelParams) SetType(Type string) (*CreateChannelParams){ + params.Type = &Type + return params +} +func (params *CreateChannelParams) SetDateCreated(DateCreated time.Time) (*CreateChannelParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateChannelParams) SetDateUpdated(DateUpdated time.Time) (*CreateChannelParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateChannelParams) SetCreatedBy(CreatedBy string) (*CreateChannelParams){ + params.CreatedBy = &CreatedBy + return params +} + +// func (c *ApiService) CreateChannel(ServiceSid string, params *CreateChannelParams) (*ChatV2Channel, error) { - path := "/v2/Services/{ServiceSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Channels" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.CreatedBy != nil { + data.Set("CreatedBy", *params.CreatedBy) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.CreatedBy != nil { - data.Set("CreatedBy", *params.CreatedBy) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteChannel' type DeleteChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -// -func (c *ApiService) DeleteChannel(ServiceSid string, Sid string, params *DeleteChannelParams) error { - path := "/v2/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteChannel(ServiceSid string, Sid string, params *DeleteChannelParams) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } -// -func (c *ApiService) FetchChannel(ServiceSid string, Sid string) (*ChatV2Channel, error) { - path := "/v2/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchChannel(ServiceSid string, Sid string, ) (*ChatV2Channel, error) { + path := "/v2/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ChatV2Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListChannel' type ListChannelParams struct { - // The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. - Type *[]string `json:"Type,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. + Type *[]string `json:"Type,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelParams) SetType(Type []string) *ListChannelParams { - params.Type = &Type - return params +func (params *ListChannelParams) SetType(Type []string) (*ListChannelParams){ + params.Type = &Type + return params } -func (params *ListChannelParams) SetPageSize(PageSize int) *ListChannelParams { - params.PageSize = &PageSize - return params +func (params *ListChannelParams) SetPageSize(PageSize int) (*ListChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelParams) SetLimit(Limit int) *ListChannelParams { - params.Limit = &Limit - return params +func (params *ListChannelParams) SetLimit(Limit int) (*ListChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Channel records from the API. Request is executed immediately. func (c *ApiService) PageChannel(ServiceSid string, params *ListChannelParams, pageToken, pageNumber string) (*ListChannelResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels" + path := "/v2/Services/{ServiceSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Type != nil { - for _, item := range *params.Type { - data.Add("Type", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Type != nil { + for _, item := range *params.Type { + data.Add("Type", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Channel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -285,6 +287,7 @@ func (c *ApiService) StreamChannel(ServiceSid string, params *ListChannelParams) return recordChannel, errorChannel } + func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListChannelParams, recordChannel chan ChatV2Channel, errorChannel chan error) { curRecord := 1 @@ -316,113 +319,114 @@ func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListCh } func (c *ApiService) getNextListChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChannel' type UpdateChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 256 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 256 characters or less in length and unique within the Service. - UniqueName *string `json:"UniqueName,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // The `identity` of the User that created the channel. Default is: `system`. - CreatedBy *string `json:"CreatedBy,omitempty"` -} - -func (params *UpdateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) *UpdateChannelParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateChannelParams) SetUniqueName(UniqueName string) *UpdateChannelParams { - params.UniqueName = &UniqueName - return params -} -func (params *UpdateChannelParams) SetAttributes(Attributes string) *UpdateChannelParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateChannelParams) SetDateCreated(DateCreated time.Time) *UpdateChannelParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateChannelParams) SetDateUpdated(DateUpdated time.Time) *UpdateChannelParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateChannelParams) SetCreatedBy(CreatedBy string) *UpdateChannelParams { - params.CreatedBy = &CreatedBy - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 256 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 256 characters or less in length and unique within the Service. + UniqueName *string `json:"UniqueName,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The `identity` of the User that created the channel. Default is: `system`. + CreatedBy *string `json:"CreatedBy,omitempty"` +} + +func (params *UpdateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) (*UpdateChannelParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateChannelParams) SetUniqueName(UniqueName string) (*UpdateChannelParams){ + params.UniqueName = &UniqueName + return params +} +func (params *UpdateChannelParams) SetAttributes(Attributes string) (*UpdateChannelParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateChannelParams) SetDateCreated(DateCreated time.Time) (*UpdateChannelParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateChannelParams) SetDateUpdated(DateUpdated time.Time) (*UpdateChannelParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateChannelParams) SetCreatedBy(CreatedBy string) (*UpdateChannelParams){ + params.CreatedBy = &CreatedBy + return params +} + +// func (c *ApiService) UpdateChannel(ServiceSid string, Sid string, params *UpdateChannelParams) (*ChatV2Channel, error) { - path := "/v2/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.CreatedBy != nil { + data.Set("CreatedBy", *params.CreatedBy) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.CreatedBy != nil { - data.Set("CreatedBy", *params.CreatedBy) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v2/services_channels_invites.go b/rest/chat/v2/services_channels_invites.go index 0b02c00d2..9dbb57e87 100644 --- a/rest/chat/v2/services_channels_invites.go +++ b/rest/chat/v2/services_channels_invites.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInvite' type CreateInviteParams struct { - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - Identity *string `json:"Identity,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new member. - RoleSid *string `json:"RoleSid,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + Identity *string `json:"Identity,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new member. + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateInviteParams) SetIdentity(Identity string) *CreateInviteParams { - params.Identity = &Identity - return params +func (params *CreateInviteParams) SetIdentity(Identity string) (*CreateInviteParams){ + params.Identity = &Identity + return params } -func (params *CreateInviteParams) SetRoleSid(RoleSid string) *CreateInviteParams { - params.RoleSid = &RoleSid - return params +func (params *CreateInviteParams) SetRoleSid(RoleSid string) (*CreateInviteParams){ + params.RoleSid = &RoleSid + return params } -// +// func (c *ApiService) CreateInvite(ServiceSid string, ChannelSid string, params *CreateInviteParams) (*ChatV2Invite, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV2Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV2Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string) (*ChatV2Invite, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV2Invite, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ChatV2Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListInvite' type ListInviteParams struct { - // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInviteParams) SetIdentity(Identity []string) *ListInviteParams { - params.Identity = &Identity - return params +func (params *ListInviteParams) SetIdentity(Identity []string) (*ListInviteParams){ + params.Identity = &Identity + return params } -func (params *ListInviteParams) SetPageSize(PageSize int) *ListInviteParams { - params.PageSize = &PageSize - return params +func (params *ListInviteParams) SetPageSize(PageSize int) (*ListInviteParams){ + params.PageSize = &PageSize + return params } -func (params *ListInviteParams) SetLimit(Limit int) *ListInviteParams { - params.Limit = &Limit - return params +func (params *ListInviteParams) SetLimit(Limit int) (*ListInviteParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Invite records from the API. Request is executed immediately. func (c *ApiService) PageInvite(ServiceSid string, ChannelSid string, params *ListInviteParams, pageToken, pageNumber string) (*ListInviteResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Invite records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamInvite(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInviteParams, recordChannel chan ChatV2Invite, errorChannel chan error) { curRecord := 1 @@ -249,19 +255,20 @@ func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInvi } func (c *ApiService) getNextListInviteResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/chat/v2/services_channels_members.go b/rest/chat/v2/services_channels_members.go index c0cefe5e9..9475249e6 100644 --- a/rest/chat/v2/services_channels_members.go +++ b/rest/chat/v2/services_channels_members.go @@ -18,237 +18,239 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMember' type CreateMemberParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - Identity *string `json:"Identity,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). - RoleSid *string `json:"RoleSid,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. This parameter should only be used when recreating a Member from a backup/separate source. - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). - LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used when a Member is being recreated from a backup/separate source and where a Member was previously updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` -} - -func (params *CreateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateMemberParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateMemberParams) SetIdentity(Identity string) *CreateMemberParams { - params.Identity = &Identity - return params -} -func (params *CreateMemberParams) SetRoleSid(RoleSid string) *CreateMemberParams { - params.RoleSid = &RoleSid - return params -} -func (params *CreateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *CreateMemberParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params -} -func (params *CreateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) *CreateMemberParams { - params.LastConsumptionTimestamp = &LastConsumptionTimestamp - return params -} -func (params *CreateMemberParams) SetDateCreated(DateCreated time.Time) *CreateMemberParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateMemberParams) SetDateUpdated(DateUpdated time.Time) *CreateMemberParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateMemberParams) SetAttributes(Attributes string) *CreateMemberParams { - params.Attributes = &Attributes - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + Identity *string `json:"Identity,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). + RoleSid *string `json:"RoleSid,omitempty"` + // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. This parameter should only be used when recreating a Member from a backup/separate source. + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). + LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used when a Member is being recreated from a backup/separate source and where a Member was previously updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` +} + +func (params *CreateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateMemberParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateMemberParams) SetIdentity(Identity string) (*CreateMemberParams){ + params.Identity = &Identity + return params +} +func (params *CreateMemberParams) SetRoleSid(RoleSid string) (*CreateMemberParams){ + params.RoleSid = &RoleSid + return params +} +func (params *CreateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*CreateMemberParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params +} +func (params *CreateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) (*CreateMemberParams){ + params.LastConsumptionTimestamp = &LastConsumptionTimestamp + return params +} +func (params *CreateMemberParams) SetDateCreated(DateCreated time.Time) (*CreateMemberParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateMemberParams) SetDateUpdated(DateUpdated time.Time) (*CreateMemberParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateMemberParams) SetAttributes(Attributes string) (*CreateMemberParams){ + params.Attributes = &Attributes + return params +} + +// func (c *ApiService) CreateMember(ServiceSid string, ChannelSid string, params *CreateMemberParams) (*ChatV2Member, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } + if params != nil && params.LastConsumptionTimestamp != nil { + data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } - if params != nil && params.LastConsumptionTimestamp != nil { - data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteMember' type DeleteMemberParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteMemberParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteMemberParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -// -func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string, params *DeleteMemberParams) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string, params *DeleteMemberParams) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } -// -func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string) (*ChatV2Member, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV2Member, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ChatV2Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMember' type ListMemberParams struct { - // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the Member resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the Member resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMemberParams) SetIdentity(Identity []string) *ListMemberParams { - params.Identity = &Identity - return params +func (params *ListMemberParams) SetIdentity(Identity []string) (*ListMemberParams){ + params.Identity = &Identity + return params } -func (params *ListMemberParams) SetPageSize(PageSize int) *ListMemberParams { - params.PageSize = &PageSize - return params +func (params *ListMemberParams) SetPageSize(PageSize int) (*ListMemberParams){ + params.PageSize = &PageSize + return params } -func (params *ListMemberParams) SetLimit(Limit int) *ListMemberParams { - params.Limit = &Limit - return params +func (params *ListMemberParams) SetLimit(Limit int) (*ListMemberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Member records from the API. Request is executed immediately. func (c *ApiService) PageMember(ServiceSid string, ChannelSid string, params *ListMemberParams, pageToken, pageNumber string) (*ListMemberResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Member records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -289,6 +291,7 @@ func (c *ApiService) StreamMember(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemberParams, recordChannel chan ChatV2Member, errorChannel chan error) { curRecord := 1 @@ -320,114 +323,115 @@ func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemb } func (c *ApiService) getNextListMemberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMember' type UpdateMemberParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). - RoleSid *string `json:"RoleSid,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) that the Member has read within the [Channel](https://www.twilio.com/docs/chat/channels). - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). - LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` -} - -func (params *UpdateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateMemberParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateMemberParams) SetRoleSid(RoleSid string) *UpdateMemberParams { - params.RoleSid = &RoleSid - return params -} -func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *UpdateMemberParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params -} -func (params *UpdateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) *UpdateMemberParams { - params.LastConsumptionTimestamp = &LastConsumptionTimestamp - return params -} -func (params *UpdateMemberParams) SetDateCreated(DateCreated time.Time) *UpdateMemberParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateMemberParams) SetDateUpdated(DateUpdated time.Time) *UpdateMemberParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateMemberParams) SetAttributes(Attributes string) *UpdateMemberParams { - params.Attributes = &Attributes - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). + RoleSid *string `json:"RoleSid,omitempty"` + // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) that the Member has read within the [Channel](https://www.twilio.com/docs/chat/channels). + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). + LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` +} + +func (params *UpdateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateMemberParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateMemberParams) SetRoleSid(RoleSid string) (*UpdateMemberParams){ + params.RoleSid = &RoleSid + return params +} +func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*UpdateMemberParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params +} +func (params *UpdateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) (*UpdateMemberParams){ + params.LastConsumptionTimestamp = &LastConsumptionTimestamp + return params +} +func (params *UpdateMemberParams) SetDateCreated(DateCreated time.Time) (*UpdateMemberParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateMemberParams) SetDateUpdated(DateUpdated time.Time) (*UpdateMemberParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateMemberParams) SetAttributes(Attributes string) (*UpdateMemberParams){ + params.Attributes = &Attributes + return params +} + +// func (c *ApiService) UpdateMember(ServiceSid string, ChannelSid string, Sid string, params *UpdateMemberParams) (*ChatV2Member, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } + if params != nil && params.LastConsumptionTimestamp != nil { + data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } - if params != nil && params.LastConsumptionTimestamp != nil { - data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v2/services_channels_messages.go b/rest/chat/v2/services_channels_messages.go index ca4ddb383..eaeca81a7 100644 --- a/rest/chat/v2/services_channels_messages.go +++ b/rest/chat/v2/services_channels_messages.go @@ -18,235 +18,237 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessage' type CreateMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The [Identity](https://www.twilio.com/docs/chat/identity) of the new message's author. The default value is `system`. - From *string `json:"From,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. - LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` - // The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. - Body *string `json:"Body,omitempty"` - // The SID of the [Media](https://www.twilio.com/docs/chat/rest/media) to attach to the new Message. - MediaSid *string `json:"MediaSid,omitempty"` -} - -func (params *CreateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateMessageParams) SetFrom(From string) *CreateMessageParams { - params.From = &From - return params -} -func (params *CreateMessageParams) SetAttributes(Attributes string) *CreateMessageParams { - params.Attributes = &Attributes - return params -} -func (params *CreateMessageParams) SetDateCreated(DateCreated time.Time) *CreateMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateMessageParams) SetDateUpdated(DateUpdated time.Time) *CreateMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) *CreateMessageParams { - params.LastUpdatedBy = &LastUpdatedBy - return params -} -func (params *CreateMessageParams) SetBody(Body string) *CreateMessageParams { - params.Body = &Body - return params -} -func (params *CreateMessageParams) SetMediaSid(MediaSid string) *CreateMessageParams { - params.MediaSid = &MediaSid - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The [Identity](https://www.twilio.com/docs/chat/identity) of the new message's author. The default value is `system`. + From *string `json:"From,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. + LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` + // The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. + Body *string `json:"Body,omitempty"` + // The SID of the [Media](https://www.twilio.com/docs/chat/rest/media) to attach to the new Message. + MediaSid *string `json:"MediaSid,omitempty"` +} + +func (params *CreateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateMessageParams) SetFrom(From string) (*CreateMessageParams){ + params.From = &From + return params +} +func (params *CreateMessageParams) SetAttributes(Attributes string) (*CreateMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateMessageParams) SetDateCreated(DateCreated time.Time) (*CreateMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateMessageParams) SetDateUpdated(DateUpdated time.Time) (*CreateMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) (*CreateMessageParams){ + params.LastUpdatedBy = &LastUpdatedBy + return params +} +func (params *CreateMessageParams) SetBody(Body string) (*CreateMessageParams){ + params.Body = &Body + return params +} +func (params *CreateMessageParams) SetMediaSid(MediaSid string) (*CreateMessageParams){ + params.MediaSid = &MediaSid + return params +} + +// func (c *ApiService) CreateMessage(ServiceSid string, ChannelSid string, params *CreateMessageParams) (*ChatV2Message, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.LastUpdatedBy != nil { + data.Set("LastUpdatedBy", *params.LastUpdatedBy) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.MediaSid != nil { + data.Set("MediaSid", *params.MediaSid) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.LastUpdatedBy != nil { - data.Set("LastUpdatedBy", *params.LastUpdatedBy) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.MediaSid != nil { - data.Set("MediaSid", *params.MediaSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteMessage' type DeleteMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -// -func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string, params *DeleteMessageParams) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string, params *DeleteMessageParams) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } -// -func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string) (*ChatV2Message, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV2Message, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ChatV2Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMessage' type ListMessageParams struct { - // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessageParams) SetOrder(Order string) *ListMessageParams { - params.Order = &Order - return params +func (params *ListMessageParams) SetOrder(Order string) (*ListMessageParams){ + params.Order = &Order + return params } -func (params *ListMessageParams) SetPageSize(PageSize int) *ListMessageParams { - params.PageSize = &PageSize - return params +func (params *ListMessageParams) SetPageSize(PageSize int) (*ListMessageParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessageParams) SetLimit(Limit int) *ListMessageParams { - params.Limit = &Limit - return params +func (params *ListMessageParams) SetLimit(Limit int) (*ListMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Message records from the API. Request is executed immediately. func (c *ApiService) PageMessage(ServiceSid string, ChannelSid string, params *ListMessageParams, pageToken, pageNumber string) (*ListMessageResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Message records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -287,6 +289,7 @@ func (c *ApiService) StreamMessage(ServiceSid string, ChannelSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMessageParams, recordChannel chan ChatV2Message, errorChannel chan error) { curRecord := 1 @@ -318,114 +321,115 @@ func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMe } func (c *ApiService) getNextListMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMessage' type UpdateMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. - Body *string `json:"Body,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. - LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` - // The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. - From *string `json:"From,omitempty"` -} - -func (params *UpdateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateMessageParams) SetBody(Body string) *UpdateMessageParams { - params.Body = &Body - return params -} -func (params *UpdateMessageParams) SetAttributes(Attributes string) *UpdateMessageParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateMessageParams) SetDateCreated(DateCreated time.Time) *UpdateMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateMessageParams) SetDateUpdated(DateUpdated time.Time) *UpdateMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) *UpdateMessageParams { - params.LastUpdatedBy = &LastUpdatedBy - return params -} -func (params *UpdateMessageParams) SetFrom(From string) *UpdateMessageParams { - params.From = &From - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. + Body *string `json:"Body,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. + LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` + // The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. + From *string `json:"From,omitempty"` +} + +func (params *UpdateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateMessageParams) SetBody(Body string) (*UpdateMessageParams){ + params.Body = &Body + return params +} +func (params *UpdateMessageParams) SetAttributes(Attributes string) (*UpdateMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateMessageParams) SetDateCreated(DateCreated time.Time) (*UpdateMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateMessageParams) SetDateUpdated(DateUpdated time.Time) (*UpdateMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) (*UpdateMessageParams){ + params.LastUpdatedBy = &LastUpdatedBy + return params +} +func (params *UpdateMessageParams) SetFrom(From string) (*UpdateMessageParams){ + params.From = &From + return params +} + +// func (c *ApiService) UpdateMessage(ServiceSid string, ChannelSid string, Sid string, params *UpdateMessageParams) (*ChatV2Message, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.LastUpdatedBy != nil { + data.Set("LastUpdatedBy", *params.LastUpdatedBy) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.LastUpdatedBy != nil { - data.Set("LastUpdatedBy", *params.LastUpdatedBy) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v2/services_channels_webhooks.go b/rest/chat/v2/services_channels_webhooks.go index 6db76bd24..e7c322180 100644 --- a/rest/chat/v2/services_channels_webhooks.go +++ b/rest/chat/v2/services_channels_webhooks.go @@ -18,204 +18,209 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannelWebhook' type CreateChannelWebhookParams struct { - // - Type *string `json:"Type,omitempty"` - // The URL of the webhook to call using the `configuration.method`. - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` is `studio`. - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` - // The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. - ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` + // + Type *string `json:"Type,omitempty"` + // The URL of the webhook to call using the `configuration.method`. + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` is `studio`. + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. + ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` } -func (params *CreateChannelWebhookParams) SetType(Type string) *CreateChannelWebhookParams { - params.Type = &Type - return params +func (params *CreateChannelWebhookParams) SetType(Type string) (*CreateChannelWebhookParams){ + params.Type = &Type + return params } -func (params *CreateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *CreateChannelWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *CreateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*CreateChannelWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *CreateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *CreateChannelWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *CreateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*CreateChannelWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *CreateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *CreateChannelWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *CreateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*CreateChannelWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *CreateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *CreateChannelWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *CreateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*CreateChannelWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *CreateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *CreateChannelWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *CreateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*CreateChannelWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } -func (params *CreateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) *CreateChannelWebhookParams { - params.ConfigurationRetryCount = &ConfigurationRetryCount - return params +func (params *CreateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) (*CreateChannelWebhookParams){ + params.ConfigurationRetryCount = &ConfigurationRetryCount + return params } -// +// func (c *ApiService) CreateChannelWebhook(ServiceSid string, ChannelSid string, params *CreateChannelWebhookParams) (*ChatV2ChannelWebhook, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + if params != nil && params.ConfigurationRetryCount != nil { + data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2ChannelWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteChannelWebhook(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - if params != nil && params.ConfigurationRetryCount != nil { - data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2ChannelWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return ps, err -} + defer resp.Body.Close() -// -func (c *ApiService) DeleteChannelWebhook(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchChannelWebhook(ServiceSid string, ChannelSid string, Sid string, ) (*ChatV2ChannelWebhook, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchChannelWebhook(ServiceSid string, ChannelSid string, Sid string) (*ChatV2ChannelWebhook, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV2ChannelWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2ChannelWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListChannelWebhook' type ListChannelWebhookParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelWebhookParams) SetPageSize(PageSize int) *ListChannelWebhookParams { - params.PageSize = &PageSize - return params +func (params *ListChannelWebhookParams) SetPageSize(PageSize int) (*ListChannelWebhookParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelWebhookParams) SetLimit(Limit int) *ListChannelWebhookParams { - params.Limit = &Limit - return params +func (params *ListChannelWebhookParams) SetLimit(Limit int) (*ListChannelWebhookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ChannelWebhook records from the API. Request is executed immediately. func (c *ApiService) PageChannelWebhook(ServiceSid string, ChannelSid string, params *ListChannelWebhookParams, pageToken, pageNumber string) (*ListChannelWebhookResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListChannelWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ChannelWebhook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -256,6 +261,7 @@ func (c *ApiService) StreamChannelWebhook(ServiceSid string, ChannelSid string, return recordChannel, errorChannel } + func (c *ApiService) streamChannelWebhook(response *ListChannelWebhookResponse, params *ListChannelWebhookParams, recordChannel chan ChatV2ChannelWebhook, errorChannel chan error) { curRecord := 1 @@ -287,108 +293,110 @@ func (c *ApiService) streamChannelWebhook(response *ListChannelWebhookResponse, } func (c *ApiService) getNextListChannelWebhookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChannelWebhook' type UpdateChannelWebhookParams struct { - // The URL of the webhook to call using the `configuration.method`. - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` = `studio`. - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` - // The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. - ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` + // The URL of the webhook to call using the `configuration.method`. + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` = `studio`. + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. + ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` } -func (params *UpdateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *UpdateChannelWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *UpdateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*UpdateChannelWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *UpdateChannelWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *UpdateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*UpdateChannelWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *UpdateChannelWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *UpdateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*UpdateChannelWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *UpdateChannelWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *UpdateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*UpdateChannelWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *UpdateChannelWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *UpdateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*UpdateChannelWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) *UpdateChannelWebhookParams { - params.ConfigurationRetryCount = &ConfigurationRetryCount - return params +func (params *UpdateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) (*UpdateChannelWebhookParams){ + params.ConfigurationRetryCount = &ConfigurationRetryCount + return params } -// +// func (c *ApiService) UpdateChannelWebhook(ServiceSid string, ChannelSid string, Sid string, params *UpdateChannelWebhookParams) (*ChatV2ChannelWebhook, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - if params != nil && params.ConfigurationRetryCount != nil { - data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ChatV2ChannelWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + if params != nil && params.ConfigurationRetryCount != nil { + data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2ChannelWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/chat/v2/services_roles.go b/rest/chat/v2/services_roles.go index 36ea514eb..fea4de7b7 100644 --- a/rest/chat/v2/services_roles.go +++ b/rest/chat/v2/services_roles.go @@ -18,162 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRole' type CreateRoleParams struct { - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`. - Permission *[]string `json:"Permission,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`. + Permission *[]string `json:"Permission,omitempty"` } -func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) *CreateRoleParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) (*CreateRoleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRoleParams) SetType(Type string) *CreateRoleParams { - params.Type = &Type - return params +func (params *CreateRoleParams) SetType(Type string) (*CreateRoleParams){ + params.Type = &Type + return params } -func (params *CreateRoleParams) SetPermission(Permission []string) *CreateRoleParams { - params.Permission = &Permission - return params +func (params *CreateRoleParams) SetPermission(Permission []string) (*CreateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) CreateRole(ServiceSid string, params *CreateRoleParams) (*ChatV2Role, error) { - path := "/v2/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Roles" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteRole(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - ps := &ChatV2Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteRole(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchRole(ServiceSid string, Sid string, ) (*ChatV2Role, error) { + path := "/v2/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchRole(ServiceSid string, Sid string) (*ChatV2Role, error) { - path := "/v2/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV2Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRole' type ListRoleParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoleParams) SetPageSize(PageSize int) *ListRoleParams { - params.PageSize = &PageSize - return params +func (params *ListRoleParams) SetPageSize(PageSize int) (*ListRoleParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoleParams) SetLimit(Limit int) *ListRoleParams { - params.Limit = &Limit - return params +func (params *ListRoleParams) SetLimit(Limit int) (*ListRoleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Role records from the API. Request is executed immediately. func (c *ApiService) PageRole(ServiceSid string, params *ListRoleParams, pageToken, pageNumber string) (*ListRoleResponse, error) { - path := "/v2/Services/{ServiceSid}/Roles" + path := "/v2/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Role records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -214,6 +219,7 @@ func (c *ApiService) StreamRole(ServiceSid string, params *ListRoleParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRoleParams, recordChannel chan ChatV2Role, errorChannel chan error) { curRecord := 1 @@ -245,60 +251,62 @@ func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRolePara } func (c *ApiService) getNextListRoleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRole' type UpdateRoleParams struct { - // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`. - Permission *[]string `json:"Permission,omitempty"` + // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`. + Permission *[]string `json:"Permission,omitempty"` } -func (params *UpdateRoleParams) SetPermission(Permission []string) *UpdateRoleParams { - params.Permission = &Permission - return params +func (params *UpdateRoleParams) SetPermission(Permission []string) (*UpdateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) UpdateRole(ServiceSid string, Sid string, params *UpdateRoleParams) (*ChatV2Role, error) { - path := "/v2/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ChatV2Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ChatV2Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v2/services_users.go b/rest/chat/v2/services_users.go index a7e8298bf..4f7cf447b 100644 --- a/rest/chat/v2/services_users.go +++ b/rest/chat/v2/services_users.go @@ -18,179 +18,183 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUser' type CreateUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or email address. See the Identity documentation for more info. - Identity *string `json:"Identity,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the new User. - RoleSid *string `json:"RoleSid,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // A descriptive string that you create to describe the new resource. This value is often used for display purposes. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or email address. See the Identity documentation for more info. + Identity *string `json:"Identity,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the new User. + RoleSid *string `json:"RoleSid,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the new resource. This value is often used for display purposes. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *CreateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *CreateUserParams) SetIdentity(Identity string) *CreateUserParams { - params.Identity = &Identity - return params +func (params *CreateUserParams) SetIdentity(Identity string) (*CreateUserParams){ + params.Identity = &Identity + return params } -func (params *CreateUserParams) SetRoleSid(RoleSid string) *CreateUserParams { - params.RoleSid = &RoleSid - return params +func (params *CreateUserParams) SetRoleSid(RoleSid string) (*CreateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *CreateUserParams) SetAttributes(Attributes string) *CreateUserParams { - params.Attributes = &Attributes - return params +func (params *CreateUserParams) SetAttributes(Attributes string) (*CreateUserParams){ + params.Attributes = &Attributes + return params } -func (params *CreateUserParams) SetFriendlyName(FriendlyName string) *CreateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateUserParams) SetFriendlyName(FriendlyName string) (*CreateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateUser(ServiceSid string, params *CreateUserParams) (*ChatV2User, error) { - path := "/v2/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Users" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV2User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteUser(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteUser(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchUser(ServiceSid string, Sid string) (*ChatV2User, error) { - path := "/v2/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchUser(ServiceSid string, Sid string, ) (*ChatV2User, error) { + path := "/v2/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListUser' type ListUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserParams) SetPageSize(PageSize int) *ListUserParams { - params.PageSize = &PageSize - return params +func (params *ListUserParams) SetPageSize(PageSize int) (*ListUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserParams) SetLimit(Limit int) *ListUserParams { - params.Limit = &Limit - return params +func (params *ListUserParams) SetLimit(Limit int) (*ListUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of User records from the API. Request is executed immediately. func (c *ApiService) PageUser(ServiceSid string, params *ListUserParams, pageToken, pageNumber string) (*ListUserResponse, error) { - path := "/v2/Services/{ServiceSid}/Users" + path := "/v2/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists User records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -231,6 +235,7 @@ func (c *ApiService) StreamUser(ServiceSid string, params *ListUserParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserParams, recordChannel chan ChatV2User, errorChannel chan error) { curRecord := 1 @@ -262,86 +267,87 @@ func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserPara } func (c *ApiService) getNextListUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUser' type UpdateUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the User. - RoleSid *string `json:"RoleSid,omitempty"` - // A valid JSON string that contains application-specific data. - Attributes *string `json:"Attributes,omitempty"` - // A descriptive string that you create to describe the resource. It is often used for display purposes. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the User. + RoleSid *string `json:"RoleSid,omitempty"` + // A valid JSON string that contains application-specific data. + Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the resource. It is often used for display purposes. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *UpdateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *UpdateUserParams) SetRoleSid(RoleSid string) *UpdateUserParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateUserParams) SetRoleSid(RoleSid string) (*UpdateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *UpdateUserParams) SetAttributes(Attributes string) *UpdateUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateUserParams) SetAttributes(Attributes string) (*UpdateUserParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) *UpdateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) (*UpdateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateUser(ServiceSid string, Sid string, params *UpdateUserParams) (*ChatV2User, error) { - path := "/v2/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ChatV2User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV2User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/chat/v2/services_users_bindings.go b/rest/chat/v2/services_users_bindings.go index eec6334c4..e98f3ccbb 100644 --- a/rest/chat/v2/services_users_bindings.go +++ b/rest/chat/v2/services_users_bindings.go @@ -18,118 +18,122 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteUserBinding(ServiceSid string, UserSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteUserBinding(ServiceSid string, UserSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchUserBinding(ServiceSid string, UserSid string, Sid string) (*ChatV2UserBinding, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchUserBinding(ServiceSid string, UserSid string, Sid string, ) (*ChatV2UserBinding, error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2UserBinding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ChatV2UserBinding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUserBinding' type ListUserBindingParams struct { - // The push technology used by the User Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - BindingType *[]string `json:"BindingType,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The push technology used by the User Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + BindingType *[]string `json:"BindingType,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserBindingParams) SetBindingType(BindingType []string) *ListUserBindingParams { - params.BindingType = &BindingType - return params +func (params *ListUserBindingParams) SetBindingType(BindingType []string) (*ListUserBindingParams){ + params.BindingType = &BindingType + return params } -func (params *ListUserBindingParams) SetPageSize(PageSize int) *ListUserBindingParams { - params.PageSize = &PageSize - return params +func (params *ListUserBindingParams) SetPageSize(PageSize int) (*ListUserBindingParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserBindingParams) SetLimit(Limit int) *ListUserBindingParams { - params.Limit = &Limit - return params +func (params *ListUserBindingParams) SetLimit(Limit int) (*ListUserBindingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserBinding records from the API. Request is executed immediately. func (c *ApiService) PageUserBinding(ServiceSid string, UserSid string, params *ListUserBindingParams, pageToken, pageNumber string) (*ListUserBindingResponse, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BindingType != nil { - for _, item := range *params.BindingType { - data.Add("BindingType", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BindingType != nil { + for _, item := range *params.BindingType { + data.Add("BindingType", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UserBinding records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -170,6 +174,7 @@ func (c *ApiService) StreamUserBinding(ServiceSid string, UserSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamUserBinding(response *ListUserBindingResponse, params *ListUserBindingParams, recordChannel chan ChatV2UserBinding, errorChannel chan error) { curRecord := 1 @@ -201,19 +206,20 @@ func (c *ApiService) streamUserBinding(response *ListUserBindingResponse, params } func (c *ApiService) getNextListUserBindingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/chat/v2/services_users_channels.go b/rest/chat/v2/services_users_channels.go index 7cd5b90e6..7a189f549 100644 --- a/rest/chat/v2/services_users_channels.go +++ b/rest/chat/v2/services_users_channels.go @@ -18,123 +18,125 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'DeleteUserChannel' type DeleteUserChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteUserChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteUserChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteUserChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteUserChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Removes User from selected Channel. -func (c *ApiService) DeleteUserChannel(ServiceSid string, UserSid string, ChannelSid string, params *DeleteUserChannelParams) error { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) +func (c *ApiService) DeleteUserChannel(ServiceSid string, UserSid string, ChannelSid string, params *DeleteUserChannelParams) (error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchUserChannel(ServiceSid string, UserSid string, ChannelSid string) (*ChatV2UserChannel, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) +// +func (c *ApiService) FetchUserChannel(ServiceSid string, UserSid string, ChannelSid string, ) (*ChatV2UserChannel, error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ChatV2UserChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ChatV2UserChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUserChannel' type ListUserChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserChannelParams) SetPageSize(PageSize int) *ListUserChannelParams { - params.PageSize = &PageSize - return params +func (params *ListUserChannelParams) SetPageSize(PageSize int) (*ListUserChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserChannelParams) SetLimit(Limit int) *ListUserChannelParams { - params.Limit = &Limit - return params +func (params *ListUserChannelParams) SetLimit(Limit int) (*ListUserChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserChannel records from the API. Request is executed immediately. func (c *ApiService) PageUserChannel(ServiceSid string, UserSid string, params *ListUserChannelParams, pageToken, pageNumber string) (*ListUserChannelResponse, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels" + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UserChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -175,6 +177,7 @@ func (c *ApiService) StreamUserChannel(ServiceSid string, UserSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params *ListUserChannelParams, recordChannel chan ChatV2UserChannel, errorChannel chan error) { curRecord := 1 @@ -206,77 +209,79 @@ func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params } func (c *ApiService) getNextListUserChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUserChannel' type UpdateUserChannelParams struct { - // - NotificationLevel *string `json:"NotificationLevel,omitempty"` - // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). - LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` + // + NotificationLevel *string `json:"NotificationLevel,omitempty"` + // The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). + LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` } -func (params *UpdateUserChannelParams) SetNotificationLevel(NotificationLevel string) *UpdateUserChannelParams { - params.NotificationLevel = &NotificationLevel - return params +func (params *UpdateUserChannelParams) SetNotificationLevel(NotificationLevel string) (*UpdateUserChannelParams){ + params.NotificationLevel = &NotificationLevel + return params } -func (params *UpdateUserChannelParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *UpdateUserChannelParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params +func (params *UpdateUserChannelParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*UpdateUserChannelParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params } -func (params *UpdateUserChannelParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) *UpdateUserChannelParams { - params.LastConsumptionTimestamp = &LastConsumptionTimestamp - return params +func (params *UpdateUserChannelParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) (*UpdateUserChannelParams){ + params.LastConsumptionTimestamp = &LastConsumptionTimestamp + return params } -// +// func (c *ApiService) UpdateUserChannel(ServiceSid string, UserSid string, ChannelSid string, params *UpdateUserChannelParams) (*ChatV2UserChannel, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.NotificationLevel != nil { - data.Set("NotificationLevel", *params.NotificationLevel) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } - if params != nil && params.LastConsumptionTimestamp != nil { - data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ChatV2UserChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.NotificationLevel != nil { + data.Set("NotificationLevel", *params.NotificationLevel) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } + if params != nil && params.LastConsumptionTimestamp != nil { + data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ChatV2UserChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/chat/v3/README.md b/rest/chat/v3/README.md index 5c63ff2b5..e8dd1a60f 100644 --- a/rest/chat/v3/README.md +++ b/rest/chat/v3/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/chat/v3/api_service.go b/rest/chat/v3/api_service.go index 8ffb94b7a..64d34bc28 100644 --- a/rest/chat/v3/api_service.go +++ b/rest/chat/v3/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://chat.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/chat/v3/model_chat_v3_channel.go b/rest/chat/v3/model_chat_v3_channel.go index 70f9bb36e..0688277d3 100644 --- a/rest/chat/v3/model_chat_v3_channel.go +++ b/rest/chat/v3/model_chat_v3_channel.go @@ -13,38 +13,40 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ChatV3Channel struct for ChatV3Channel type ChatV3Channel struct { - // The unique string that we created to identify the Channel resource. + // The unique string that we created to identify the Channel resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - Type *string `json:"type,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Type *string `json:"type,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. + // The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` - // The number of Members in the Channel. + // The number of Members in the Channel. MembersCount *int `json:"members_count,omitempty"` - // The number of Messages that have been passed in the Channel. + // The number of Messages that have been passed in the Channel. MessagesCount *int `json:"messages_count,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this channel belongs to. + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this channel belongs to. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // The absolute URL of the Channel resource. + // The absolute URL of the Channel resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/chat/v3/services_channels.go b/rest/chat/v3/services_channels.go index 4a6e82462..4cd117215 100644 --- a/rest/chat/v3/services_channels.go +++ b/rest/chat/v3/services_channels.go @@ -16,64 +16,67 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'UpdateChannel' type UpdateChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - Type *string `json:"Type,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this channel belongs to. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + Type *string `json:"Type,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this channel belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` } -func (params *UpdateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *UpdateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *UpdateChannelParams) SetType(Type string) *UpdateChannelParams { - params.Type = &Type - return params +func (params *UpdateChannelParams) SetType(Type string) (*UpdateChannelParams){ + params.Type = &Type + return params } -func (params *UpdateChannelParams) SetMessagingServiceSid(MessagingServiceSid string) *UpdateChannelParams { - params.MessagingServiceSid = &MessagingServiceSid - return params +func (params *UpdateChannelParams) SetMessagingServiceSid(MessagingServiceSid string) (*UpdateChannelParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params } // Update a specific Channel. func (c *ApiService) UpdateChannel(ServiceSid string, Sid string, params *UpdateChannelParams) (*ChatV3Channel, error) { - path := "/v3/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v3/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ChatV3Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ChatV3Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/content/v1/README.md b/rest/content/v1/README.md index cfde7a861..3b7c94363 100644 --- a/rest/content/v1/README.md +++ b/rest/content/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/content/v1/api_service.go b/rest/content/v1/api_service.go index 31d00d7e4..00f1cda12 100644 --- a/rest/content/v1/api_service.go +++ b/rest/content/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://content.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/content/v1/content.go b/rest/content/v1/content.go index 316fe37bf..eb0724948 100644 --- a/rest/content/v1/content.go +++ b/rest/content/v1/content.go @@ -18,100 +18,105 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Deletes a Content resource -func (c *ApiService) DeleteContent(Sid string) error { - path := "/v1/Content/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteContent(Sid string, ) (error) { + path := "/v1/Content/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a Content resource by its unique Content Sid -func (c *ApiService) FetchContent(Sid string) (*ContentV1Content, error) { - path := "/v1/Content/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchContent(Sid string, ) (*ContentV1Content, error) { + path := "/v1/Content/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ContentV1Content{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ContentV1Content{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListContent' type ListContentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListContentParams) SetPageSize(PageSize int) *ListContentParams { - params.PageSize = &PageSize - return params +func (params *ListContentParams) SetPageSize(PageSize int) (*ListContentParams){ + params.PageSize = &PageSize + return params } -func (params *ListContentParams) SetLimit(Limit int) *ListContentParams { - params.Limit = &Limit - return params +func (params *ListContentParams) SetLimit(Limit int) (*ListContentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Content records from the API. Request is executed immediately. func (c *ApiService) PageContent(params *ListContentParams, pageToken, pageNumber string) (*ListContentResponse, error) { - path := "/v1/Content" + path := "/v1/Content" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListContentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListContentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Content records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -152,6 +157,7 @@ func (c *ApiService) StreamContent(params *ListContentParams) (chan ContentV1Con return recordChannel, errorChannel } + func (c *ApiService) streamContent(response *ListContentResponse, params *ListContentParams, recordChannel chan ContentV1Content, errorChannel chan error) { curRecord := 1 @@ -183,19 +189,20 @@ func (c *ApiService) streamContent(response *ListContentResponse, params *ListCo } func (c *ApiService) getNextListContentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListContentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListContentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/content/v1/content_and_approvals.go b/rest/content/v1/content_and_approvals.go index 2c8ea60b8..d17204cfc 100644 --- a/rest/content/v1/content_and_approvals.go +++ b/rest/content/v1/content_and_approvals.go @@ -19,57 +19,59 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListContentAndApprovals' type ListContentAndApprovalsParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListContentAndApprovalsParams) SetPageSize(PageSize int) *ListContentAndApprovalsParams { - params.PageSize = &PageSize - return params +func (params *ListContentAndApprovalsParams) SetPageSize(PageSize int) (*ListContentAndApprovalsParams){ + params.PageSize = &PageSize + return params } -func (params *ListContentAndApprovalsParams) SetLimit(Limit int) *ListContentAndApprovalsParams { - params.Limit = &Limit - return params +func (params *ListContentAndApprovalsParams) SetLimit(Limit int) (*ListContentAndApprovalsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ContentAndApprovals records from the API. Request is executed immediately. func (c *ApiService) PageContentAndApprovals(params *ListContentAndApprovalsParams, pageToken, pageNumber string) (*ListContentAndApprovalsResponse, error) { - path := "/v1/ContentAndApprovals" + path := "/v1/ContentAndApprovals" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListContentAndApprovalsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListContentAndApprovalsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ContentAndApprovals records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -110,6 +112,7 @@ func (c *ApiService) StreamContentAndApprovals(params *ListContentAndApprovalsPa return recordChannel, errorChannel } + func (c *ApiService) streamContentAndApprovals(response *ListContentAndApprovalsResponse, params *ListContentAndApprovalsParams, recordChannel chan ContentV1ContentAndApprovals, errorChannel chan error) { curRecord := 1 @@ -141,19 +144,20 @@ func (c *ApiService) streamContentAndApprovals(response *ListContentAndApprovals } func (c *ApiService) getNextListContentAndApprovalsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListContentAndApprovalsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListContentAndApprovalsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/content/v1/content_approval_requests.go b/rest/content/v1/content_approval_requests.go index 8810e823c..15c468753 100644 --- a/rest/content/v1/content_approval_requests.go +++ b/rest/content/v1/content_approval_requests.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch a Content resource's approval status by its unique Content Sid -func (c *ApiService) FetchApprovalFetch(Sid string) (*ContentV1ApprovalFetch, error) { - path := "/v1/Content/{Sid}/ApprovalRequests" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchApprovalFetch(Sid string, ) (*ContentV1ApprovalFetch, error) { + path := "/v1/Content/{Sid}/ApprovalRequests" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ContentV1ApprovalFetch{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ContentV1ApprovalFetch{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/content/v1/docs/ListContentResponseMeta.md b/rest/content/v1/docs/ListContentResponseMeta.md index 849b6c232..256f9aee7 100644 --- a/rest/content/v1/docs/ListContentResponseMeta.md +++ b/rest/content/v1/docs/ListContentResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/content/v1/legacy_content.go b/rest/content/v1/legacy_content.go index 3215b7e40..3eb6b3027 100644 --- a/rest/content/v1/legacy_content.go +++ b/rest/content/v1/legacy_content.go @@ -19,57 +19,59 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListLegacyContent' type ListLegacyContentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListLegacyContentParams) SetPageSize(PageSize int) *ListLegacyContentParams { - params.PageSize = &PageSize - return params +func (params *ListLegacyContentParams) SetPageSize(PageSize int) (*ListLegacyContentParams){ + params.PageSize = &PageSize + return params } -func (params *ListLegacyContentParams) SetLimit(Limit int) *ListLegacyContentParams { - params.Limit = &Limit - return params +func (params *ListLegacyContentParams) SetLimit(Limit int) (*ListLegacyContentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of LegacyContent records from the API. Request is executed immediately. func (c *ApiService) PageLegacyContent(params *ListLegacyContentParams, pageToken, pageNumber string) (*ListLegacyContentResponse, error) { - path := "/v1/LegacyContent" + path := "/v1/LegacyContent" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListLegacyContentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListLegacyContentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists LegacyContent records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -110,6 +112,7 @@ func (c *ApiService) StreamLegacyContent(params *ListLegacyContentParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamLegacyContent(response *ListLegacyContentResponse, params *ListLegacyContentParams, recordChannel chan ContentV1LegacyContent, errorChannel chan error) { curRecord := 1 @@ -141,19 +144,20 @@ func (c *ApiService) streamLegacyContent(response *ListLegacyContentResponse, pa } func (c *ApiService) getNextListLegacyContentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListLegacyContentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListLegacyContentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/content/v1/model_content_v1_approval_fetch.go b/rest/content/v1/model_content_v1_approval_fetch.go index d72778e72..958bf5a33 100644 --- a/rest/content/v1/model_content_v1_approval_fetch.go +++ b/rest/content/v1/model_content_v1_approval_fetch.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ContentV1ApprovalFetch struct for ContentV1ApprovalFetch type ContentV1ApprovalFetch struct { - // The unique string that that we created to identify the Content resource. + // The unique string that that we created to identify the Content resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. AccountSid *string `json:"account_sid,omitempty"` - // Contains the whatsapp approval information for the Content resource, with fields such as approval status, rejection reason, and category, amongst others. + // Contains the whatsapp approval information for the Content resource, with fields such as approval status, rejection reason, and category, amongst others. Whatsapp *interface{} `json:"whatsapp,omitempty"` - // The URL of the resource, relative to `https://content.twilio.com`. + // The URL of the resource, relative to `https://content.twilio.com`. Url *string `json:"url,omitempty"` } + + diff --git a/rest/content/v1/model_content_v1_content.go b/rest/content/v1/model_content_v1_content.go index 08fcc257d..3a515c3f7 100644 --- a/rest/content/v1/model_content_v1_content.go +++ b/rest/content/v1/model_content_v1_content.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ContentV1Content struct for ContentV1Content type ContentV1Content struct { - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that that we created to identify the Content resource. + // The unique string that that we created to identify the Content resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. AccountSid *string `json:"account_sid,omitempty"` - // A string name used to describe the Content resource. Not visible to the end recipient. + // A string name used to describe the Content resource. Not visible to the end recipient. FriendlyName *string `json:"friendly_name,omitempty"` - // Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + // Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. Language *string `json:"language,omitempty"` - // Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + // Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. Variables *interface{} `json:"variables,omitempty"` - // The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + // The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. Types *interface{} `json:"types,omitempty"` - // The URL of the resource, relative to `https://content.twilio.com`. + // The URL of the resource, relative to `https://content.twilio.com`. Url *string `json:"url,omitempty"` - // A list of links related to the Content resource, such as approval_fetch and approval_create + // A list of links related to the Content resource, such as approval_fetch and approval_create Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/content/v1/model_content_v1_content_and_approvals.go b/rest/content/v1/model_content_v1_content_and_approvals.go index 8844a4465..ddb2c9169 100644 --- a/rest/content/v1/model_content_v1_content_and_approvals.go +++ b/rest/content/v1/model_content_v1_content_and_approvals.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ContentV1ContentAndApprovals struct for ContentV1ContentAndApprovals type ContentV1ContentAndApprovals struct { - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that that we created to identify the Content resource. + // The unique string that that we created to identify the Content resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. AccountSid *string `json:"account_sid,omitempty"` - // A string name used to describe the Content resource. Not visible to the end recipient. + // A string name used to describe the Content resource. Not visible to the end recipient. FriendlyName *string `json:"friendly_name,omitempty"` - // Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + // Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. Language *string `json:"language,omitempty"` - // Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + // Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. Variables *interface{} `json:"variables,omitempty"` - // The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + // The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. Types *interface{} `json:"types,omitempty"` - // The submitted information and approval request status of the Content resource. + // The submitted information and approval request status of the Content resource. ApprovalRequests *interface{} `json:"approval_requests,omitempty"` } + + diff --git a/rest/content/v1/model_content_v1_legacy_content.go b/rest/content/v1/model_content_v1_legacy_content.go index aa0b6afc5..a09e75e21 100644 --- a/rest/content/v1/model_content_v1_legacy_content.go +++ b/rest/content/v1/model_content_v1_legacy_content.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ContentV1LegacyContent struct for ContentV1LegacyContent type ContentV1LegacyContent struct { - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that that we created to identify the Content resource. + // The unique string that that we created to identify the Content resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + // The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. AccountSid *string `json:"account_sid,omitempty"` - // A string name used to describe the Content resource. Not visible to the end recipient. + // A string name used to describe the Content resource. Not visible to the end recipient. FriendlyName *string `json:"friendly_name,omitempty"` - // Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + // Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. Language *string `json:"language,omitempty"` - // Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + // Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. Variables *interface{} `json:"variables,omitempty"` - // The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + // The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. Types *interface{} `json:"types,omitempty"` - // The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed + // The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed LegacyTemplateName *string `json:"legacy_template_name,omitempty"` - // The string body field of the legacy content template associated with this Content resource + // The string body field of the legacy content template associated with this Content resource LegacyBody *string `json:"legacy_body,omitempty"` - // The URL of the resource, relative to `https://content.twilio.com`. + // The URL of the resource, relative to `https://content.twilio.com`. Url *string `json:"url,omitempty"` } + + diff --git a/rest/content/v1/model_list_content_and_approvals_response.go b/rest/content/v1/model_list_content_and_approvals_response.go index 1d7f1a389..ca798f1f8 100644 --- a/rest/content/v1/model_list_content_and_approvals_response.go +++ b/rest/content/v1/model_list_content_and_approvals_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListContentAndApprovalsResponse struct for ListContentAndApprovalsResponse type ListContentAndApprovalsResponse struct { Contents []ContentV1ContentAndApprovals `json:"contents,omitempty"` - Meta ListContentResponseMeta `json:"meta,omitempty"` + Meta ListContentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/content/v1/model_list_content_response.go b/rest/content/v1/model_list_content_response.go index 3c80153dc..1541b0a7d 100644 --- a/rest/content/v1/model_list_content_response.go +++ b/rest/content/v1/model_list_content_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListContentResponse struct for ListContentResponse type ListContentResponse struct { - Contents []ContentV1Content `json:"contents,omitempty"` - Meta ListContentResponseMeta `json:"meta,omitempty"` + Contents []ContentV1Content `json:"contents,omitempty"` + Meta ListContentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/content/v1/model_list_content_response_meta.go b/rest/content/v1/model_list_content_response_meta.go index 572cc8343..2064a50b1 100644 --- a/rest/content/v1/model_list_content_response_meta.go +++ b/rest/content/v1/model_list_content_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListContentResponseMeta struct for ListContentResponseMeta type ListContentResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/content/v1/model_list_legacy_content_response.go b/rest/content/v1/model_list_legacy_content_response.go index 6b933aab0..d28d8804b 100644 --- a/rest/content/v1/model_list_legacy_content_response.go +++ b/rest/content/v1/model_list_legacy_content_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListLegacyContentResponse struct for ListLegacyContentResponse type ListLegacyContentResponse struct { Contents []ContentV1LegacyContent `json:"contents,omitempty"` - Meta ListContentResponseMeta `json:"meta,omitempty"` + Meta ListContentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/README.md b/rest/conversations/v1/README.md index 1aee1f5cb..a2da1b920 100644 --- a/rest/conversations/v1/README.md +++ b/rest/conversations/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/conversations/v1/api_service.go b/rest/conversations/v1/api_service.go index abd32d7da..a23e10c2e 100644 --- a/rest/conversations/v1/api_service.go +++ b/rest/conversations/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://conversations.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/conversations/v1/configuration.go b/rest/conversations/v1/configuration.go index 04e02a8ac..6c5197e7e 100644 --- a/rest/conversations/v1/configuration.go +++ b/rest/conversations/v1/configuration.go @@ -16,91 +16,98 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Fetch the global configuration of conversations on your account func (c *ApiService) FetchConfiguration() (*ConversationsV1Configuration, error) { - path := "/v1/Configuration" + path := "/v1/Configuration" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1Configuration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1Configuration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateConfiguration' type UpdateConfigurationParams struct { - // The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) to use when creating a conversation. - DefaultChatServiceSid *string `json:"DefaultChatServiceSid,omitempty"` - // The SID of the default [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to use when creating a conversation. - DefaultMessagingServiceSid *string `json:"DefaultMessagingServiceSid,omitempty"` - // Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. - DefaultInactiveTimer *string `json:"DefaultInactiveTimer,omitempty"` - // Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. - DefaultClosedTimer *string `json:"DefaultClosedTimer,omitempty"` + // The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) to use when creating a conversation. + DefaultChatServiceSid *string `json:"DefaultChatServiceSid,omitempty"` + // The SID of the default [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to use when creating a conversation. + DefaultMessagingServiceSid *string `json:"DefaultMessagingServiceSid,omitempty"` + // Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + DefaultInactiveTimer *string `json:"DefaultInactiveTimer,omitempty"` + // Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + DefaultClosedTimer *string `json:"DefaultClosedTimer,omitempty"` } -func (params *UpdateConfigurationParams) SetDefaultChatServiceSid(DefaultChatServiceSid string) *UpdateConfigurationParams { - params.DefaultChatServiceSid = &DefaultChatServiceSid - return params +func (params *UpdateConfigurationParams) SetDefaultChatServiceSid(DefaultChatServiceSid string) (*UpdateConfigurationParams){ + params.DefaultChatServiceSid = &DefaultChatServiceSid + return params } -func (params *UpdateConfigurationParams) SetDefaultMessagingServiceSid(DefaultMessagingServiceSid string) *UpdateConfigurationParams { - params.DefaultMessagingServiceSid = &DefaultMessagingServiceSid - return params +func (params *UpdateConfigurationParams) SetDefaultMessagingServiceSid(DefaultMessagingServiceSid string) (*UpdateConfigurationParams){ + params.DefaultMessagingServiceSid = &DefaultMessagingServiceSid + return params } -func (params *UpdateConfigurationParams) SetDefaultInactiveTimer(DefaultInactiveTimer string) *UpdateConfigurationParams { - params.DefaultInactiveTimer = &DefaultInactiveTimer - return params +func (params *UpdateConfigurationParams) SetDefaultInactiveTimer(DefaultInactiveTimer string) (*UpdateConfigurationParams){ + params.DefaultInactiveTimer = &DefaultInactiveTimer + return params } -func (params *UpdateConfigurationParams) SetDefaultClosedTimer(DefaultClosedTimer string) *UpdateConfigurationParams { - params.DefaultClosedTimer = &DefaultClosedTimer - return params +func (params *UpdateConfigurationParams) SetDefaultClosedTimer(DefaultClosedTimer string) (*UpdateConfigurationParams){ + params.DefaultClosedTimer = &DefaultClosedTimer + return params } // Update the global configuration of conversations on your account func (c *ApiService) UpdateConfiguration(params *UpdateConfigurationParams) (*ConversationsV1Configuration, error) { - path := "/v1/Configuration" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DefaultChatServiceSid != nil { - data.Set("DefaultChatServiceSid", *params.DefaultChatServiceSid) - } - if params != nil && params.DefaultMessagingServiceSid != nil { - data.Set("DefaultMessagingServiceSid", *params.DefaultMessagingServiceSid) - } - if params != nil && params.DefaultInactiveTimer != nil { - data.Set("DefaultInactiveTimer", *params.DefaultInactiveTimer) - } - if params != nil && params.DefaultClosedTimer != nil { - data.Set("DefaultClosedTimer", *params.DefaultClosedTimer) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1Configuration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Configuration" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DefaultChatServiceSid != nil { + data.Set("DefaultChatServiceSid", *params.DefaultChatServiceSid) + } + if params != nil && params.DefaultMessagingServiceSid != nil { + data.Set("DefaultMessagingServiceSid", *params.DefaultMessagingServiceSid) + } + if params != nil && params.DefaultInactiveTimer != nil { + data.Set("DefaultInactiveTimer", *params.DefaultInactiveTimer) + } + if params != nil && params.DefaultClosedTimer != nil { + data.Set("DefaultClosedTimer", *params.DefaultClosedTimer) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1Configuration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/configuration_addresses.go b/rest/conversations/v1/configuration_addresses.go index 79628a76e..2ada8bb01 100644 --- a/rest/conversations/v1/configuration_addresses.go +++ b/rest/conversations/v1/configuration_addresses.go @@ -18,247 +18,253 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConfigurationAddress' type CreateConfigurationAddressParams struct { - // - Type *string `json:"Type,omitempty"` - // The unique address to be configured. The address can be a whatsapp address or phone number - Address *string `json:"Address,omitempty"` - // The human-readable name of this configuration, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Enable/Disable auto-creating conversations for messages to this address - AutoCreationEnabled *bool `json:"AutoCreation.Enabled,omitempty"` - // - AutoCreationType *string `json:"AutoCreation.Type,omitempty"` - // Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service. - AutoCreationConversationServiceSid *string `json:"AutoCreation.ConversationServiceSid,omitempty"` - // For type `webhook`, the url for the webhook request. - AutoCreationWebhookUrl *string `json:"AutoCreation.WebhookUrl,omitempty"` - // - AutoCreationWebhookMethod *string `json:"AutoCreation.WebhookMethod,omitempty"` - // The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated` - AutoCreationWebhookFilters *[]string `json:"AutoCreation.WebhookFilters,omitempty"` - // For type `studio`, the studio flow SID where the webhook should be sent to. - AutoCreationStudioFlowSid *string `json:"AutoCreation.StudioFlowSid,omitempty"` - // For type `studio`, number of times to retry the webhook request - AutoCreationStudioRetryCount *int `json:"AutoCreation.StudioRetryCount,omitempty"` - // An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses. - AddressCountry *string `json:"AddressCountry,omitempty"` -} - -func (params *CreateConfigurationAddressParams) SetType(Type string) *CreateConfigurationAddressParams { - params.Type = &Type - return params -} -func (params *CreateConfigurationAddressParams) SetAddress(Address string) *CreateConfigurationAddressParams { - params.Address = &Address - return params -} -func (params *CreateConfigurationAddressParams) SetFriendlyName(FriendlyName string) *CreateConfigurationAddressParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationEnabled(AutoCreationEnabled bool) *CreateConfigurationAddressParams { - params.AutoCreationEnabled = &AutoCreationEnabled - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationType(AutoCreationType string) *CreateConfigurationAddressParams { - params.AutoCreationType = &AutoCreationType - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationConversationServiceSid(AutoCreationConversationServiceSid string) *CreateConfigurationAddressParams { - params.AutoCreationConversationServiceSid = &AutoCreationConversationServiceSid - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationWebhookUrl(AutoCreationWebhookUrl string) *CreateConfigurationAddressParams { - params.AutoCreationWebhookUrl = &AutoCreationWebhookUrl - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationWebhookMethod(AutoCreationWebhookMethod string) *CreateConfigurationAddressParams { - params.AutoCreationWebhookMethod = &AutoCreationWebhookMethod - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationWebhookFilters(AutoCreationWebhookFilters []string) *CreateConfigurationAddressParams { - params.AutoCreationWebhookFilters = &AutoCreationWebhookFilters - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationStudioFlowSid(AutoCreationStudioFlowSid string) *CreateConfigurationAddressParams { - params.AutoCreationStudioFlowSid = &AutoCreationStudioFlowSid - return params -} -func (params *CreateConfigurationAddressParams) SetAutoCreationStudioRetryCount(AutoCreationStudioRetryCount int) *CreateConfigurationAddressParams { - params.AutoCreationStudioRetryCount = &AutoCreationStudioRetryCount - return params -} -func (params *CreateConfigurationAddressParams) SetAddressCountry(AddressCountry string) *CreateConfigurationAddressParams { - params.AddressCountry = &AddressCountry - return params + // + Type *string `json:"Type,omitempty"` + // The unique address to be configured. The address can be a whatsapp address or phone number + Address *string `json:"Address,omitempty"` + // The human-readable name of this configuration, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Enable/Disable auto-creating conversations for messages to this address + AutoCreationEnabled *bool `json:"AutoCreation.Enabled,omitempty"` + // + AutoCreationType *string `json:"AutoCreation.Type,omitempty"` + // Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service. + AutoCreationConversationServiceSid *string `json:"AutoCreation.ConversationServiceSid,omitempty"` + // For type `webhook`, the url for the webhook request. + AutoCreationWebhookUrl *string `json:"AutoCreation.WebhookUrl,omitempty"` + // + AutoCreationWebhookMethod *string `json:"AutoCreation.WebhookMethod,omitempty"` + // The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated` + AutoCreationWebhookFilters *[]string `json:"AutoCreation.WebhookFilters,omitempty"` + // For type `studio`, the studio flow SID where the webhook should be sent to. + AutoCreationStudioFlowSid *string `json:"AutoCreation.StudioFlowSid,omitempty"` + // For type `studio`, number of times to retry the webhook request + AutoCreationStudioRetryCount *int `json:"AutoCreation.StudioRetryCount,omitempty"` + // An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses. + AddressCountry *string `json:"AddressCountry,omitempty"` +} + +func (params *CreateConfigurationAddressParams) SetType(Type string) (*CreateConfigurationAddressParams){ + params.Type = &Type + return params +} +func (params *CreateConfigurationAddressParams) SetAddress(Address string) (*CreateConfigurationAddressParams){ + params.Address = &Address + return params +} +func (params *CreateConfigurationAddressParams) SetFriendlyName(FriendlyName string) (*CreateConfigurationAddressParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationEnabled(AutoCreationEnabled bool) (*CreateConfigurationAddressParams){ + params.AutoCreationEnabled = &AutoCreationEnabled + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationType(AutoCreationType string) (*CreateConfigurationAddressParams){ + params.AutoCreationType = &AutoCreationType + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationConversationServiceSid(AutoCreationConversationServiceSid string) (*CreateConfigurationAddressParams){ + params.AutoCreationConversationServiceSid = &AutoCreationConversationServiceSid + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationWebhookUrl(AutoCreationWebhookUrl string) (*CreateConfigurationAddressParams){ + params.AutoCreationWebhookUrl = &AutoCreationWebhookUrl + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationWebhookMethod(AutoCreationWebhookMethod string) (*CreateConfigurationAddressParams){ + params.AutoCreationWebhookMethod = &AutoCreationWebhookMethod + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationWebhookFilters(AutoCreationWebhookFilters []string) (*CreateConfigurationAddressParams){ + params.AutoCreationWebhookFilters = &AutoCreationWebhookFilters + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationStudioFlowSid(AutoCreationStudioFlowSid string) (*CreateConfigurationAddressParams){ + params.AutoCreationStudioFlowSid = &AutoCreationStudioFlowSid + return params +} +func (params *CreateConfigurationAddressParams) SetAutoCreationStudioRetryCount(AutoCreationStudioRetryCount int) (*CreateConfigurationAddressParams){ + params.AutoCreationStudioRetryCount = &AutoCreationStudioRetryCount + return params +} +func (params *CreateConfigurationAddressParams) SetAddressCountry(AddressCountry string) (*CreateConfigurationAddressParams){ + params.AddressCountry = &AddressCountry + return params } // Create a new address configuration func (c *ApiService) CreateConfigurationAddress(params *CreateConfigurationAddressParams) (*ConversationsV1ConfigurationAddress, error) { - path := "/v1/Configuration/Addresses" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Address != nil { - data.Set("Address", *params.Address) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AutoCreationEnabled != nil { - data.Set("AutoCreation.Enabled", fmt.Sprint(*params.AutoCreationEnabled)) - } - if params != nil && params.AutoCreationType != nil { - data.Set("AutoCreation.Type", *params.AutoCreationType) - } - if params != nil && params.AutoCreationConversationServiceSid != nil { - data.Set("AutoCreation.ConversationServiceSid", *params.AutoCreationConversationServiceSid) - } - if params != nil && params.AutoCreationWebhookUrl != nil { - data.Set("AutoCreation.WebhookUrl", *params.AutoCreationWebhookUrl) - } - if params != nil && params.AutoCreationWebhookMethod != nil { - data.Set("AutoCreation.WebhookMethod", *params.AutoCreationWebhookMethod) - } - if params != nil && params.AutoCreationWebhookFilters != nil { - for _, item := range *params.AutoCreationWebhookFilters { - data.Add("AutoCreation.WebhookFilters", item) - } - } - if params != nil && params.AutoCreationStudioFlowSid != nil { - data.Set("AutoCreation.StudioFlowSid", *params.AutoCreationStudioFlowSid) - } - if params != nil && params.AutoCreationStudioRetryCount != nil { - data.Set("AutoCreation.StudioRetryCount", fmt.Sprint(*params.AutoCreationStudioRetryCount)) - } - if params != nil && params.AddressCountry != nil { - data.Set("AddressCountry", *params.AddressCountry) - } + path := "/v1/Configuration/Addresses" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Address != nil { + data.Set("Address", *params.Address) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AutoCreationEnabled != nil { + data.Set("AutoCreation.Enabled", fmt.Sprint(*params.AutoCreationEnabled)) + } + if params != nil && params.AutoCreationType != nil { + data.Set("AutoCreation.Type", *params.AutoCreationType) + } + if params != nil && params.AutoCreationConversationServiceSid != nil { + data.Set("AutoCreation.ConversationServiceSid", *params.AutoCreationConversationServiceSid) + } + if params != nil && params.AutoCreationWebhookUrl != nil { + data.Set("AutoCreation.WebhookUrl", *params.AutoCreationWebhookUrl) + } + if params != nil && params.AutoCreationWebhookMethod != nil { + data.Set("AutoCreation.WebhookMethod", *params.AutoCreationWebhookMethod) + } + if params != nil && params.AutoCreationWebhookFilters != nil { + for _, item := range *params.AutoCreationWebhookFilters { + data.Add("AutoCreation.WebhookFilters", item) + } + } + if params != nil && params.AutoCreationStudioFlowSid != nil { + data.Set("AutoCreation.StudioFlowSid", *params.AutoCreationStudioFlowSid) + } + if params != nil && params.AutoCreationStudioRetryCount != nil { + data.Set("AutoCreation.StudioRetryCount", fmt.Sprint(*params.AutoCreationStudioRetryCount)) + } + if params != nil && params.AddressCountry != nil { + data.Set("AddressCountry", *params.AddressCountry) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ConfigurationAddress{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// Remove an existing address configuration +func (c *ApiService) DeleteConfigurationAddress(Sid string, ) (error) { + path := "/v1/Configuration/Addresses/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &ConversationsV1ConfigurationAddress{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// Remove an existing address configuration -func (c *ApiService) DeleteConfigurationAddress(Sid string) error { - path := "/v1/Configuration/Addresses/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// Fetch an address configuration +func (c *ApiService) FetchConfigurationAddress(Sid string, ) (*ConversationsV1ConfigurationAddress, error) { + path := "/v1/Configuration/Addresses/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// Fetch an address configuration -func (c *ApiService) FetchConfigurationAddress(Sid string) (*ConversationsV1ConfigurationAddress, error) { - path := "/v1/Configuration/Addresses/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ConfigurationAddress{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ConfigurationAddress{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListConfigurationAddress' type ListConfigurationAddressParams struct { - // Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`. - Type *string `json:"Type,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`. + Type *string `json:"Type,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConfigurationAddressParams) SetType(Type string) *ListConfigurationAddressParams { - params.Type = &Type - return params +func (params *ListConfigurationAddressParams) SetType(Type string) (*ListConfigurationAddressParams){ + params.Type = &Type + return params } -func (params *ListConfigurationAddressParams) SetPageSize(PageSize int) *ListConfigurationAddressParams { - params.PageSize = &PageSize - return params +func (params *ListConfigurationAddressParams) SetPageSize(PageSize int) (*ListConfigurationAddressParams){ + params.PageSize = &PageSize + return params } -func (params *ListConfigurationAddressParams) SetLimit(Limit int) *ListConfigurationAddressParams { - params.Limit = &Limit - return params +func (params *ListConfigurationAddressParams) SetLimit(Limit int) (*ListConfigurationAddressParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConfigurationAddress records from the API. Request is executed immediately. func (c *ApiService) PageConfigurationAddress(params *ListConfigurationAddressParams, pageToken, pageNumber string) (*ListConfigurationAddressResponse, error) { - path := "/v1/Configuration/Addresses" + path := "/v1/Configuration/Addresses" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConfigurationAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConfigurationAddressResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConfigurationAddress records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -299,6 +305,7 @@ func (c *ApiService) StreamConfigurationAddress(params *ListConfigurationAddress return recordChannel, errorChannel } + func (c *ApiService) streamConfigurationAddress(response *ListConfigurationAddressResponse, params *ListConfigurationAddressParams, recordChannel chan ConversationsV1ConfigurationAddress, errorChannel chan error) { curRecord := 1 @@ -330,131 +337,133 @@ func (c *ApiService) streamConfigurationAddress(response *ListConfigurationAddre } func (c *ApiService) getNextListConfigurationAddressResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConfigurationAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListConfigurationAddressResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConfigurationAddress' type UpdateConfigurationAddressParams struct { - // The human-readable name of this configuration, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Enable/Disable auto-creating conversations for messages to this address - AutoCreationEnabled *bool `json:"AutoCreation.Enabled,omitempty"` - // - AutoCreationType *string `json:"AutoCreation.Type,omitempty"` - // Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service. - AutoCreationConversationServiceSid *string `json:"AutoCreation.ConversationServiceSid,omitempty"` - // For type `webhook`, the url for the webhook request. - AutoCreationWebhookUrl *string `json:"AutoCreation.WebhookUrl,omitempty"` - // - AutoCreationWebhookMethod *string `json:"AutoCreation.WebhookMethod,omitempty"` - // The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated` - AutoCreationWebhookFilters *[]string `json:"AutoCreation.WebhookFilters,omitempty"` - // For type `studio`, the studio flow SID where the webhook should be sent to. - AutoCreationStudioFlowSid *string `json:"AutoCreation.StudioFlowSid,omitempty"` - // For type `studio`, number of times to retry the webhook request - AutoCreationStudioRetryCount *int `json:"AutoCreation.StudioRetryCount,omitempty"` -} - -func (params *UpdateConfigurationAddressParams) SetFriendlyName(FriendlyName string) *UpdateConfigurationAddressParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationEnabled(AutoCreationEnabled bool) *UpdateConfigurationAddressParams { - params.AutoCreationEnabled = &AutoCreationEnabled - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationType(AutoCreationType string) *UpdateConfigurationAddressParams { - params.AutoCreationType = &AutoCreationType - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationConversationServiceSid(AutoCreationConversationServiceSid string) *UpdateConfigurationAddressParams { - params.AutoCreationConversationServiceSid = &AutoCreationConversationServiceSid - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationWebhookUrl(AutoCreationWebhookUrl string) *UpdateConfigurationAddressParams { - params.AutoCreationWebhookUrl = &AutoCreationWebhookUrl - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationWebhookMethod(AutoCreationWebhookMethod string) *UpdateConfigurationAddressParams { - params.AutoCreationWebhookMethod = &AutoCreationWebhookMethod - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationWebhookFilters(AutoCreationWebhookFilters []string) *UpdateConfigurationAddressParams { - params.AutoCreationWebhookFilters = &AutoCreationWebhookFilters - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationStudioFlowSid(AutoCreationStudioFlowSid string) *UpdateConfigurationAddressParams { - params.AutoCreationStudioFlowSid = &AutoCreationStudioFlowSid - return params -} -func (params *UpdateConfigurationAddressParams) SetAutoCreationStudioRetryCount(AutoCreationStudioRetryCount int) *UpdateConfigurationAddressParams { - params.AutoCreationStudioRetryCount = &AutoCreationStudioRetryCount - return params + // The human-readable name of this configuration, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Enable/Disable auto-creating conversations for messages to this address + AutoCreationEnabled *bool `json:"AutoCreation.Enabled,omitempty"` + // + AutoCreationType *string `json:"AutoCreation.Type,omitempty"` + // Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service. + AutoCreationConversationServiceSid *string `json:"AutoCreation.ConversationServiceSid,omitempty"` + // For type `webhook`, the url for the webhook request. + AutoCreationWebhookUrl *string `json:"AutoCreation.WebhookUrl,omitempty"` + // + AutoCreationWebhookMethod *string `json:"AutoCreation.WebhookMethod,omitempty"` + // The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated` + AutoCreationWebhookFilters *[]string `json:"AutoCreation.WebhookFilters,omitempty"` + // For type `studio`, the studio flow SID where the webhook should be sent to. + AutoCreationStudioFlowSid *string `json:"AutoCreation.StudioFlowSid,omitempty"` + // For type `studio`, number of times to retry the webhook request + AutoCreationStudioRetryCount *int `json:"AutoCreation.StudioRetryCount,omitempty"` +} + +func (params *UpdateConfigurationAddressParams) SetFriendlyName(FriendlyName string) (*UpdateConfigurationAddressParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationEnabled(AutoCreationEnabled bool) (*UpdateConfigurationAddressParams){ + params.AutoCreationEnabled = &AutoCreationEnabled + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationType(AutoCreationType string) (*UpdateConfigurationAddressParams){ + params.AutoCreationType = &AutoCreationType + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationConversationServiceSid(AutoCreationConversationServiceSid string) (*UpdateConfigurationAddressParams){ + params.AutoCreationConversationServiceSid = &AutoCreationConversationServiceSid + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationWebhookUrl(AutoCreationWebhookUrl string) (*UpdateConfigurationAddressParams){ + params.AutoCreationWebhookUrl = &AutoCreationWebhookUrl + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationWebhookMethod(AutoCreationWebhookMethod string) (*UpdateConfigurationAddressParams){ + params.AutoCreationWebhookMethod = &AutoCreationWebhookMethod + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationWebhookFilters(AutoCreationWebhookFilters []string) (*UpdateConfigurationAddressParams){ + params.AutoCreationWebhookFilters = &AutoCreationWebhookFilters + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationStudioFlowSid(AutoCreationStudioFlowSid string) (*UpdateConfigurationAddressParams){ + params.AutoCreationStudioFlowSid = &AutoCreationStudioFlowSid + return params +} +func (params *UpdateConfigurationAddressParams) SetAutoCreationStudioRetryCount(AutoCreationStudioRetryCount int) (*UpdateConfigurationAddressParams){ + params.AutoCreationStudioRetryCount = &AutoCreationStudioRetryCount + return params } // Update an existing address configuration func (c *ApiService) UpdateConfigurationAddress(Sid string, params *UpdateConfigurationAddressParams) (*ConversationsV1ConfigurationAddress, error) { - path := "/v1/Configuration/Addresses/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AutoCreationEnabled != nil { - data.Set("AutoCreation.Enabled", fmt.Sprint(*params.AutoCreationEnabled)) - } - if params != nil && params.AutoCreationType != nil { - data.Set("AutoCreation.Type", *params.AutoCreationType) - } - if params != nil && params.AutoCreationConversationServiceSid != nil { - data.Set("AutoCreation.ConversationServiceSid", *params.AutoCreationConversationServiceSid) - } - if params != nil && params.AutoCreationWebhookUrl != nil { - data.Set("AutoCreation.WebhookUrl", *params.AutoCreationWebhookUrl) - } - if params != nil && params.AutoCreationWebhookMethod != nil { - data.Set("AutoCreation.WebhookMethod", *params.AutoCreationWebhookMethod) - } - if params != nil && params.AutoCreationWebhookFilters != nil { - for _, item := range *params.AutoCreationWebhookFilters { - data.Add("AutoCreation.WebhookFilters", item) - } - } - if params != nil && params.AutoCreationStudioFlowSid != nil { - data.Set("AutoCreation.StudioFlowSid", *params.AutoCreationStudioFlowSid) - } - if params != nil && params.AutoCreationStudioRetryCount != nil { - data.Set("AutoCreation.StudioRetryCount", fmt.Sprint(*params.AutoCreationStudioRetryCount)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ConfigurationAddress{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Configuration/Addresses/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AutoCreationEnabled != nil { + data.Set("AutoCreation.Enabled", fmt.Sprint(*params.AutoCreationEnabled)) + } + if params != nil && params.AutoCreationType != nil { + data.Set("AutoCreation.Type", *params.AutoCreationType) + } + if params != nil && params.AutoCreationConversationServiceSid != nil { + data.Set("AutoCreation.ConversationServiceSid", *params.AutoCreationConversationServiceSid) + } + if params != nil && params.AutoCreationWebhookUrl != nil { + data.Set("AutoCreation.WebhookUrl", *params.AutoCreationWebhookUrl) + } + if params != nil && params.AutoCreationWebhookMethod != nil { + data.Set("AutoCreation.WebhookMethod", *params.AutoCreationWebhookMethod) + } + if params != nil && params.AutoCreationWebhookFilters != nil { + for _, item := range *params.AutoCreationWebhookFilters { + data.Add("AutoCreation.WebhookFilters", item) + } + } + if params != nil && params.AutoCreationStudioFlowSid != nil { + data.Set("AutoCreation.StudioFlowSid", *params.AutoCreationStudioFlowSid) + } + if params != nil && params.AutoCreationStudioRetryCount != nil { + data.Set("AutoCreation.StudioRetryCount", fmt.Sprint(*params.AutoCreationStudioRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ConfigurationAddress{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/configuration_webhooks.go b/rest/conversations/v1/configuration_webhooks.go index bece581d0..d9fd6945d 100644 --- a/rest/conversations/v1/configuration_webhooks.go +++ b/rest/conversations/v1/configuration_webhooks.go @@ -16,102 +16,109 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) -// + +// func (c *ApiService) FetchConfigurationWebhook() (*ConversationsV1ConfigurationWebhook, error) { - path := "/v1/Configuration/Webhooks" + path := "/v1/Configuration/Webhooks" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ConfigurationWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ConfigurationWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateConfigurationWebhook' type UpdateConfigurationWebhookParams struct { - // The HTTP method to be used when sending a webhook request. - Method *string `json:"Method,omitempty"` - // The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` - Filters *[]string `json:"Filters,omitempty"` - // The absolute url the pre-event webhook request should be sent to. - PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` - // The absolute url the post-event webhook request should be sent to. - PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` - // - Target *string `json:"Target,omitempty"` + // The HTTP method to be used when sending a webhook request. + Method *string `json:"Method,omitempty"` + // The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + Filters *[]string `json:"Filters,omitempty"` + // The absolute url the pre-event webhook request should be sent to. + PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` + // The absolute url the post-event webhook request should be sent to. + PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` + // + Target *string `json:"Target,omitempty"` } -func (params *UpdateConfigurationWebhookParams) SetMethod(Method string) *UpdateConfigurationWebhookParams { - params.Method = &Method - return params +func (params *UpdateConfigurationWebhookParams) SetMethod(Method string) (*UpdateConfigurationWebhookParams){ + params.Method = &Method + return params } -func (params *UpdateConfigurationWebhookParams) SetFilters(Filters []string) *UpdateConfigurationWebhookParams { - params.Filters = &Filters - return params +func (params *UpdateConfigurationWebhookParams) SetFilters(Filters []string) (*UpdateConfigurationWebhookParams){ + params.Filters = &Filters + return params } -func (params *UpdateConfigurationWebhookParams) SetPreWebhookUrl(PreWebhookUrl string) *UpdateConfigurationWebhookParams { - params.PreWebhookUrl = &PreWebhookUrl - return params +func (params *UpdateConfigurationWebhookParams) SetPreWebhookUrl(PreWebhookUrl string) (*UpdateConfigurationWebhookParams){ + params.PreWebhookUrl = &PreWebhookUrl + return params } -func (params *UpdateConfigurationWebhookParams) SetPostWebhookUrl(PostWebhookUrl string) *UpdateConfigurationWebhookParams { - params.PostWebhookUrl = &PostWebhookUrl - return params +func (params *UpdateConfigurationWebhookParams) SetPostWebhookUrl(PostWebhookUrl string) (*UpdateConfigurationWebhookParams){ + params.PostWebhookUrl = &PostWebhookUrl + return params } -func (params *UpdateConfigurationWebhookParams) SetTarget(Target string) *UpdateConfigurationWebhookParams { - params.Target = &Target - return params +func (params *UpdateConfigurationWebhookParams) SetTarget(Target string) (*UpdateConfigurationWebhookParams){ + params.Target = &Target + return params } -// +// func (c *ApiService) UpdateConfigurationWebhook(params *UpdateConfigurationWebhookParams) (*ConversationsV1ConfigurationWebhook, error) { - path := "/v1/Configuration/Webhooks" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Method != nil { - data.Set("Method", *params.Method) - } - if params != nil && params.Filters != nil { - for _, item := range *params.Filters { - data.Add("Filters", item) - } - } - if params != nil && params.PreWebhookUrl != nil { - data.Set("PreWebhookUrl", *params.PreWebhookUrl) - } - if params != nil && params.PostWebhookUrl != nil { - data.Set("PostWebhookUrl", *params.PostWebhookUrl) - } - if params != nil && params.Target != nil { - data.Set("Target", *params.Target) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ConfigurationWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Configuration/Webhooks" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Method != nil { + data.Set("Method", *params.Method) + } + if params != nil && params.Filters != nil { + for _, item := range *params.Filters { + data.Add("Filters", item) + } + } + if params != nil && params.PreWebhookUrl != nil { + data.Set("PreWebhookUrl", *params.PreWebhookUrl) + } + if params != nil && params.PostWebhookUrl != nil { + data.Set("PostWebhookUrl", *params.PostWebhookUrl) + } + if params != nil && params.Target != nil { + data.Set("Target", *params.Target) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ConfigurationWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/conversations.go b/rest/conversations/v1/conversations.go index 02ab5a2bc..1eeb630d0 100644 --- a/rest/conversations/v1/conversations.go +++ b/rest/conversations/v1/conversations.go @@ -18,280 +18,283 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConversation' type CreateConversationParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - UniqueName *string `json:"UniqueName,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // - State *string `json:"State,omitempty"` - // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. - TimersInactive *string `json:"Timers.Inactive,omitempty"` - // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. - TimersClosed *string `json:"Timers.Closed,omitempty"` - // The default email address that will be used when sending outbound emails in this conversation. - BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` - // The default name that will be used when sending outbound emails in this conversation. - BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` -} - -func (params *CreateConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateConversationParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateConversationParams) SetFriendlyName(FriendlyName string) *CreateConversationParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateConversationParams) SetUniqueName(UniqueName string) *CreateConversationParams { - params.UniqueName = &UniqueName - return params -} -func (params *CreateConversationParams) SetDateCreated(DateCreated time.Time) *CreateConversationParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateConversationParams) SetDateUpdated(DateUpdated time.Time) *CreateConversationParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateConversationParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateConversationParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *CreateConversationParams) SetAttributes(Attributes string) *CreateConversationParams { - params.Attributes = &Attributes - return params -} -func (params *CreateConversationParams) SetState(State string) *CreateConversationParams { - params.State = &State - return params -} -func (params *CreateConversationParams) SetTimersInactive(TimersInactive string) *CreateConversationParams { - params.TimersInactive = &TimersInactive - return params -} -func (params *CreateConversationParams) SetTimersClosed(TimersClosed string) *CreateConversationParams { - params.TimersClosed = &TimersClosed - return params -} -func (params *CreateConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) *CreateConversationParams { - params.BindingsEmailAddress = &BindingsEmailAddress - return params -} -func (params *CreateConversationParams) SetBindingsEmailName(BindingsEmailName string) *CreateConversationParams { - params.BindingsEmailName = &BindingsEmailName - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"UniqueName,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // + State *string `json:"State,omitempty"` + // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + TimersInactive *string `json:"Timers.Inactive,omitempty"` + // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + TimersClosed *string `json:"Timers.Closed,omitempty"` + // The default email address that will be used when sending outbound emails in this conversation. + BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` + // The default name that will be used when sending outbound emails in this conversation. + BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` +} + +func (params *CreateConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateConversationParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateConversationParams) SetFriendlyName(FriendlyName string) (*CreateConversationParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateConversationParams) SetUniqueName(UniqueName string) (*CreateConversationParams){ + params.UniqueName = &UniqueName + return params +} +func (params *CreateConversationParams) SetDateCreated(DateCreated time.Time) (*CreateConversationParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateConversationParams) SetDateUpdated(DateUpdated time.Time) (*CreateConversationParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateConversationParams) SetMessagingServiceSid(MessagingServiceSid string) (*CreateConversationParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *CreateConversationParams) SetAttributes(Attributes string) (*CreateConversationParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateConversationParams) SetState(State string) (*CreateConversationParams){ + params.State = &State + return params +} +func (params *CreateConversationParams) SetTimersInactive(TimersInactive string) (*CreateConversationParams){ + params.TimersInactive = &TimersInactive + return params +} +func (params *CreateConversationParams) SetTimersClosed(TimersClosed string) (*CreateConversationParams){ + params.TimersClosed = &TimersClosed + return params +} +func (params *CreateConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) (*CreateConversationParams){ + params.BindingsEmailAddress = &BindingsEmailAddress + return params +} +func (params *CreateConversationParams) SetBindingsEmailName(BindingsEmailName string) (*CreateConversationParams){ + params.BindingsEmailName = &BindingsEmailName + return params } // Create a new conversation in your account's default service func (c *ApiService) CreateConversation(params *CreateConversationParams) (*ConversationsV1Conversation, error) { - path := "/v1/Conversations" + path := "/v1/Conversations" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.TimersInactive != nil { + data.Set("Timers.Inactive", *params.TimersInactive) + } + if params != nil && params.TimersClosed != nil { + data.Set("Timers.Closed", *params.TimersClosed) + } + if params != nil && params.BindingsEmailAddress != nil { + data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) + } + if params != nil && params.BindingsEmailName != nil { + data.Set("Bindings.Email.Name", *params.BindingsEmailName) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.TimersInactive != nil { - data.Set("Timers.Inactive", *params.TimersInactive) - } - if params != nil && params.TimersClosed != nil { - data.Set("Timers.Closed", *params.TimersClosed) - } - if params != nil && params.BindingsEmailAddress != nil { - data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) - } - if params != nil && params.BindingsEmailName != nil { - data.Set("Bindings.Email.Name", *params.BindingsEmailName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1Conversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1Conversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteConversation' type DeleteConversationParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteConversationParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteConversationParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a conversation from your account's default service -func (c *ApiService) DeleteConversation(Sid string, params *DeleteConversationParams) error { - path := "/v1/Conversations/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteConversation(Sid string, params *DeleteConversationParams) (error) { + path := "/v1/Conversations/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Fetch a conversation from your account's default service -func (c *ApiService) FetchConversation(Sid string) (*ConversationsV1Conversation, error) { - path := "/v1/Conversations/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchConversation(Sid string, ) (*ConversationsV1Conversation, error) { + path := "/v1/Conversations/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1Conversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ConversationsV1Conversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConversation' type ListConversationParams struct { - // Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - StartDate *string `json:"StartDate,omitempty"` - // End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. - EndDate *string `json:"EndDate,omitempty"` - // State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` - State *string `json:"State,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. + StartDate *string `json:"StartDate,omitempty"` + // End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + EndDate *string `json:"EndDate,omitempty"` + // State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` + State *string `json:"State,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConversationParams) SetStartDate(StartDate string) *ListConversationParams { - params.StartDate = &StartDate - return params +func (params *ListConversationParams) SetStartDate(StartDate string) (*ListConversationParams){ + params.StartDate = &StartDate + return params } -func (params *ListConversationParams) SetEndDate(EndDate string) *ListConversationParams { - params.EndDate = &EndDate - return params +func (params *ListConversationParams) SetEndDate(EndDate string) (*ListConversationParams){ + params.EndDate = &EndDate + return params } -func (params *ListConversationParams) SetState(State string) *ListConversationParams { - params.State = &State - return params +func (params *ListConversationParams) SetState(State string) (*ListConversationParams){ + params.State = &State + return params } -func (params *ListConversationParams) SetPageSize(PageSize int) *ListConversationParams { - params.PageSize = &PageSize - return params +func (params *ListConversationParams) SetPageSize(PageSize int) (*ListConversationParams){ + params.PageSize = &PageSize + return params } -func (params *ListConversationParams) SetLimit(Limit int) *ListConversationParams { - params.Limit = &Limit - return params +func (params *ListConversationParams) SetLimit(Limit int) (*ListConversationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Conversation records from the API. Request is executed immediately. func (c *ApiService) PageConversation(params *ListConversationParams, pageToken, pageNumber string) (*ListConversationResponse, error) { - path := "/v1/Conversations" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.StartDate != nil { - data.Set("StartDate", *params.StartDate) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", *params.EndDate) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Conversations" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.StartDate != nil { + data.Set("StartDate", *params.StartDate) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", *params.EndDate) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Conversation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -332,6 +335,7 @@ func (c *ApiService) StreamConversation(params *ListConversationParams) (chan Co return recordChannel, errorChannel } + func (c *ApiService) streamConversation(response *ListConversationResponse, params *ListConversationParams, recordChannel chan ConversationsV1Conversation, errorChannel chan error) { curRecord := 1 @@ -363,157 +367,158 @@ func (c *ApiService) streamConversation(response *ListConversationResponse, para } func (c *ApiService) getNextListConversationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConversation' type UpdateConversationParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // - State *string `json:"State,omitempty"` - // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. - TimersInactive *string `json:"Timers.Inactive,omitempty"` - // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. - TimersClosed *string `json:"Timers.Closed,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - UniqueName *string `json:"UniqueName,omitempty"` - // The default email address that will be used when sending outbound emails in this conversation. - BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` - // The default name that will be used when sending outbound emails in this conversation. - BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` -} - -func (params *UpdateConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateConversationParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateConversationParams) SetFriendlyName(FriendlyName string) *UpdateConversationParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateConversationParams) SetDateCreated(DateCreated time.Time) *UpdateConversationParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateConversationParams) SetDateUpdated(DateUpdated time.Time) *UpdateConversationParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateConversationParams) SetAttributes(Attributes string) *UpdateConversationParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateConversationParams) SetMessagingServiceSid(MessagingServiceSid string) *UpdateConversationParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *UpdateConversationParams) SetState(State string) *UpdateConversationParams { - params.State = &State - return params -} -func (params *UpdateConversationParams) SetTimersInactive(TimersInactive string) *UpdateConversationParams { - params.TimersInactive = &TimersInactive - return params -} -func (params *UpdateConversationParams) SetTimersClosed(TimersClosed string) *UpdateConversationParams { - params.TimersClosed = &TimersClosed - return params -} -func (params *UpdateConversationParams) SetUniqueName(UniqueName string) *UpdateConversationParams { - params.UniqueName = &UniqueName - return params -} -func (params *UpdateConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) *UpdateConversationParams { - params.BindingsEmailAddress = &BindingsEmailAddress - return params -} -func (params *UpdateConversationParams) SetBindingsEmailName(BindingsEmailName string) *UpdateConversationParams { - params.BindingsEmailName = &BindingsEmailName - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // + State *string `json:"State,omitempty"` + // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + TimersInactive *string `json:"Timers.Inactive,omitempty"` + // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + TimersClosed *string `json:"Timers.Closed,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"UniqueName,omitempty"` + // The default email address that will be used when sending outbound emails in this conversation. + BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` + // The default name that will be used when sending outbound emails in this conversation. + BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` +} + +func (params *UpdateConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateConversationParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateConversationParams) SetFriendlyName(FriendlyName string) (*UpdateConversationParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateConversationParams) SetDateCreated(DateCreated time.Time) (*UpdateConversationParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateConversationParams) SetDateUpdated(DateUpdated time.Time) (*UpdateConversationParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateConversationParams) SetAttributes(Attributes string) (*UpdateConversationParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateConversationParams) SetMessagingServiceSid(MessagingServiceSid string) (*UpdateConversationParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *UpdateConversationParams) SetState(State string) (*UpdateConversationParams){ + params.State = &State + return params +} +func (params *UpdateConversationParams) SetTimersInactive(TimersInactive string) (*UpdateConversationParams){ + params.TimersInactive = &TimersInactive + return params +} +func (params *UpdateConversationParams) SetTimersClosed(TimersClosed string) (*UpdateConversationParams){ + params.TimersClosed = &TimersClosed + return params +} +func (params *UpdateConversationParams) SetUniqueName(UniqueName string) (*UpdateConversationParams){ + params.UniqueName = &UniqueName + return params +} +func (params *UpdateConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) (*UpdateConversationParams){ + params.BindingsEmailAddress = &BindingsEmailAddress + return params +} +func (params *UpdateConversationParams) SetBindingsEmailName(BindingsEmailName string) (*UpdateConversationParams){ + params.BindingsEmailName = &BindingsEmailName + return params } // Update an existing conversation in your account's default service func (c *ApiService) UpdateConversation(Sid string, params *UpdateConversationParams) (*ConversationsV1Conversation, error) { - path := "/v1/Conversations/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Conversations/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.TimersInactive != nil { + data.Set("Timers.Inactive", *params.TimersInactive) + } + if params != nil && params.TimersClosed != nil { + data.Set("Timers.Closed", *params.TimersClosed) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.BindingsEmailAddress != nil { + data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) + } + if params != nil && params.BindingsEmailName != nil { + data.Set("Bindings.Email.Name", *params.BindingsEmailName) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.TimersInactive != nil { - data.Set("Timers.Inactive", *params.TimersInactive) - } - if params != nil && params.TimersClosed != nil { - data.Set("Timers.Closed", *params.TimersClosed) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.BindingsEmailAddress != nil { - data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) - } - if params != nil && params.BindingsEmailName != nil { - data.Set("Bindings.Email.Name", *params.BindingsEmailName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1Conversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1Conversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/conversations_messages.go b/rest/conversations/v1/conversations_messages.go index 04c750436..9813db3dc 100644 --- a/rest/conversations/v1/conversations_messages.go +++ b/rest/conversations/v1/conversations_messages.go @@ -18,249 +18,251 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConversationMessage' type CreateConversationMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The channel specific identifier of the message's author. Defaults to `system`. - Author *string `json:"Author,omitempty"` - // The content of the message, can be up to 1,600 characters long. - Body *string `json:"Body,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. `null` if the message has not been edited. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The Media SID to be attached to the new Message. - MediaSid *string `json:"MediaSid,omitempty"` - // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. - ContentSid *string `json:"ContentSid,omitempty"` - // A structurally valid JSON string that contains values to resolve Rich Content template variables. - ContentVariables *string `json:"ContentVariables,omitempty"` - // The subject of the message, can be up to 256 characters long. - Subject *string `json:"Subject,omitempty"` -} - -func (params *CreateConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateConversationMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateConversationMessageParams) SetAuthor(Author string) *CreateConversationMessageParams { - params.Author = &Author - return params -} -func (params *CreateConversationMessageParams) SetBody(Body string) *CreateConversationMessageParams { - params.Body = &Body - return params -} -func (params *CreateConversationMessageParams) SetDateCreated(DateCreated time.Time) *CreateConversationMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateConversationMessageParams) SetDateUpdated(DateUpdated time.Time) *CreateConversationMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateConversationMessageParams) SetAttributes(Attributes string) *CreateConversationMessageParams { - params.Attributes = &Attributes - return params -} -func (params *CreateConversationMessageParams) SetMediaSid(MediaSid string) *CreateConversationMessageParams { - params.MediaSid = &MediaSid - return params -} -func (params *CreateConversationMessageParams) SetContentSid(ContentSid string) *CreateConversationMessageParams { - params.ContentSid = &ContentSid - return params -} -func (params *CreateConversationMessageParams) SetContentVariables(ContentVariables string) *CreateConversationMessageParams { - params.ContentVariables = &ContentVariables - return params -} -func (params *CreateConversationMessageParams) SetSubject(Subject string) *CreateConversationMessageParams { - params.Subject = &Subject - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The channel specific identifier of the message's author. Defaults to `system`. + Author *string `json:"Author,omitempty"` + // The content of the message, can be up to 1,600 characters long. + Body *string `json:"Body,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. `null` if the message has not been edited. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The Media SID to be attached to the new Message. + MediaSid *string `json:"MediaSid,omitempty"` + // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. + ContentSid *string `json:"ContentSid,omitempty"` + // A structurally valid JSON string that contains values to resolve Rich Content template variables. + ContentVariables *string `json:"ContentVariables,omitempty"` + // The subject of the message, can be up to 256 characters long. + Subject *string `json:"Subject,omitempty"` +} + +func (params *CreateConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateConversationMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateConversationMessageParams) SetAuthor(Author string) (*CreateConversationMessageParams){ + params.Author = &Author + return params +} +func (params *CreateConversationMessageParams) SetBody(Body string) (*CreateConversationMessageParams){ + params.Body = &Body + return params +} +func (params *CreateConversationMessageParams) SetDateCreated(DateCreated time.Time) (*CreateConversationMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateConversationMessageParams) SetDateUpdated(DateUpdated time.Time) (*CreateConversationMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateConversationMessageParams) SetAttributes(Attributes string) (*CreateConversationMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateConversationMessageParams) SetMediaSid(MediaSid string) (*CreateConversationMessageParams){ + params.MediaSid = &MediaSid + return params +} +func (params *CreateConversationMessageParams) SetContentSid(ContentSid string) (*CreateConversationMessageParams){ + params.ContentSid = &ContentSid + return params +} +func (params *CreateConversationMessageParams) SetContentVariables(ContentVariables string) (*CreateConversationMessageParams){ + params.ContentVariables = &ContentVariables + return params +} +func (params *CreateConversationMessageParams) SetSubject(Subject string) (*CreateConversationMessageParams){ + params.Subject = &Subject + return params } // Add a new message to the conversation func (c *ApiService) CreateConversationMessage(ConversationSid string, params *CreateConversationMessageParams) (*ConversationsV1ConversationMessage, error) { - path := "/v1/Conversations/{ConversationSid}/Messages" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path := "/v1/Conversations/{ConversationSid}/Messages" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Author != nil { + data.Set("Author", *params.Author) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MediaSid != nil { + data.Set("MediaSid", *params.MediaSid) + } + if params != nil && params.ContentSid != nil { + data.Set("ContentSid", *params.ContentSid) + } + if params != nil && params.ContentVariables != nil { + data.Set("ContentVariables", *params.ContentVariables) + } + if params != nil && params.Subject != nil { + data.Set("Subject", *params.Subject) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Author != nil { - data.Set("Author", *params.Author) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MediaSid != nil { - data.Set("MediaSid", *params.MediaSid) - } - if params != nil && params.ContentSid != nil { - data.Set("ContentSid", *params.ContentSid) - } - if params != nil && params.ContentVariables != nil { - data.Set("ContentVariables", *params.ContentVariables) - } - if params != nil && params.Subject != nil { - data.Set("Subject", *params.Subject) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ConversationMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ConversationMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteConversationMessage' type DeleteConversationMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteConversationMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteConversationMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a message from the conversation -func (c *ApiService) DeleteConversationMessage(ConversationSid string, Sid string, params *DeleteConversationMessageParams) error { - path := "/v1/Conversations/{ConversationSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteConversationMessage(ConversationSid string, Sid string, params *DeleteConversationMessageParams) (error) { + path := "/v1/Conversations/{ConversationSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } // Fetch a message from the conversation -func (c *ApiService) FetchConversationMessage(ConversationSid string, Sid string) (*ConversationsV1ConversationMessage, error) { - path := "/v1/Conversations/{ConversationSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchConversationMessage(ConversationSid string, Sid string, ) (*ConversationsV1ConversationMessage, error) { + path := "/v1/Conversations/{ConversationSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ConversationMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ConversationsV1ConversationMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConversationMessage' type ListConversationMessageParams struct { - // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConversationMessageParams) SetOrder(Order string) *ListConversationMessageParams { - params.Order = &Order - return params +func (params *ListConversationMessageParams) SetOrder(Order string) (*ListConversationMessageParams){ + params.Order = &Order + return params } -func (params *ListConversationMessageParams) SetPageSize(PageSize int) *ListConversationMessageParams { - params.PageSize = &PageSize - return params +func (params *ListConversationMessageParams) SetPageSize(PageSize int) (*ListConversationMessageParams){ + params.PageSize = &PageSize + return params } -func (params *ListConversationMessageParams) SetLimit(Limit int) *ListConversationMessageParams { - params.Limit = &Limit - return params +func (params *ListConversationMessageParams) SetLimit(Limit int) (*ListConversationMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConversationMessage records from the API. Request is executed immediately. func (c *ApiService) PageConversationMessage(ConversationSid string, params *ListConversationMessageParams, pageToken, pageNumber string) (*ListConversationMessageResponse, error) { - path := "/v1/Conversations/{ConversationSid}/Messages" + path := "/v1/Conversations/{ConversationSid}/Messages" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConversationMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConversationMessage records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -301,6 +303,7 @@ func (c *ApiService) StreamConversationMessage(ConversationSid string, params *L return recordChannel, errorChannel } + func (c *ApiService) streamConversationMessage(response *ListConversationMessageResponse, params *ListConversationMessageParams, recordChannel chan ConversationsV1ConversationMessage, errorChannel chan error) { curRecord := 1 @@ -332,113 +335,114 @@ func (c *ApiService) streamConversationMessage(response *ListConversationMessage } func (c *ApiService) getNextListConversationMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListConversationMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConversationMessage' type UpdateConversationMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The channel specific identifier of the message's author. Defaults to `system`. - Author *string `json:"Author,omitempty"` - // The content of the message, can be up to 1,600 characters long. - Body *string `json:"Body,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. `null` if the message has not been edited. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The subject of the message, can be up to 256 characters long. - Subject *string `json:"Subject,omitempty"` -} - -func (params *UpdateConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateConversationMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateConversationMessageParams) SetAuthor(Author string) *UpdateConversationMessageParams { - params.Author = &Author - return params -} -func (params *UpdateConversationMessageParams) SetBody(Body string) *UpdateConversationMessageParams { - params.Body = &Body - return params -} -func (params *UpdateConversationMessageParams) SetDateCreated(DateCreated time.Time) *UpdateConversationMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateConversationMessageParams) SetDateUpdated(DateUpdated time.Time) *UpdateConversationMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateConversationMessageParams) SetAttributes(Attributes string) *UpdateConversationMessageParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateConversationMessageParams) SetSubject(Subject string) *UpdateConversationMessageParams { - params.Subject = &Subject - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The channel specific identifier of the message's author. Defaults to `system`. + Author *string `json:"Author,omitempty"` + // The content of the message, can be up to 1,600 characters long. + Body *string `json:"Body,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. `null` if the message has not been edited. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The subject of the message, can be up to 256 characters long. + Subject *string `json:"Subject,omitempty"` +} + +func (params *UpdateConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateConversationMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateConversationMessageParams) SetAuthor(Author string) (*UpdateConversationMessageParams){ + params.Author = &Author + return params +} +func (params *UpdateConversationMessageParams) SetBody(Body string) (*UpdateConversationMessageParams){ + params.Body = &Body + return params +} +func (params *UpdateConversationMessageParams) SetDateCreated(DateCreated time.Time) (*UpdateConversationMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateConversationMessageParams) SetDateUpdated(DateUpdated time.Time) (*UpdateConversationMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateConversationMessageParams) SetAttributes(Attributes string) (*UpdateConversationMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateConversationMessageParams) SetSubject(Subject string) (*UpdateConversationMessageParams){ + params.Subject = &Subject + return params } // Update an existing message in the conversation func (c *ApiService) UpdateConversationMessage(ConversationSid string, Sid string, params *UpdateConversationMessageParams) (*ConversationsV1ConversationMessage, error) { - path := "/v1/Conversations/{ConversationSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Conversations/{ConversationSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Author != nil { + data.Set("Author", *params.Author) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.Subject != nil { + data.Set("Subject", *params.Subject) + } - if params != nil && params.Author != nil { - data.Set("Author", *params.Author) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.Subject != nil { - data.Set("Subject", *params.Subject) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ConversationsV1ConversationMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ConversationMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/conversations_messages_receipts.go b/rest/conversations/v1/conversations_messages_receipts.go index 25cb7fd58..f2709b4ec 100644 --- a/rest/conversations/v1/conversations_messages_receipts.go +++ b/rest/conversations/v1/conversations_messages_receipts.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch the delivery and read receipts of the conversation message -func (c *ApiService) FetchConversationMessageReceipt(ConversationSid string, MessageSid string, Sid string) (*ConversationsV1ConversationMessageReceipt, error) { - path := "/v1/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchConversationMessageReceipt(ConversationSid string, MessageSid string, Sid string, ) (*ConversationsV1ConversationMessageReceipt, error) { + path := "/v1/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ConversationMessageReceipt{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ConversationMessageReceipt{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConversationMessageReceipt' type ListConversationMessageReceiptParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConversationMessageReceiptParams) SetPageSize(PageSize int) *ListConversationMessageReceiptParams { - params.PageSize = &PageSize - return params +func (params *ListConversationMessageReceiptParams) SetPageSize(PageSize int) (*ListConversationMessageReceiptParams){ + params.PageSize = &PageSize + return params } -func (params *ListConversationMessageReceiptParams) SetLimit(Limit int) *ListConversationMessageReceiptParams { - params.Limit = &Limit - return params +func (params *ListConversationMessageReceiptParams) SetLimit(Limit int) (*ListConversationMessageReceiptParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConversationMessageReceipt records from the API. Request is executed immediately. func (c *ApiService) PageConversationMessageReceipt(ConversationSid string, MessageSid string, params *ListConversationMessageReceiptParams, pageToken, pageNumber string) (*ListConversationMessageReceiptResponse, error) { - path := "/v1/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts" + path := "/v1/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationMessageReceiptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConversationMessageReceiptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConversationMessageReceipt records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamConversationMessageReceipt(ConversationSid string, Me return recordChannel, errorChannel } + func (c *ApiService) streamConversationMessageReceipt(response *ListConversationMessageReceiptResponse, params *ListConversationMessageReceiptParams, recordChannel chan ConversationsV1ConversationMessageReceipt, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamConversationMessageReceipt(response *ListConversation } func (c *ApiService) getNextListConversationMessageReceiptResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConversationMessageReceiptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConversationMessageReceiptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/conversations/v1/conversations_participants.go b/rest/conversations/v1/conversations_participants.go index 85dc93b09..ead2ba3bb 100644 --- a/rest/conversations/v1/conversations_participants.go +++ b/rest/conversations/v1/conversations_participants.go @@ -18,231 +18,233 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConversationParticipant' type CreateConversationParticipantParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - Identity *string `json:"Identity,omitempty"` - // The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). - MessagingBindingAddress *string `json:"MessagingBinding.Address,omitempty"` - // The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). - MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity. - MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` - // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. - RoleSid *string `json:"RoleSid,omitempty"` -} - -func (params *CreateConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateConversationParticipantParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateConversationParticipantParams) SetIdentity(Identity string) *CreateConversationParticipantParams { - params.Identity = &Identity - return params -} -func (params *CreateConversationParticipantParams) SetMessagingBindingAddress(MessagingBindingAddress string) *CreateConversationParticipantParams { - params.MessagingBindingAddress = &MessagingBindingAddress - return params -} -func (params *CreateConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) *CreateConversationParticipantParams { - params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress - return params -} -func (params *CreateConversationParticipantParams) SetDateCreated(DateCreated time.Time) *CreateConversationParticipantParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) *CreateConversationParticipantParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateConversationParticipantParams) SetAttributes(Attributes string) *CreateConversationParticipantParams { - params.Attributes = &Attributes - return params -} -func (params *CreateConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) *CreateConversationParticipantParams { - params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress - return params -} -func (params *CreateConversationParticipantParams) SetRoleSid(RoleSid string) *CreateConversationParticipantParams { - params.RoleSid = &RoleSid - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + Identity *string `json:"Identity,omitempty"` + // The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). + MessagingBindingAddress *string `json:"MessagingBinding.Address,omitempty"` + // The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). + MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity. + MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` + // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + RoleSid *string `json:"RoleSid,omitempty"` +} + +func (params *CreateConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateConversationParticipantParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateConversationParticipantParams) SetIdentity(Identity string) (*CreateConversationParticipantParams){ + params.Identity = &Identity + return params +} +func (params *CreateConversationParticipantParams) SetMessagingBindingAddress(MessagingBindingAddress string) (*CreateConversationParticipantParams){ + params.MessagingBindingAddress = &MessagingBindingAddress + return params +} +func (params *CreateConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) (*CreateConversationParticipantParams){ + params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress + return params +} +func (params *CreateConversationParticipantParams) SetDateCreated(DateCreated time.Time) (*CreateConversationParticipantParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) (*CreateConversationParticipantParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateConversationParticipantParams) SetAttributes(Attributes string) (*CreateConversationParticipantParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) (*CreateConversationParticipantParams){ + params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress + return params +} +func (params *CreateConversationParticipantParams) SetRoleSid(RoleSid string) (*CreateConversationParticipantParams){ + params.RoleSid = &RoleSid + return params } // Add a new participant to the conversation func (c *ApiService) CreateConversationParticipant(ConversationSid string, params *CreateConversationParticipantParams) (*ConversationsV1ConversationParticipant, error) { - path := "/v1/Conversations/{ConversationSid}/Participants" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path := "/v1/Conversations/{ConversationSid}/Participants" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.MessagingBindingAddress != nil { + data.Set("MessagingBinding.Address", *params.MessagingBindingAddress) + } + if params != nil && params.MessagingBindingProxyAddress != nil { + data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MessagingBindingProjectedAddress != nil { + data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.MessagingBindingAddress != nil { - data.Set("MessagingBinding.Address", *params.MessagingBindingAddress) - } - if params != nil && params.MessagingBindingProxyAddress != nil { - data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MessagingBindingProjectedAddress != nil { - data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ConversationParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ConversationParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteConversationParticipant' type DeleteConversationParticipantParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteConversationParticipantParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteConversationParticipantParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a participant from the conversation -func (c *ApiService) DeleteConversationParticipant(ConversationSid string, Sid string, params *DeleteConversationParticipantParams) error { - path := "/v1/Conversations/{ConversationSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteConversationParticipant(ConversationSid string, Sid string, params *DeleteConversationParticipantParams) (error) { + path := "/v1/Conversations/{ConversationSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Fetch a participant of the conversation -func (c *ApiService) FetchConversationParticipant(ConversationSid string, Sid string) (*ConversationsV1ConversationParticipant, error) { - path := "/v1/Conversations/{ConversationSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchConversationParticipant(ConversationSid string, Sid string, ) (*ConversationsV1ConversationParticipant, error) { + path := "/v1/Conversations/{ConversationSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ConversationParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ConversationParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConversationParticipant' type ListConversationParticipantParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConversationParticipantParams) SetPageSize(PageSize int) *ListConversationParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListConversationParticipantParams) SetPageSize(PageSize int) (*ListConversationParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListConversationParticipantParams) SetLimit(Limit int) *ListConversationParticipantParams { - params.Limit = &Limit - return params +func (params *ListConversationParticipantParams) SetLimit(Limit int) (*ListConversationParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConversationParticipant records from the API. Request is executed immediately. func (c *ApiService) PageConversationParticipant(ConversationSid string, params *ListConversationParticipantParams, pageToken, pageNumber string) (*ListConversationParticipantResponse, error) { - path := "/v1/Conversations/{ConversationSid}/Participants" + path := "/v1/Conversations/{ConversationSid}/Participants" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConversationParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConversationParticipant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -283,6 +285,7 @@ func (c *ApiService) StreamConversationParticipant(ConversationSid string, param return recordChannel, errorChannel } + func (c *ApiService) streamConversationParticipant(response *ListConversationParticipantResponse, params *ListConversationParticipantParams, recordChannel chan ConversationsV1ConversationParticipant, errorChannel chan error) { curRecord := 1 @@ -314,140 +317,141 @@ func (c *ApiService) streamConversationParticipant(response *ListConversationPar } func (c *ApiService) getNextListConversationParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListConversationParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConversationParticipant' type UpdateConversationParticipantParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. - RoleSid *string `json:"RoleSid,omitempty"` - // The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it. - MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` - // The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it. - MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - Identity *string `json:"Identity,omitempty"` - // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` - // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - LastReadTimestamp *string `json:"LastReadTimestamp,omitempty"` -} - -func (params *UpdateConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateConversationParticipantParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateConversationParticipantParams) SetDateCreated(DateCreated time.Time) *UpdateConversationParticipantParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) *UpdateConversationParticipantParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateConversationParticipantParams) SetAttributes(Attributes string) *UpdateConversationParticipantParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateConversationParticipantParams) SetRoleSid(RoleSid string) *UpdateConversationParticipantParams { - params.RoleSid = &RoleSid - return params -} -func (params *UpdateConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) *UpdateConversationParticipantParams { - params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress - return params -} -func (params *UpdateConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) *UpdateConversationParticipantParams { - params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress - return params -} -func (params *UpdateConversationParticipantParams) SetIdentity(Identity string) *UpdateConversationParticipantParams { - params.Identity = &Identity - return params -} -func (params *UpdateConversationParticipantParams) SetLastReadMessageIndex(LastReadMessageIndex int) *UpdateConversationParticipantParams { - params.LastReadMessageIndex = &LastReadMessageIndex - return params -} -func (params *UpdateConversationParticipantParams) SetLastReadTimestamp(LastReadTimestamp string) *UpdateConversationParticipantParams { - params.LastReadTimestamp = &LastReadTimestamp - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + RoleSid *string `json:"RoleSid,omitempty"` + // The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it. + MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` + // The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it. + MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + Identity *string `json:"Identity,omitempty"` + // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` + // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + LastReadTimestamp *string `json:"LastReadTimestamp,omitempty"` +} + +func (params *UpdateConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateConversationParticipantParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateConversationParticipantParams) SetDateCreated(DateCreated time.Time) (*UpdateConversationParticipantParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) (*UpdateConversationParticipantParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateConversationParticipantParams) SetAttributes(Attributes string) (*UpdateConversationParticipantParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateConversationParticipantParams) SetRoleSid(RoleSid string) (*UpdateConversationParticipantParams){ + params.RoleSid = &RoleSid + return params +} +func (params *UpdateConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) (*UpdateConversationParticipantParams){ + params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress + return params +} +func (params *UpdateConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) (*UpdateConversationParticipantParams){ + params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress + return params +} +func (params *UpdateConversationParticipantParams) SetIdentity(Identity string) (*UpdateConversationParticipantParams){ + params.Identity = &Identity + return params +} +func (params *UpdateConversationParticipantParams) SetLastReadMessageIndex(LastReadMessageIndex int) (*UpdateConversationParticipantParams){ + params.LastReadMessageIndex = &LastReadMessageIndex + return params +} +func (params *UpdateConversationParticipantParams) SetLastReadTimestamp(LastReadTimestamp string) (*UpdateConversationParticipantParams){ + params.LastReadTimestamp = &LastReadTimestamp + return params } // Update an existing participant in the conversation func (c *ApiService) UpdateConversationParticipant(ConversationSid string, Sid string, params *UpdateConversationParticipantParams) (*ConversationsV1ConversationParticipant, error) { - path := "/v1/Conversations/{ConversationSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Conversations/{ConversationSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.MessagingBindingProxyAddress != nil { + data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) + } + if params != nil && params.MessagingBindingProjectedAddress != nil { + data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) + } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.LastReadMessageIndex != nil { + data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) + } + if params != nil && params.LastReadTimestamp != nil { + data.Set("LastReadTimestamp", *params.LastReadTimestamp) + } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.MessagingBindingProxyAddress != nil { - data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) - } - if params != nil && params.MessagingBindingProjectedAddress != nil { - data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) - } - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.LastReadMessageIndex != nil { - data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) - } - if params != nil && params.LastReadTimestamp != nil { - data.Set("LastReadTimestamp", *params.LastReadTimestamp) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ConversationsV1ConversationParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ConversationParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/conversations_webhooks.go b/rest/conversations/v1/conversations_webhooks.go index bb6609d3d..761cf9d9c 100644 --- a/rest/conversations/v1/conversations_webhooks.go +++ b/rest/conversations/v1/conversations_webhooks.go @@ -18,200 +18,205 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConversationScopedWebhook' type CreateConversationScopedWebhookParams struct { - // - Target *string `json:"Target,omitempty"` - // The absolute url the webhook request should be sent to. - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // The list of events, firing webhook event for this Conversation. - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // The list of keywords, firing webhook event for this Conversation. - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // The studio flow SID, where the webhook should be sent to. - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` - // The message index for which and it's successors the webhook will be replayed. Not set by default - ConfigurationReplayAfter *int `json:"Configuration.ReplayAfter,omitempty"` + // + Target *string `json:"Target,omitempty"` + // The absolute url the webhook request should be sent to. + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // The list of events, firing webhook event for this Conversation. + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // The list of keywords, firing webhook event for this Conversation. + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // The studio flow SID, where the webhook should be sent to. + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // The message index for which and it's successors the webhook will be replayed. Not set by default + ConfigurationReplayAfter *int `json:"Configuration.ReplayAfter,omitempty"` } -func (params *CreateConversationScopedWebhookParams) SetTarget(Target string) *CreateConversationScopedWebhookParams { - params.Target = &Target - return params +func (params *CreateConversationScopedWebhookParams) SetTarget(Target string) (*CreateConversationScopedWebhookParams){ + params.Target = &Target + return params } -func (params *CreateConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *CreateConversationScopedWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *CreateConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*CreateConversationScopedWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *CreateConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *CreateConversationScopedWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *CreateConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*CreateConversationScopedWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *CreateConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *CreateConversationScopedWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *CreateConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*CreateConversationScopedWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *CreateConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *CreateConversationScopedWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *CreateConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*CreateConversationScopedWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *CreateConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *CreateConversationScopedWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *CreateConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*CreateConversationScopedWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } -func (params *CreateConversationScopedWebhookParams) SetConfigurationReplayAfter(ConfigurationReplayAfter int) *CreateConversationScopedWebhookParams { - params.ConfigurationReplayAfter = &ConfigurationReplayAfter - return params +func (params *CreateConversationScopedWebhookParams) SetConfigurationReplayAfter(ConfigurationReplayAfter int) (*CreateConversationScopedWebhookParams){ + params.ConfigurationReplayAfter = &ConfigurationReplayAfter + return params } // Create a new webhook scoped to the conversation func (c *ApiService) CreateConversationScopedWebhook(ConversationSid string, params *CreateConversationScopedWebhookParams) (*ConversationsV1ConversationScopedWebhook, error) { - path := "/v1/Conversations/{ConversationSid}/Webhooks" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Target != nil { - data.Set("Target", *params.Target) - } - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - if params != nil && params.ConfigurationReplayAfter != nil { - data.Set("Configuration.ReplayAfter", fmt.Sprint(*params.ConfigurationReplayAfter)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ConversationScopedWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Conversations/{ConversationSid}/Webhooks" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Target != nil { + data.Set("Target", *params.Target) + } + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + if params != nil && params.ConfigurationReplayAfter != nil { + data.Set("Configuration.ReplayAfter", fmt.Sprint(*params.ConfigurationReplayAfter)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ConversationScopedWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Remove an existing webhook scoped to the conversation -func (c *ApiService) DeleteConversationScopedWebhook(ConversationSid string, Sid string) error { - path := "/v1/Conversations/{ConversationSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteConversationScopedWebhook(ConversationSid string, Sid string, ) (error) { + path := "/v1/Conversations/{ConversationSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch the configuration of a conversation-scoped webhook -func (c *ApiService) FetchConversationScopedWebhook(ConversationSid string, Sid string) (*ConversationsV1ConversationScopedWebhook, error) { - path := "/v1/Conversations/{ConversationSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchConversationScopedWebhook(ConversationSid string, Sid string, ) (*ConversationsV1ConversationScopedWebhook, error) { + path := "/v1/Conversations/{ConversationSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ConversationScopedWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ConversationsV1ConversationScopedWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConversationScopedWebhook' type ListConversationScopedWebhookParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConversationScopedWebhookParams) SetPageSize(PageSize int) *ListConversationScopedWebhookParams { - params.PageSize = &PageSize - return params +func (params *ListConversationScopedWebhookParams) SetPageSize(PageSize int) (*ListConversationScopedWebhookParams){ + params.PageSize = &PageSize + return params } -func (params *ListConversationScopedWebhookParams) SetLimit(Limit int) *ListConversationScopedWebhookParams { - params.Limit = &Limit - return params +func (params *ListConversationScopedWebhookParams) SetLimit(Limit int) (*ListConversationScopedWebhookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConversationScopedWebhook records from the API. Request is executed immediately. func (c *ApiService) PageConversationScopedWebhook(ConversationSid string, params *ListConversationScopedWebhookParams, pageToken, pageNumber string) (*ListConversationScopedWebhookResponse, error) { - path := "/v1/Conversations/{ConversationSid}/Webhooks" + path := "/v1/Conversations/{ConversationSid}/Webhooks" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConversationScopedWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConversationScopedWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConversationScopedWebhook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -252,6 +257,7 @@ func (c *ApiService) StreamConversationScopedWebhook(ConversationSid string, par return recordChannel, errorChannel } + func (c *ApiService) streamConversationScopedWebhook(response *ListConversationScopedWebhookResponse, params *ListConversationScopedWebhookParams, recordChannel chan ConversationsV1ConversationScopedWebhook, errorChannel chan error) { curRecord := 1 @@ -283,98 +289,100 @@ func (c *ApiService) streamConversationScopedWebhook(response *ListConversationS } func (c *ApiService) getNextListConversationScopedWebhookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConversationScopedWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConversationScopedWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConversationScopedWebhook' type UpdateConversationScopedWebhookParams struct { - // The absolute url the webhook request should be sent to. - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // The list of events, firing webhook event for this Conversation. - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // The list of keywords, firing webhook event for this Conversation. - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // The studio flow SID, where the webhook should be sent to. - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // The absolute url the webhook request should be sent to. + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // The list of events, firing webhook event for this Conversation. + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // The list of keywords, firing webhook event for this Conversation. + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // The studio flow SID, where the webhook should be sent to. + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` } -func (params *UpdateConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *UpdateConversationScopedWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *UpdateConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*UpdateConversationScopedWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *UpdateConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *UpdateConversationScopedWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *UpdateConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*UpdateConversationScopedWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *UpdateConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *UpdateConversationScopedWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *UpdateConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*UpdateConversationScopedWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *UpdateConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *UpdateConversationScopedWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *UpdateConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*UpdateConversationScopedWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *UpdateConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *UpdateConversationScopedWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *UpdateConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*UpdateConversationScopedWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } // Update an existing conversation-scoped webhook func (c *ApiService) UpdateConversationScopedWebhook(ConversationSid string, Sid string, params *UpdateConversationScopedWebhookParams) (*ConversationsV1ConversationScopedWebhook, error) { - path := "/v1/Conversations/{ConversationSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ConversationScopedWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Conversations/{ConversationSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ConversationScopedWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/credentials.go b/rest/conversations/v1/credentials.go index be3d3d586..c3528873d 100644 --- a/rest/conversations/v1/credentials.go +++ b/rest/conversations/v1/credentials.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredential' type CreateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *CreateCredentialParams) SetType(Type string) *CreateCredentialParams { - params.Type = &Type - return params +func (params *CreateCredentialParams) SetType(Type string) (*CreateCredentialParams){ + params.Type = &Type + return params } -func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) *CreateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) (*CreateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialParams) SetCertificate(Certificate string) *CreateCredentialParams { - params.Certificate = &Certificate - return params +func (params *CreateCredentialParams) SetCertificate(Certificate string) (*CreateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) *CreateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) (*CreateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *CreateCredentialParams) SetSandbox(Sandbox bool) *CreateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *CreateCredentialParams) SetSandbox(Sandbox bool) (*CreateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *CreateCredentialParams) SetApiKey(ApiKey string) *CreateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *CreateCredentialParams) SetApiKey(ApiKey string) (*CreateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *CreateCredentialParams) SetSecret(Secret string) *CreateCredentialParams { - params.Secret = &Secret - return params +func (params *CreateCredentialParams) SetSecret(Secret string) (*CreateCredentialParams){ + params.Secret = &Secret + return params } // Add a new push notification credential to your account func (c *ApiService) CreateCredential(params *CreateCredentialParams) (*ConversationsV1Credential, error) { - path := "/v1/Credentials" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Remove a push notification credential from your account -func (c *ApiService) DeleteCredential(Sid string) error { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCredential(Sid string, ) (error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a push notification credential from your account -func (c *ApiService) FetchCredential(Sid string) (*ConversationsV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCredential(Sid string, ) (*ConversationsV1Credential, error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListCredential' type ListCredentialParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialParams) SetPageSize(PageSize int) *ListCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialParams) SetPageSize(PageSize int) (*ListCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialParams) SetLimit(Limit int) *ListCredentialParams { - params.Limit = &Limit - return params +func (params *ListCredentialParams) SetLimit(Limit int) (*ListCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Credential records from the API. Request is executed immediately. func (c *ApiService) PageCredential(params *ListCredentialParams, pageToken, pageNumber string) (*ListCredentialResponse, error) { - path := "/v1/Credentials" + path := "/v1/Credentials" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Credential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCredential(params *ListCredentialParams) (chan Conver return recordChannel, errorChannel } + func (c *ApiService) streamCredential(response *ListCredentialResponse, params *ListCredentialParams, recordChannel chan ConversationsV1Credential, errorChannel chan error) { curRecord := 1 @@ -274,111 +281,113 @@ func (c *ApiService) streamCredential(response *ListCredentialResponse, params * } func (c *ApiService) getNextListCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredential' type UpdateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *UpdateCredentialParams) SetType(Type string) *UpdateCredentialParams { - params.Type = &Type - return params +func (params *UpdateCredentialParams) SetType(Type string) (*UpdateCredentialParams){ + params.Type = &Type + return params } -func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) *UpdateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCredentialParams) SetCertificate(Certificate string) *UpdateCredentialParams { - params.Certificate = &Certificate - return params +func (params *UpdateCredentialParams) SetCertificate(Certificate string) (*UpdateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) *UpdateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) (*UpdateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) *UpdateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) (*UpdateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *UpdateCredentialParams) SetApiKey(ApiKey string) *UpdateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *UpdateCredentialParams) SetApiKey(ApiKey string) (*UpdateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *UpdateCredentialParams) SetSecret(Secret string) *UpdateCredentialParams { - params.Secret = &Secret - return params +func (params *UpdateCredentialParams) SetSecret(Secret string) (*UpdateCredentialParams){ + params.Secret = &Secret + return params } // Update an existing push notification credential on your account func (c *ApiService) UpdateCredential(Sid string, params *UpdateCredentialParams) (*ConversationsV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/docs/ListConfigurationAddressResponseMeta.md b/rest/conversations/v1/docs/ListConfigurationAddressResponseMeta.md index bf85cc36d..8d5b7e65c 100644 --- a/rest/conversations/v1/docs/ListConfigurationAddressResponseMeta.md +++ b/rest/conversations/v1/docs/ListConfigurationAddressResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/conversations/v1/model_conversations_v1_configuration.go b/rest/conversations/v1/model_conversations_v1_configuration.go index 00626e941..d707eec50 100644 --- a/rest/conversations/v1/model_conversations_v1_configuration.go +++ b/rest/conversations/v1/model_conversations_v1_configuration.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ConversationsV1Configuration struct for ConversationsV1Configuration type ConversationsV1Configuration struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation. + // The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation. DefaultChatServiceSid *string `json:"default_chat_service_sid,omitempty"` - // The SID of the default [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) used when creating a conversation. + // The SID of the default [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) used when creating a conversation. DefaultMessagingServiceSid *string `json:"default_messaging_service_sid,omitempty"` - // Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + // Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. DefaultInactiveTimer *string `json:"default_inactive_timer,omitempty"` - // Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + // Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. DefaultClosedTimer *string `json:"default_closed_timer,omitempty"` - // An absolute API resource URL for this global configuration. + // An absolute API resource URL for this global configuration. Url *string `json:"url,omitempty"` - // Contains absolute API resource URLs to access the webhook and default service configurations. + // Contains absolute API resource URLs to access the webhook and default service configurations. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_configuration_address.go b/rest/conversations/v1/model_conversations_v1_configuration_address.go index 990145b9e..37b844213 100644 --- a/rest/conversations/v1/model_conversations_v1_configuration_address.go +++ b/rest/conversations/v1/model_conversations_v1_configuration_address.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ConfigurationAddress struct for ConversationsV1ConfigurationAddress type ConversationsV1ConfigurationAddress struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) the address belongs to + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) the address belongs to AccountSid *string `json:"account_sid,omitempty"` - // Type of Address, value can be `whatsapp` or `sms`. + // Type of Address, value can be `whatsapp` or `sms`. Type *string `json:"type,omitempty"` - // The unique address to be configured. The address can be a whatsapp address or phone number + // The unique address to be configured. The address can be a whatsapp address or phone number Address *string `json:"address,omitempty"` - // The human-readable name of this configuration, limited to 256 characters. Optional. + // The human-readable name of this configuration, limited to 256 characters. Optional. FriendlyName *string `json:"friendly_name,omitempty"` - // Auto Creation configuration for the address. + // Auto Creation configuration for the address. AutoCreation *interface{} `json:"auto_creation,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this address configuration. + // An absolute API resource URL for this address configuration. Url *string `json:"url,omitempty"` - // An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses. + // An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses. AddressCountry *string `json:"address_country,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_configuration_webhook.go b/rest/conversations/v1/model_conversations_v1_configuration_webhook.go index 958195111..cc692de59 100644 --- a/rest/conversations/v1/model_conversations_v1_configuration_webhook.go +++ b/rest/conversations/v1/model_conversations_v1_configuration_webhook.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ConversationsV1ConfigurationWebhook struct for ConversationsV1ConfigurationWebhook type ConversationsV1ConfigurationWebhook struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - Method *string `json:"method,omitempty"` - // The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + Method *string `json:"method,omitempty"` + // The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` Filters *[]string `json:"filters,omitempty"` - // The absolute url the pre-event webhook request should be sent to. + // The absolute url the pre-event webhook request should be sent to. PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` - // The absolute url the post-event webhook request should be sent to. + // The absolute url the post-event webhook request should be sent to. PostWebhookUrl *string `json:"post_webhook_url,omitempty"` - Target *string `json:"target,omitempty"` - // An absolute API resource API resource URL for this webhook. + Target *string `json:"target,omitempty"` + // An absolute API resource API resource URL for this webhook. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_conversation.go b/rest/conversations/v1/model_conversations_v1_conversation.go index c3b56a0d2..a9a2d1b5d 100644 --- a/rest/conversations/v1/model_conversations_v1_conversation.go +++ b/rest/conversations/v1/model_conversations_v1_conversation.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1Conversation struct for ConversationsV1Conversation type ConversationsV1Conversation struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. + // The human-readable name of this conversation, limited to 256 characters. Optional. FriendlyName *string `json:"friendly_name,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - State *string `json:"state,omitempty"` - // The date that this resource was created. + State *string `json:"state,omitempty"` + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Timer date values representing state update for this conversation. + // Timer date values representing state update for this conversation. Timers *interface{} `json:"timers,omitempty"` - // An absolute API resource URL for this conversation. + // An absolute API resource URL for this conversation. Url *string `json:"url,omitempty"` - // Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. - Links *map[string]interface{} `json:"links,omitempty"` - Bindings *interface{} `json:"bindings,omitempty"` + // Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + Links *map[string]interface{} `json:"links,omitempty"` + Bindings *interface{} `json:"bindings,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_conversation_message.go b/rest/conversations/v1/model_conversations_v1_conversation_message.go index f7af07572..a354fe427 100644 --- a/rest/conversations/v1/model_conversations_v1_conversation_message.go +++ b/rest/conversations/v1/model_conversations_v1_conversation_message.go @@ -13,41 +13,43 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ConversationMessage struct for ConversationsV1ConversationMessage type ConversationsV1ConversationMessage struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. ConversationSid *string `json:"conversation_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). Indices may skip numbers, but will always be in order of when the message was received. + // The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). Indices may skip numbers, but will always be in order of when the message was received. Index *int `json:"index,omitempty"` - // The channel specific identifier of the message's author. Defaults to `system`. + // The channel specific identifier of the message's author. Defaults to `system`. Author *string `json:"author,omitempty"` - // The content of the message, can be up to 1,600 characters long. + // The content of the message, can be up to 1,600 characters long. Body *string `json:"body,omitempty"` - // An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. + // An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. Media *[]interface{} `json:"media,omitempty"` - // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - // The unique ID of messages's author participant. Null in case of `system` sent message. + // The unique ID of messages's author participant. Null in case of `system` sent message. ParticipantSid *string `json:"participant_sid,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. `null` if the message has not been edited. + // The date that this resource was last updated. `null` if the message has not been edited. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource API URL for this message. + // An absolute API resource API URL for this message. Url *string `json:"url,omitempty"` - // An object that contains the summary of delivery statuses for the message to non-chat participants. + // An object that contains the summary of delivery statuses for the message to non-chat participants. Delivery *interface{} `json:"delivery,omitempty"` - // Contains an absolute API resource URL to access the delivery & read receipts of this message. + // Contains an absolute API resource URL to access the delivery & read receipts of this message. Links *map[string]interface{} `json:"links,omitempty"` - // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. + // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. ContentSid *string `json:"content_sid,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_conversation_message_receipt.go b/rest/conversations/v1/model_conversations_v1_conversation_message_receipt.go index 79008d1e1..f7f2749cc 100644 --- a/rest/conversations/v1/model_conversations_v1_conversation_message_receipt.go +++ b/rest/conversations/v1/model_conversations_v1_conversation_message_receipt.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ConversationMessageReceipt struct for ConversationsV1ConversationMessageReceipt type ConversationsV1ConversationMessageReceipt struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. ConversationSid *string `json:"conversation_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to + // The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to MessageSid *string `json:"message_sid,omitempty"` - // A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. + // A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. ChannelMessageSid *string `json:"channel_message_sid,omitempty"` - // The unique ID of the participant the delivery receipt belongs to. + // The unique ID of the participant the delivery receipt belongs to. ParticipantSid *string `json:"participant_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, + Status *string `json:"status,omitempty"` + // The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, ErrorCode *int `json:"error_code,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. `null` if the delivery receipt has not been updated. + // The date that this resource was last updated. `null` if the delivery receipt has not been updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this delivery receipt. + // An absolute API resource URL for this delivery receipt. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_conversation_participant.go b/rest/conversations/v1/model_conversations_v1_conversation_participant.go index 244a04106..81c316924 100644 --- a/rest/conversations/v1/model_conversations_v1_conversation_participant.go +++ b/rest/conversations/v1/model_conversations_v1_conversation_participant.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ConversationParticipant struct for ConversationsV1ConversationParticipant type ConversationsV1ConversationParticipant struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. ConversationSid *string `json:"conversation_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. Identity *string `json:"identity,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. MessagingBinding *interface{} `json:"messaging_binding,omitempty"` - // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. RoleSid *string `json:"role_sid,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this participant. + // An absolute API resource URL for this participant. Url *string `json:"url,omitempty"` - // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. LastReadMessageIndex *int `json:"last_read_message_index,omitempty"` - // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. LastReadTimestamp *string `json:"last_read_timestamp,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_conversation_scoped_webhook.go b/rest/conversations/v1/model_conversations_v1_conversation_scoped_webhook.go index 6c416e06c..766a9e799 100644 --- a/rest/conversations/v1/model_conversations_v1_conversation_scoped_webhook.go +++ b/rest/conversations/v1/model_conversations_v1_conversation_scoped_webhook.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ConversationScopedWebhook struct for ConversationsV1ConversationScopedWebhook type ConversationsV1ConversationScopedWebhook struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. ConversationSid *string `json:"conversation_sid,omitempty"` - // The target of this webhook: `webhook`, `studio`, `trigger` + // The target of this webhook: `webhook`, `studio`, `trigger` Target *string `json:"target,omitempty"` - // An absolute API resource URL for this webhook. + // An absolute API resource URL for this webhook. Url *string `json:"url,omitempty"` - // The configuration of this webhook. Is defined based on target. + // The configuration of this webhook. Is defined based on target. Configuration *interface{} `json:"configuration,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_credential.go b/rest/conversations/v1/model_conversations_v1_credential.go index 5cd0596e6..8e6264f5d 100644 --- a/rest/conversations/v1/model_conversations_v1_credential.go +++ b/rest/conversations/v1/model_conversations_v1_credential.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1Credential struct for ConversationsV1Credential type ConversationsV1Credential struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this credential. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this credential. AccountSid *string `json:"account_sid,omitempty"` - // The human-readable name of this credential, limited to 64 characters. Optional. + // The human-readable name of this credential, limited to 64 characters. Optional. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Type *string `json:"type,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. Sandbox *string `json:"sandbox,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this credential. + // An absolute API resource URL for this credential. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_participant_conversation.go b/rest/conversations/v1/model_conversations_v1_participant_conversation.go index 00efa445e..4383da075 100644 --- a/rest/conversations/v1/model_conversations_v1_participant_conversation.go +++ b/rest/conversations/v1/model_conversations_v1_participant_conversation.go @@ -13,42 +13,44 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ParticipantConversation struct for ConversationsV1ParticipantConversation type ConversationsV1ParticipantConversation struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). + // The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). ParticipantSid *string `json:"participant_sid,omitempty"` - // The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). + // The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). ParticipantUserSid *string `json:"participant_user_sid,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. ParticipantIdentity *string `json:"participant_identity,omitempty"` - // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. ParticipantMessagingBinding *interface{} `json:"participant_messaging_binding,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. ConversationSid *string `json:"conversation_sid,omitempty"` - // An application-defined string that uniquely identifies the Conversation resource. + // An application-defined string that uniquely identifies the Conversation resource. ConversationUniqueName *string `json:"conversation_unique_name,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. + // The human-readable name of this conversation, limited to 256 characters. Optional. ConversationFriendlyName *string `json:"conversation_friendly_name,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. ConversationAttributes *string `json:"conversation_attributes,omitempty"` - // The date that this conversation was created, given in ISO 8601 format. + // The date that this conversation was created, given in ISO 8601 format. ConversationDateCreated *time.Time `json:"conversation_date_created,omitempty"` - // The date that this conversation was last updated, given in ISO 8601 format. + // The date that this conversation was last updated, given in ISO 8601 format. ConversationDateUpdated *time.Time `json:"conversation_date_updated,omitempty"` - // Identity of the creator of this Conversation. + // Identity of the creator of this Conversation. ConversationCreatedBy *string `json:"conversation_created_by,omitempty"` - ConversationState *string `json:"conversation_state,omitempty"` - // Timer date values representing state update for this conversation. + ConversationState *string `json:"conversation_state,omitempty"` + // Timer date values representing state update for this conversation. ConversationTimers *interface{} `json:"conversation_timers,omitempty"` - // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_role.go b/rest/conversations/v1/model_conversations_v1_role.go index 76755b4c5..d74af8920 100644 --- a/rest/conversations/v1/model_conversations_v1_role.go +++ b/rest/conversations/v1/model_conversations_v1_role.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1Role struct for ConversationsV1Role type ConversationsV1Role struct { - // The unique string that we created to identify the Role resource. + // The unique string that we created to identify the Role resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // An array of the permissions the role has been granted. + Type *string `json:"type,omitempty"` + // An array of the permissions the role has been granted. Permissions *[]string `json:"permissions,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this user role. + // An absolute API resource URL for this user role. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service.go b/rest/conversations/v1/model_conversations_v1_service.go index 1c2274bc0..5fc840880 100644 --- a/rest/conversations/v1/model_conversations_v1_service.go +++ b/rest/conversations/v1/model_conversations_v1_service.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1Service struct for ConversationsV1Service type ConversationsV1Service struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. AccountSid *string `json:"account_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The human-readable name of this service, limited to 256 characters. Optional. + // The human-readable name of this service, limited to 256 characters. Optional. FriendlyName *string `json:"friendly_name,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this service. + // An absolute API resource URL for this service. Url *string `json:"url,omitempty"` - // Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service. + // Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_binding.go b/rest/conversations/v1/model_conversations_v1_service_binding.go index 816c084b2..507c37e97 100644 --- a/rest/conversations/v1/model_conversations_v1_service_binding.go +++ b/rest/conversations/v1/model_conversations_v1_service_binding.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceBinding struct for ConversationsV1ServiceBinding type ConversationsV1ServiceBinding struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this binding. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this binding. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/conversations/api/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + // The SID of the [Credential](https://www.twilio.com/docs/conversations/api/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. CredentialSid *string `json:"credential_sid,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. + // The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. Endpoint *string `json:"endpoint,omitempty"` - // The application-defined string that uniquely identifies the [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more info. - Identity *string `json:"identity,omitempty"` + // The application-defined string that uniquely identifies the [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more info. + Identity *string `json:"identity,omitempty"` BindingType *string `json:"binding_type,omitempty"` - // The [Conversation message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. + // The [Conversation message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. MessageTypes *[]string `json:"message_types,omitempty"` - // An absolute API resource URL for this binding. + // An absolute API resource URL for this binding. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_configuration.go b/rest/conversations/v1/model_conversations_v1_service_configuration.go index bc8f2b883..451f5a71e 100644 --- a/rest/conversations/v1/model_conversations_v1_service_configuration.go +++ b/rest/conversations/v1/model_conversations_v1_service_configuration.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ConversationsV1ServiceConfiguration struct for ConversationsV1ServiceConfiguration type ConversationsV1ServiceConfiguration struct { - // The unique string that we created to identify the Service configuration resource. + // The unique string that we created to identify the Service configuration resource. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + // The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. DefaultConversationCreatorRoleSid *string `json:"default_conversation_creator_role_sid,omitempty"` - // The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + // The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. DefaultConversationRoleSid *string `json:"default_conversation_role_sid,omitempty"` - // The service-level role assigned to users when they are added to the service. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + // The service-level role assigned to users when they are added to the service. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. DefaultChatServiceRoleSid *string `json:"default_chat_service_role_sid,omitempty"` - // An absolute API resource URL for this service configuration. + // An absolute API resource URL for this service configuration. Url *string `json:"url,omitempty"` - // Contains an absolute API resource URL to access the push notifications configuration of this service. + // Contains an absolute API resource URL to access the push notifications configuration of this service. Links *map[string]interface{} `json:"links,omitempty"` - // Whether the [Reachability Indicator](https://www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`. + // Whether the [Reachability Indicator](https://www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`. ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_conversation.go b/rest/conversations/v1/model_conversations_v1_service_conversation.go index 7005d3965..04728885c 100644 --- a/rest/conversations/v1/model_conversations_v1_service_conversation.go +++ b/rest/conversations/v1/model_conversations_v1_service_conversation.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceConversation struct for ConversationsV1ServiceConversation type ConversationsV1ServiceConversation struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. + // The human-readable name of this conversation, limited to 256 characters. Optional. FriendlyName *string `json:"friendly_name,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - State *string `json:"state,omitempty"` - // The date that this resource was created. + State *string `json:"state,omitempty"` + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Timer date values representing state update for this conversation. + // Timer date values representing state update for this conversation. Timers *interface{} `json:"timers,omitempty"` - // An absolute API resource URL for this conversation. + // An absolute API resource URL for this conversation. Url *string `json:"url,omitempty"` - // Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. - Links *map[string]interface{} `json:"links,omitempty"` - Bindings *interface{} `json:"bindings,omitempty"` + // Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + Links *map[string]interface{} `json:"links,omitempty"` + Bindings *interface{} `json:"bindings,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_conversation_message.go b/rest/conversations/v1/model_conversations_v1_service_conversation_message.go index 8a26f57eb..e1515439b 100644 --- a/rest/conversations/v1/model_conversations_v1_service_conversation_message.go +++ b/rest/conversations/v1/model_conversations_v1_service_conversation_message.go @@ -13,43 +13,45 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceConversationMessage struct for ConversationsV1ServiceConversationMessage type ConversationsV1ServiceConversationMessage struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. ConversationSid *string `json:"conversation_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). + // The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). Index *int `json:"index,omitempty"` - // The channel specific identifier of the message's author. Defaults to `system`. + // The channel specific identifier of the message's author. Defaults to `system`. Author *string `json:"author,omitempty"` - // The content of the message, can be up to 1,600 characters long. + // The content of the message, can be up to 1,600 characters long. Body *string `json:"body,omitempty"` - // An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. + // An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. Media *[]interface{} `json:"media,omitempty"` - // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - // The unique ID of messages's author participant. Null in case of `system` sent message. + // The unique ID of messages's author participant. Null in case of `system` sent message. ParticipantSid *string `json:"participant_sid,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. `null` if the message has not been edited. + // The date that this resource was last updated. `null` if the message has not been edited. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An object that contains the summary of delivery statuses for the message to non-chat participants. + // An object that contains the summary of delivery statuses for the message to non-chat participants. Delivery *interface{} `json:"delivery,omitempty"` - // An absolute API resource URL for this message. + // An absolute API resource URL for this message. Url *string `json:"url,omitempty"` - // Contains an absolute API resource URL to access the delivery & read receipts of this message. + // Contains an absolute API resource URL to access the delivery & read receipts of this message. Links *map[string]interface{} `json:"links,omitempty"` - // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. + // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. ContentSid *string `json:"content_sid,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_conversation_message_receipt.go b/rest/conversations/v1/model_conversations_v1_service_conversation_message_receipt.go index cd09a9da5..412680dd9 100644 --- a/rest/conversations/v1/model_conversations_v1_service_conversation_message_receipt.go +++ b/rest/conversations/v1/model_conversations_v1_service_conversation_message_receipt.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceConversationMessageReceipt struct for ConversationsV1ServiceConversationMessageReceipt type ConversationsV1ServiceConversationMessageReceipt struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Message resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Message resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. ConversationSid *string `json:"conversation_sid,omitempty"` - // The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to + // The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to MessageSid *string `json:"message_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. + // A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. ChannelMessageSid *string `json:"channel_message_sid,omitempty"` - // The unique ID of the participant the delivery receipt belongs to. + // The unique ID of the participant the delivery receipt belongs to. ParticipantSid *string `json:"participant_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, + Status *string `json:"status,omitempty"` + // The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, ErrorCode *int `json:"error_code,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. `null` if the delivery receipt has not been updated. + // The date that this resource was last updated. `null` if the delivery receipt has not been updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this delivery receipt. + // An absolute API resource URL for this delivery receipt. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_conversation_participant.go b/rest/conversations/v1/model_conversations_v1_service_conversation_participant.go index 50305a2ee..e401033b6 100644 --- a/rest/conversations/v1/model_conversations_v1_service_conversation_participant.go +++ b/rest/conversations/v1/model_conversations_v1_service_conversation_participant.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceConversationParticipant struct for ConversationsV1ServiceConversationParticipant type ConversationsV1ServiceConversationParticipant struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. ConversationSid *string `json:"conversation_sid,omitempty"` - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. Identity *string `json:"identity,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. Attributes *string `json:"attributes,omitempty"` - // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. MessagingBinding *interface{} `json:"messaging_binding,omitempty"` - // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. RoleSid *string `json:"role_sid,omitempty"` - // The date on which this resource was created. + // The date on which this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date on which this resource was last updated. + // The date on which this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this participant. + // An absolute API resource URL for this participant. Url *string `json:"url,omitempty"` - // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. LastReadMessageIndex *int `json:"last_read_message_index,omitempty"` - // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. LastReadTimestamp *string `json:"last_read_timestamp,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_conversation_scoped_webhook.go b/rest/conversations/v1/model_conversations_v1_service_conversation_scoped_webhook.go index 556bdb45a..acd1d9e07 100644 --- a/rest/conversations/v1/model_conversations_v1_service_conversation_scoped_webhook.go +++ b/rest/conversations/v1/model_conversations_v1_service_conversation_scoped_webhook.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceConversationScopedWebhook struct for ConversationsV1ServiceConversationScopedWebhook type ConversationsV1ServiceConversationScopedWebhook struct { - // A 34 character string that uniquely identifies this resource. + // A 34 character string that uniquely identifies this resource. Sid *string `json:"sid,omitempty"` - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. ConversationSid *string `json:"conversation_sid,omitempty"` - // The target of this webhook: `webhook`, `studio`, `trigger` + // The target of this webhook: `webhook`, `studio`, `trigger` Target *string `json:"target,omitempty"` - // An absolute API resource URL for this webhook. + // An absolute API resource URL for this webhook. Url *string `json:"url,omitempty"` - // The configuration of this webhook. Is defined based on target. + // The configuration of this webhook. Is defined based on target. Configuration *interface{} `json:"configuration,omitempty"` - // The date that this resource was created. + // The date that this resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was last updated. + // The date that this resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_notification.go b/rest/conversations/v1/model_conversations_v1_service_notification.go index 46490c1e0..65e237b6b 100644 --- a/rest/conversations/v1/model_conversations_v1_service_notification.go +++ b/rest/conversations/v1/model_conversations_v1_service_notification.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ConversationsV1ServiceNotification struct for ConversationsV1ServiceNotification type ConversationsV1ServiceNotification struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Configuration applies to. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Configuration applies to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The Push Notification configuration for New Messages. + // The Push Notification configuration for New Messages. NewMessage *interface{} `json:"new_message,omitempty"` - // The Push Notification configuration for being added to a Conversation. + // The Push Notification configuration for being added to a Conversation. AddedToConversation *interface{} `json:"added_to_conversation,omitempty"` - // The Push Notification configuration for being removed from a Conversation. + // The Push Notification configuration for being removed from a Conversation. RemovedFromConversation *interface{} `json:"removed_from_conversation,omitempty"` - // Weather the notification logging is enabled. + // Weather the notification logging is enabled. LogEnabled *bool `json:"log_enabled,omitempty"` - // An absolute API resource URL for this configuration. + // An absolute API resource URL for this configuration. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_participant_conversation.go b/rest/conversations/v1/model_conversations_v1_service_participant_conversation.go index a797935c9..369b5639b 100644 --- a/rest/conversations/v1/model_conversations_v1_service_participant_conversation.go +++ b/rest/conversations/v1/model_conversations_v1_service_participant_conversation.go @@ -13,42 +13,44 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceParticipantConversation struct for ConversationsV1ServiceParticipantConversation type ConversationsV1ServiceParticipantConversation struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). + // The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). ParticipantSid *string `json:"participant_sid,omitempty"` - // The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). + // The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). ParticipantUserSid *string `json:"participant_user_sid,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. ParticipantIdentity *string `json:"participant_identity,omitempty"` - // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + // Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. ParticipantMessagingBinding *interface{} `json:"participant_messaging_binding,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. ConversationSid *string `json:"conversation_sid,omitempty"` - // An application-defined string that uniquely identifies the Conversation resource. + // An application-defined string that uniquely identifies the Conversation resource. ConversationUniqueName *string `json:"conversation_unique_name,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. + // The human-readable name of this conversation, limited to 256 characters. Optional. ConversationFriendlyName *string `json:"conversation_friendly_name,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. ConversationAttributes *string `json:"conversation_attributes,omitempty"` - // The date that this conversation was created, given in ISO 8601 format. + // The date that this conversation was created, given in ISO 8601 format. ConversationDateCreated *time.Time `json:"conversation_date_created,omitempty"` - // The date that this conversation was last updated, given in ISO 8601 format. + // The date that this conversation was last updated, given in ISO 8601 format. ConversationDateUpdated *time.Time `json:"conversation_date_updated,omitempty"` - // Identity of the creator of this Conversation. + // Identity of the creator of this Conversation. ConversationCreatedBy *string `json:"conversation_created_by,omitempty"` - ConversationState *string `json:"conversation_state,omitempty"` - // Timer date values representing state update for this conversation. + ConversationState *string `json:"conversation_state,omitempty"` + // Timer date values representing state update for this conversation. ConversationTimers *interface{} `json:"conversation_timers,omitempty"` - // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_role.go b/rest/conversations/v1/model_conversations_v1_service_role.go index 4ab7d4dfd..d139081f7 100644 --- a/rest/conversations/v1/model_conversations_v1_service_role.go +++ b/rest/conversations/v1/model_conversations_v1_service_role.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceRole struct for ConversationsV1ServiceRole type ConversationsV1ServiceRole struct { - // The unique string that we created to identify the Role resource. + // The unique string that we created to identify the Role resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // An array of the permissions the role has been granted. + Type *string `json:"type,omitempty"` + // An array of the permissions the role has been granted. Permissions *[]string `json:"permissions,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this user role. + // An absolute API resource URL for this user role. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_user.go b/rest/conversations/v1/model_conversations_v1_service_user.go index 76a325f76..ef314a315 100644 --- a/rest/conversations/v1/model_conversations_v1_service_user.go +++ b/rest/conversations/v1/model_conversations_v1_service_user.go @@ -13,36 +13,38 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceUser struct for ConversationsV1ServiceUser type ConversationsV1ServiceUser struct { - // The unique string that we created to identify the User resource. + // The unique string that we created to identify the User resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. + // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. RoleSid *string `json:"role_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. + // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. Identity *string `json:"identity,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - // Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. + // Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. IsOnline *bool `json:"is_online,omitempty"` - // Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + // Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. IsNotifiable *bool `json:"is_notifiable,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this user. - Url *string `json:"url,omitempty"` + // An absolute API resource URL for this user. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_user_conversation.go b/rest/conversations/v1/model_conversations_v1_service_user_conversation.go index c29d0e9dc..54e84cbb5 100644 --- a/rest/conversations/v1/model_conversations_v1_service_user_conversation.go +++ b/rest/conversations/v1/model_conversations_v1_service_user_conversation.go @@ -13,44 +13,46 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1ServiceUserConversation struct for ConversationsV1ServiceUserConversation type ConversationsV1ServiceUserConversation struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. ConversationSid *string `json:"conversation_sid,omitempty"` - // The number of unread Messages in the Conversation for the Participant. + // The number of unread Messages in the Conversation for the Participant. UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` - // The index of the last Message in the Conversation that the Participant has read. + // The index of the last Message in the Conversation that the Participant has read. LastReadMessageIndex *int `json:"last_read_message_index,omitempty"` - // The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. + // The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. ParticipantSid *string `json:"participant_sid,omitempty"` - // The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). + // The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). UserSid *string `json:"user_sid,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. - FriendlyName *string `json:"friendly_name,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"friendly_name,omitempty"` ConversationState *string `json:"conversation_state,omitempty"` - // Timer date values representing state update for this conversation. + // Timer date values representing state update for this conversation. Timers *interface{} `json:"timers,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - // The date that this conversation was created, given in ISO 8601 format. + // The date that this conversation was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this conversation was last updated, given in ISO 8601 format. + // The date that this conversation was last updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Identity of the creator of this Conversation. - CreatedBy *string `json:"created_by,omitempty"` + // Identity of the creator of this Conversation. + CreatedBy *string `json:"created_by,omitempty"` NotificationLevel *string `json:"notification_level,omitempty"` - // An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. + // An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - Url *string `json:"url,omitempty"` - // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + Url *string `json:"url,omitempty"` + // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_service_webhook_configuration.go b/rest/conversations/v1/model_conversations_v1_service_webhook_configuration.go index 08101849e..1e10d5d35 100644 --- a/rest/conversations/v1/model_conversations_v1_service_webhook_configuration.go +++ b/rest/conversations/v1/model_conversations_v1_service_webhook_configuration.go @@ -13,20 +13,25 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ConversationsV1ServiceWebhookConfiguration struct for ConversationsV1ServiceWebhookConfiguration type ConversationsV1ServiceWebhookConfiguration struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The absolute url the pre-event webhook request should be sent to. + // The absolute url the pre-event webhook request should be sent to. PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` - // The absolute url the post-event webhook request should be sent to. + // The absolute url the post-event webhook request should be sent to. PostWebhookUrl *string `json:"post_webhook_url,omitempty"` - // The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. + // The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. Filters *[]string `json:"filters,omitempty"` - Method *string `json:"method,omitempty"` - // An absolute API resource URL for this webhook. + Method *string `json:"method,omitempty"` + // An absolute API resource URL for this webhook. Url *string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_user.go b/rest/conversations/v1/model_conversations_v1_user.go index 7073e89d4..2d6b10989 100644 --- a/rest/conversations/v1/model_conversations_v1_user.go +++ b/rest/conversations/v1/model_conversations_v1_user.go @@ -13,36 +13,38 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1User struct for ConversationsV1User type ConversationsV1User struct { - // The unique string that we created to identify the User resource. + // The unique string that we created to identify the User resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. + // The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. + // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. RoleSid *string `json:"role_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. + // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. Identity *string `json:"identity,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. Attributes *string `json:"attributes,omitempty"` - // Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. + // Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. IsOnline *bool `json:"is_online,omitempty"` - // Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + // Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. IsNotifiable *bool `json:"is_notifiable,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An absolute API resource URL for this user. - Url *string `json:"url,omitempty"` + // An absolute API resource URL for this user. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_conversations_v1_user_conversation.go b/rest/conversations/v1/model_conversations_v1_user_conversation.go index 50637381a..77c772cb7 100644 --- a/rest/conversations/v1/model_conversations_v1_user_conversation.go +++ b/rest/conversations/v1/model_conversations_v1_user_conversation.go @@ -13,44 +13,46 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ConversationsV1UserConversation struct for ConversationsV1UserConversation type ConversationsV1UserConversation struct { - // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + // The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. AccountSid *string `json:"account_sid,omitempty"` - // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + // The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. + // The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. ConversationSid *string `json:"conversation_sid,omitempty"` - // The number of unread Messages in the Conversation for the Participant. + // The number of unread Messages in the Conversation for the Participant. UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` - // The index of the last Message in the Conversation that the Participant has read. + // The index of the last Message in the Conversation that the Participant has read. LastReadMessageIndex *int `json:"last_read_message_index,omitempty"` - // The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. + // The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. ParticipantSid *string `json:"participant_sid,omitempty"` - // The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). + // The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). UserSid *string `json:"user_sid,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. - FriendlyName *string `json:"friendly_name,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"friendly_name,omitempty"` ConversationState *string `json:"conversation_state,omitempty"` - // Timer date values representing state update for this conversation. + // Timer date values representing state update for this conversation. Timers *interface{} `json:"timers,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. Attributes *string `json:"attributes,omitempty"` - // The date that this conversation was created, given in ISO 8601 format. + // The date that this conversation was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this conversation was last updated, given in ISO 8601 format. + // The date that this conversation was last updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Identity of the creator of this Conversation. - CreatedBy *string `json:"created_by,omitempty"` + // Identity of the creator of this Conversation. + CreatedBy *string `json:"created_by,omitempty"` NotificationLevel *string `json:"notification_level,omitempty"` - // An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. + // An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. UniqueName *string `json:"unique_name,omitempty"` - Url *string `json:"url,omitempty"` - // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + Url *string `json:"url,omitempty"` + // Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_configuration_address_response.go b/rest/conversations/v1/model_list_configuration_address_response.go index 6e12a80f5..062f8712b 100644 --- a/rest/conversations/v1/model_list_configuration_address_response.go +++ b/rest/conversations/v1/model_list_configuration_address_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConfigurationAddressResponse struct for ListConfigurationAddressResponse type ListConfigurationAddressResponse struct { AddressConfigurations []ConversationsV1ConfigurationAddress `json:"address_configurations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_configuration_address_response_meta.go b/rest/conversations/v1/model_list_configuration_address_response_meta.go index 8bea5db50..7a4d1723a 100644 --- a/rest/conversations/v1/model_list_configuration_address_response_meta.go +++ b/rest/conversations/v1/model_list_configuration_address_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConfigurationAddressResponseMeta struct for ListConfigurationAddressResponseMeta type ListConfigurationAddressResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_conversation_message_receipt_response.go b/rest/conversations/v1/model_list_conversation_message_receipt_response.go index eeafbdeac..3d6f0a6bb 100644 --- a/rest/conversations/v1/model_list_conversation_message_receipt_response.go +++ b/rest/conversations/v1/model_list_conversation_message_receipt_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConversationMessageReceiptResponse struct for ListConversationMessageReceiptResponse type ListConversationMessageReceiptResponse struct { DeliveryReceipts []ConversationsV1ConversationMessageReceipt `json:"delivery_receipts,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_conversation_message_response.go b/rest/conversations/v1/model_list_conversation_message_response.go index 1a9ce1861..db879390d 100644 --- a/rest/conversations/v1/model_list_conversation_message_response.go +++ b/rest/conversations/v1/model_list_conversation_message_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConversationMessageResponse struct for ListConversationMessageResponse type ListConversationMessageResponse struct { Messages []ConversationsV1ConversationMessage `json:"messages,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_conversation_participant_response.go b/rest/conversations/v1/model_list_conversation_participant_response.go index 8cffb6e6b..3432b7a9c 100644 --- a/rest/conversations/v1/model_list_conversation_participant_response.go +++ b/rest/conversations/v1/model_list_conversation_participant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConversationParticipantResponse struct for ListConversationParticipantResponse type ListConversationParticipantResponse struct { Participants []ConversationsV1ConversationParticipant `json:"participants,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_conversation_response.go b/rest/conversations/v1/model_list_conversation_response.go index 8c82ae3ce..b41b05676 100644 --- a/rest/conversations/v1/model_list_conversation_response.go +++ b/rest/conversations/v1/model_list_conversation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConversationResponse struct for ListConversationResponse type ListConversationResponse struct { - Conversations []ConversationsV1Conversation `json:"conversations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Conversations []ConversationsV1Conversation `json:"conversations,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_conversation_scoped_webhook_response.go b/rest/conversations/v1/model_list_conversation_scoped_webhook_response.go index d2d7da751..eddf5a3aa 100644 --- a/rest/conversations/v1/model_list_conversation_scoped_webhook_response.go +++ b/rest/conversations/v1/model_list_conversation_scoped_webhook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConversationScopedWebhookResponse struct for ListConversationScopedWebhookResponse type ListConversationScopedWebhookResponse struct { Webhooks []ConversationsV1ConversationScopedWebhook `json:"webhooks,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_credential_response.go b/rest/conversations/v1/model_list_credential_response.go index 237123a0b..e62bf2028 100644 --- a/rest/conversations/v1/model_list_credential_response.go +++ b/rest/conversations/v1/model_list_credential_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialResponse struct for ListCredentialResponse type ListCredentialResponse struct { - Credentials []ConversationsV1Credential `json:"credentials,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Credentials []ConversationsV1Credential `json:"credentials,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_participant_conversation_response.go b/rest/conversations/v1/model_list_participant_conversation_response.go index adf85a67d..e61d5224c 100644 --- a/rest/conversations/v1/model_list_participant_conversation_response.go +++ b/rest/conversations/v1/model_list_participant_conversation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListParticipantConversationResponse struct for ListParticipantConversationResponse type ListParticipantConversationResponse struct { Conversations []ConversationsV1ParticipantConversation `json:"conversations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_role_response.go b/rest/conversations/v1/model_list_role_response.go index 94aeefdd6..b6075a9af 100644 --- a/rest/conversations/v1/model_list_role_response.go +++ b/rest/conversations/v1/model_list_role_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoleResponse struct for ListRoleResponse type ListRoleResponse struct { - Roles []ConversationsV1Role `json:"roles,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Roles []ConversationsV1Role `json:"roles,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_binding_response.go b/rest/conversations/v1/model_list_service_binding_response.go index 8a76bc810..e6298ef20 100644 --- a/rest/conversations/v1/model_list_service_binding_response.go +++ b/rest/conversations/v1/model_list_service_binding_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceBindingResponse struct for ListServiceBindingResponse type ListServiceBindingResponse struct { - Bindings []ConversationsV1ServiceBinding `json:"bindings,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Bindings []ConversationsV1ServiceBinding `json:"bindings,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_conversation_message_receipt_response.go b/rest/conversations/v1/model_list_service_conversation_message_receipt_response.go index bb9934198..a6aeb8419 100644 --- a/rest/conversations/v1/model_list_service_conversation_message_receipt_response.go +++ b/rest/conversations/v1/model_list_service_conversation_message_receipt_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceConversationMessageReceiptResponse struct for ListServiceConversationMessageReceiptResponse type ListServiceConversationMessageReceiptResponse struct { DeliveryReceipts []ConversationsV1ServiceConversationMessageReceipt `json:"delivery_receipts,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_conversation_message_response.go b/rest/conversations/v1/model_list_service_conversation_message_response.go index 7c67843a1..9164cb7ca 100644 --- a/rest/conversations/v1/model_list_service_conversation_message_response.go +++ b/rest/conversations/v1/model_list_service_conversation_message_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceConversationMessageResponse struct for ListServiceConversationMessageResponse type ListServiceConversationMessageResponse struct { Messages []ConversationsV1ServiceConversationMessage `json:"messages,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_conversation_participant_response.go b/rest/conversations/v1/model_list_service_conversation_participant_response.go index 108382fae..86f939ee2 100644 --- a/rest/conversations/v1/model_list_service_conversation_participant_response.go +++ b/rest/conversations/v1/model_list_service_conversation_participant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceConversationParticipantResponse struct for ListServiceConversationParticipantResponse type ListServiceConversationParticipantResponse struct { Participants []ConversationsV1ServiceConversationParticipant `json:"participants,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_conversation_response.go b/rest/conversations/v1/model_list_service_conversation_response.go index 98221a549..504375b64 100644 --- a/rest/conversations/v1/model_list_service_conversation_response.go +++ b/rest/conversations/v1/model_list_service_conversation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceConversationResponse struct for ListServiceConversationResponse type ListServiceConversationResponse struct { Conversations []ConversationsV1ServiceConversation `json:"conversations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_conversation_scoped_webhook_response.go b/rest/conversations/v1/model_list_service_conversation_scoped_webhook_response.go index 645846c5e..2a5f7867e 100644 --- a/rest/conversations/v1/model_list_service_conversation_scoped_webhook_response.go +++ b/rest/conversations/v1/model_list_service_conversation_scoped_webhook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceConversationScopedWebhookResponse struct for ListServiceConversationScopedWebhookResponse type ListServiceConversationScopedWebhookResponse struct { Webhooks []ConversationsV1ServiceConversationScopedWebhook `json:"webhooks,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_participant_conversation_response.go b/rest/conversations/v1/model_list_service_participant_conversation_response.go index 8a020a360..9472751d2 100644 --- a/rest/conversations/v1/model_list_service_participant_conversation_response.go +++ b/rest/conversations/v1/model_list_service_participant_conversation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceParticipantConversationResponse struct for ListServiceParticipantConversationResponse type ListServiceParticipantConversationResponse struct { Conversations []ConversationsV1ServiceParticipantConversation `json:"conversations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_response.go b/rest/conversations/v1/model_list_service_response.go index 431a4ed23..c39d8b32b 100644 --- a/rest/conversations/v1/model_list_service_response.go +++ b/rest/conversations/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []ConversationsV1Service `json:"services,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Services []ConversationsV1Service `json:"services,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_role_response.go b/rest/conversations/v1/model_list_service_role_response.go index 4c767d753..ee3f6c8bb 100644 --- a/rest/conversations/v1/model_list_service_role_response.go +++ b/rest/conversations/v1/model_list_service_role_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceRoleResponse struct for ListServiceRoleResponse type ListServiceRoleResponse struct { - Roles []ConversationsV1ServiceRole `json:"roles,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Roles []ConversationsV1ServiceRole `json:"roles,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_user_conversation_response.go b/rest/conversations/v1/model_list_service_user_conversation_response.go index 83228b042..538692cce 100644 --- a/rest/conversations/v1/model_list_service_user_conversation_response.go +++ b/rest/conversations/v1/model_list_service_user_conversation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceUserConversationResponse struct for ListServiceUserConversationResponse type ListServiceUserConversationResponse struct { Conversations []ConversationsV1ServiceUserConversation `json:"conversations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_service_user_response.go b/rest/conversations/v1/model_list_service_user_response.go index 2b7fdc25f..d296f40ce 100644 --- a/rest/conversations/v1/model_list_service_user_response.go +++ b/rest/conversations/v1/model_list_service_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceUserResponse struct for ListServiceUserResponse type ListServiceUserResponse struct { - Users []ConversationsV1ServiceUser `json:"users,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Users []ConversationsV1ServiceUser `json:"users,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_user_conversation_response.go b/rest/conversations/v1/model_list_user_conversation_response.go index c11512896..addb42db9 100644 --- a/rest/conversations/v1/model_list_user_conversation_response.go +++ b/rest/conversations/v1/model_list_user_conversation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserConversationResponse struct for ListUserConversationResponse type ListUserConversationResponse struct { - Conversations []ConversationsV1UserConversation `json:"conversations,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Conversations []ConversationsV1UserConversation `json:"conversations,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/model_list_user_response.go b/rest/conversations/v1/model_list_user_response.go index abd360e3e..63820c967 100644 --- a/rest/conversations/v1/model_list_user_response.go +++ b/rest/conversations/v1/model_list_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserResponse struct for ListUserResponse type ListUserResponse struct { - Users []ConversationsV1User `json:"users,omitempty"` - Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` + Users []ConversationsV1User `json:"users,omitempty"` + Meta ListConfigurationAddressResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/conversations/v1/participant_conversations.go b/rest/conversations/v1/participant_conversations.go index 955743211..8c5dfc10d 100644 --- a/rest/conversations/v1/participant_conversations.go +++ b/rest/conversations/v1/participant_conversations.go @@ -19,75 +19,77 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListParticipantConversation' type ListParticipantConversationParams struct { - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - Identity *string `json:"Identity,omitempty"` - // A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. - Address *string `json:"Address,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + Identity *string `json:"Identity,omitempty"` + // A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. + Address *string `json:"Address,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListParticipantConversationParams) SetIdentity(Identity string) *ListParticipantConversationParams { - params.Identity = &Identity - return params +func (params *ListParticipantConversationParams) SetIdentity(Identity string) (*ListParticipantConversationParams){ + params.Identity = &Identity + return params } -func (params *ListParticipantConversationParams) SetAddress(Address string) *ListParticipantConversationParams { - params.Address = &Address - return params +func (params *ListParticipantConversationParams) SetAddress(Address string) (*ListParticipantConversationParams){ + params.Address = &Address + return params } -func (params *ListParticipantConversationParams) SetPageSize(PageSize int) *ListParticipantConversationParams { - params.PageSize = &PageSize - return params +func (params *ListParticipantConversationParams) SetPageSize(PageSize int) (*ListParticipantConversationParams){ + params.PageSize = &PageSize + return params } -func (params *ListParticipantConversationParams) SetLimit(Limit int) *ListParticipantConversationParams { - params.Limit = &Limit - return params +func (params *ListParticipantConversationParams) SetLimit(Limit int) (*ListParticipantConversationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ParticipantConversation records from the API. Request is executed immediately. func (c *ApiService) PageParticipantConversation(params *ListParticipantConversationParams, pageToken, pageNumber string) (*ListParticipantConversationResponse, error) { - path := "/v1/ParticipantConversations" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.Address != nil { - data.Set("Address", *params.Address) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListParticipantConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/ParticipantConversations" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.Address != nil { + data.Set("Address", *params.Address) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListParticipantConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists ParticipantConversation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -128,6 +130,7 @@ func (c *ApiService) StreamParticipantConversation(params *ListParticipantConver return recordChannel, errorChannel } + func (c *ApiService) streamParticipantConversation(response *ListParticipantConversationResponse, params *ListParticipantConversationParams, recordChannel chan ConversationsV1ParticipantConversation, errorChannel chan error) { curRecord := 1 @@ -159,19 +162,20 @@ func (c *ApiService) streamParticipantConversation(response *ListParticipantConv } func (c *ApiService) getNextListParticipantConversationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListParticipantConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListParticipantConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/conversations/v1/roles.go b/rest/conversations/v1/roles.go index cfe820454..9365d7a85 100644 --- a/rest/conversations/v1/roles.go +++ b/rest/conversations/v1/roles.go @@ -18,157 +18,163 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRole' type CreateRoleParams struct { - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`. - Permission *[]string `json:"Permission,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`. + Permission *[]string `json:"Permission,omitempty"` } -func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) *CreateRoleParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) (*CreateRoleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRoleParams) SetType(Type string) *CreateRoleParams { - params.Type = &Type - return params +func (params *CreateRoleParams) SetType(Type string) (*CreateRoleParams){ + params.Type = &Type + return params } -func (params *CreateRoleParams) SetPermission(Permission []string) *CreateRoleParams { - params.Permission = &Permission - return params +func (params *CreateRoleParams) SetPermission(Permission []string) (*CreateRoleParams){ + params.Permission = &Permission + return params } // Create a new user role in your account's default service func (c *ApiService) CreateRole(params *CreateRoleParams) (*ConversationsV1Role, error) { - path := "/v1/Roles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Roles" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Remove a user role from your account's default service -func (c *ApiService) DeleteRole(Sid string) error { - path := "/v1/Roles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteRole(Sid string, ) (error) { + path := "/v1/Roles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a user role from your account's default service -func (c *ApiService) FetchRole(Sid string) (*ConversationsV1Role, error) { - path := "/v1/Roles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchRole(Sid string, ) (*ConversationsV1Role, error) { + path := "/v1/Roles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRole' type ListRoleParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoleParams) SetPageSize(PageSize int) *ListRoleParams { - params.PageSize = &PageSize - return params +func (params *ListRoleParams) SetPageSize(PageSize int) (*ListRoleParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoleParams) SetLimit(Limit int) *ListRoleParams { - params.Limit = &Limit - return params +func (params *ListRoleParams) SetLimit(Limit int) (*ListRoleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Role records from the API. Request is executed immediately. func (c *ApiService) PageRole(params *ListRoleParams, pageToken, pageNumber string) (*ListRoleResponse, error) { - path := "/v1/Roles" + path := "/v1/Roles" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Role records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -209,6 +215,7 @@ func (c *ApiService) StreamRole(params *ListRoleParams) (chan ConversationsV1Rol return recordChannel, errorChannel } + func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRoleParams, recordChannel chan ConversationsV1Role, errorChannel chan error) { curRecord := 1 @@ -240,59 +247,61 @@ func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRolePara } func (c *ApiService) getNextListRoleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRole' type UpdateRoleParams struct { - // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`. - Permission *[]string `json:"Permission,omitempty"` + // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`. + Permission *[]string `json:"Permission,omitempty"` } -func (params *UpdateRoleParams) SetPermission(Permission []string) *UpdateRoleParams { - params.Permission = &Permission - return params +func (params *UpdateRoleParams) SetPermission(Permission []string) (*UpdateRoleParams){ + params.Permission = &Permission + return params } // Update an existing user role in your account's default service func (c *ApiService) UpdateRole(Sid string, params *UpdateRoleParams) (*ConversationsV1Role, error) { - path := "/v1/Roles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Roles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ConversationsV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ConversationsV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/services.go b/rest/conversations/v1/services.go index 495afe477..1cd5e1c55 100644 --- a/rest/conversations/v1/services.go +++ b/rest/conversations/v1/services.go @@ -18,137 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // The human-readable name of this service, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The human-readable name of this service, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } // Create a new conversation service on your account func (c *ApiService) CreateService(params *CreateServiceParams) (*ConversationsV1Service, error) { - path := "/v1/Services" + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove a conversation service with all its nested resources from your account -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a conversation service from your account -func (c *ApiService) FetchService(Sid string) (*ConversationsV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchService(Sid string, ) (*ConversationsV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +195,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan Conversation return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan ConversationsV1Service, errorChannel chan error) { curRecord := 1 @@ -220,19 +227,20 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/conversations/v1/services_bindings.go b/rest/conversations/v1/services_bindings.go index 00708fbc6..5bbf70030 100644 --- a/rest/conversations/v1/services_bindings.go +++ b/rest/conversations/v1/services_bindings.go @@ -18,126 +18,130 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Remove a push notification binding from the conversation service -func (c *ApiService) DeleteServiceBinding(ChatServiceSid string, Sid string) error { - path := "/v1/Services/{ChatServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceBinding(ChatServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ChatServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a push notification binding from the conversation service -func (c *ApiService) FetchServiceBinding(ChatServiceSid string, Sid string) (*ConversationsV1ServiceBinding, error) { - path := "/v1/Services/{ChatServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceBinding(ChatServiceSid string, Sid string, ) (*ConversationsV1ServiceBinding, error) { + path := "/v1/Services/{ChatServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceBinding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ServiceBinding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceBinding' type ListServiceBindingParams struct { - // The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - BindingType *[]string `json:"BindingType,omitempty"` - // The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + BindingType *[]string `json:"BindingType,omitempty"` + // The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceBindingParams) SetBindingType(BindingType []string) *ListServiceBindingParams { - params.BindingType = &BindingType - return params +func (params *ListServiceBindingParams) SetBindingType(BindingType []string) (*ListServiceBindingParams){ + params.BindingType = &BindingType + return params } -func (params *ListServiceBindingParams) SetIdentity(Identity []string) *ListServiceBindingParams { - params.Identity = &Identity - return params +func (params *ListServiceBindingParams) SetIdentity(Identity []string) (*ListServiceBindingParams){ + params.Identity = &Identity + return params } -func (params *ListServiceBindingParams) SetPageSize(PageSize int) *ListServiceBindingParams { - params.PageSize = &PageSize - return params +func (params *ListServiceBindingParams) SetPageSize(PageSize int) (*ListServiceBindingParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceBindingParams) SetLimit(Limit int) *ListServiceBindingParams { - params.Limit = &Limit - return params +func (params *ListServiceBindingParams) SetLimit(Limit int) (*ListServiceBindingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceBinding records from the API. Request is executed immediately. func (c *ApiService) PageServiceBinding(ChatServiceSid string, params *ListServiceBindingParams, pageToken, pageNumber string) (*ListServiceBindingResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Bindings" - - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BindingType != nil { - for _, item := range *params.BindingType { - data.Add("BindingType", item) - } - } - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Bindings" + + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BindingType != nil { + for _, item := range *params.BindingType { + data.Add("BindingType", item) + } + } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists ServiceBinding records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -178,6 +182,7 @@ func (c *ApiService) StreamServiceBinding(ChatServiceSid string, params *ListSer return recordChannel, errorChannel } + func (c *ApiService) streamServiceBinding(response *ListServiceBindingResponse, params *ListServiceBindingParams, recordChannel chan ConversationsV1ServiceBinding, errorChannel chan error) { curRecord := 1 @@ -209,19 +214,20 @@ func (c *ApiService) streamServiceBinding(response *ListServiceBindingResponse, } func (c *ApiService) getNextListServiceBindingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/conversations/v1/services_configuration.go b/rest/conversations/v1/services_configuration.go index 6c5579d0b..20d86d9a1 100644 --- a/rest/conversations/v1/services_configuration.go +++ b/rest/conversations/v1/services_configuration.go @@ -18,93 +18,98 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch the configuration of a conversation service -func (c *ApiService) FetchServiceConfiguration(ChatServiceSid string) (*ConversationsV1ServiceConfiguration, error) { - path := "/v1/Services/{ChatServiceSid}/Configuration" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) +func (c *ApiService) FetchServiceConfiguration(ChatServiceSid string, ) (*ConversationsV1ServiceConfiguration, error) { + path := "/v1/Services/{ChatServiceSid}/Configuration" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateServiceConfiguration' type UpdateServiceConfigurationParams struct { - // The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. - DefaultConversationCreatorRoleSid *string `json:"DefaultConversationCreatorRoleSid,omitempty"` - // The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. - DefaultConversationRoleSid *string `json:"DefaultConversationRoleSid,omitempty"` - // The service-level role assigned to users when they are added to the service. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. - DefaultChatServiceRoleSid *string `json:"DefaultChatServiceRoleSid,omitempty"` - // Whether the [Reachability Indicator](https://www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`. - ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` + // The conversation-level role assigned to a conversation creator when they join a new conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + DefaultConversationCreatorRoleSid *string `json:"DefaultConversationCreatorRoleSid,omitempty"` + // The conversation-level role assigned to users when they are added to a conversation. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + DefaultConversationRoleSid *string `json:"DefaultConversationRoleSid,omitempty"` + // The service-level role assigned to users when they are added to the service. See [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + DefaultChatServiceRoleSid *string `json:"DefaultChatServiceRoleSid,omitempty"` + // Whether the [Reachability Indicator](https://www.twilio.com/docs/conversations/reachability) is enabled for this Conversations Service. The default is `false`. + ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` } -func (params *UpdateServiceConfigurationParams) SetDefaultConversationCreatorRoleSid(DefaultConversationCreatorRoleSid string) *UpdateServiceConfigurationParams { - params.DefaultConversationCreatorRoleSid = &DefaultConversationCreatorRoleSid - return params +func (params *UpdateServiceConfigurationParams) SetDefaultConversationCreatorRoleSid(DefaultConversationCreatorRoleSid string) (*UpdateServiceConfigurationParams){ + params.DefaultConversationCreatorRoleSid = &DefaultConversationCreatorRoleSid + return params } -func (params *UpdateServiceConfigurationParams) SetDefaultConversationRoleSid(DefaultConversationRoleSid string) *UpdateServiceConfigurationParams { - params.DefaultConversationRoleSid = &DefaultConversationRoleSid - return params +func (params *UpdateServiceConfigurationParams) SetDefaultConversationRoleSid(DefaultConversationRoleSid string) (*UpdateServiceConfigurationParams){ + params.DefaultConversationRoleSid = &DefaultConversationRoleSid + return params } -func (params *UpdateServiceConfigurationParams) SetDefaultChatServiceRoleSid(DefaultChatServiceRoleSid string) *UpdateServiceConfigurationParams { - params.DefaultChatServiceRoleSid = &DefaultChatServiceRoleSid - return params +func (params *UpdateServiceConfigurationParams) SetDefaultChatServiceRoleSid(DefaultChatServiceRoleSid string) (*UpdateServiceConfigurationParams){ + params.DefaultChatServiceRoleSid = &DefaultChatServiceRoleSid + return params } -func (params *UpdateServiceConfigurationParams) SetReachabilityEnabled(ReachabilityEnabled bool) *UpdateServiceConfigurationParams { - params.ReachabilityEnabled = &ReachabilityEnabled - return params +func (params *UpdateServiceConfigurationParams) SetReachabilityEnabled(ReachabilityEnabled bool) (*UpdateServiceConfigurationParams){ + params.ReachabilityEnabled = &ReachabilityEnabled + return params } // Update configuration settings of a conversation service func (c *ApiService) UpdateServiceConfiguration(ChatServiceSid string, params *UpdateServiceConfigurationParams) (*ConversationsV1ServiceConfiguration, error) { - path := "/v1/Services/{ChatServiceSid}/Configuration" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DefaultConversationCreatorRoleSid != nil { - data.Set("DefaultConversationCreatorRoleSid", *params.DefaultConversationCreatorRoleSid) - } - if params != nil && params.DefaultConversationRoleSid != nil { - data.Set("DefaultConversationRoleSid", *params.DefaultConversationRoleSid) - } - if params != nil && params.DefaultChatServiceRoleSid != nil { - data.Set("DefaultChatServiceRoleSid", *params.DefaultChatServiceRoleSid) - } - if params != nil && params.ReachabilityEnabled != nil { - data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Configuration" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DefaultConversationCreatorRoleSid != nil { + data.Set("DefaultConversationCreatorRoleSid", *params.DefaultConversationCreatorRoleSid) + } + if params != nil && params.DefaultConversationRoleSid != nil { + data.Set("DefaultConversationRoleSid", *params.DefaultConversationRoleSid) + } + if params != nil && params.DefaultChatServiceRoleSid != nil { + data.Set("DefaultChatServiceRoleSid", *params.DefaultChatServiceRoleSid) + } + if params != nil && params.ReachabilityEnabled != nil { + data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/services_configuration_notifications.go b/rest/conversations/v1/services_configuration_notifications.go index 18218bdeb..fcb1efeaf 100644 --- a/rest/conversations/v1/services_configuration_notifications.go +++ b/rest/conversations/v1/services_configuration_notifications.go @@ -18,174 +18,179 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch push notification service settings -func (c *ApiService) FetchServiceNotification(ChatServiceSid string) (*ConversationsV1ServiceNotification, error) { - path := "/v1/Services/{ChatServiceSid}/Configuration/Notifications" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) +func (c *ApiService) FetchServiceNotification(ChatServiceSid string, ) (*ConversationsV1ServiceNotification, error) { + path := "/v1/Services/{ChatServiceSid}/Configuration/Notifications" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceNotification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceNotification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateServiceNotification' type UpdateServiceNotificationParams struct { - // Weather the notification logging is enabled. - LogEnabled *bool `json:"LogEnabled,omitempty"` - // Whether to send a notification when a new message is added to a conversation. The default is `false`. - NewMessageEnabled *bool `json:"NewMessage.Enabled,omitempty"` - // The template to use to create the notification text displayed when a new message is added to a conversation and `new_message.enabled` is `true`. - NewMessageTemplate *string `json:"NewMessage.Template,omitempty"` - // The name of the sound to play when a new message is added to a conversation and `new_message.enabled` is `true`. - NewMessageSound *string `json:"NewMessage.Sound,omitempty"` - // Whether the new message badge is enabled. The default is `false`. - NewMessageBadgeCountEnabled *bool `json:"NewMessage.BadgeCountEnabled,omitempty"` - // Whether to send a notification when a participant is added to a conversation. The default is `false`. - AddedToConversationEnabled *bool `json:"AddedToConversation.Enabled,omitempty"` - // The template to use to create the notification text displayed when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. - AddedToConversationTemplate *string `json:"AddedToConversation.Template,omitempty"` - // The name of the sound to play when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. - AddedToConversationSound *string `json:"AddedToConversation.Sound,omitempty"` - // Whether to send a notification to a user when they are removed from a conversation. The default is `false`. - RemovedFromConversationEnabled *bool `json:"RemovedFromConversation.Enabled,omitempty"` - // The template to use to create the notification text displayed to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. - RemovedFromConversationTemplate *string `json:"RemovedFromConversation.Template,omitempty"` - // The name of the sound to play to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. - RemovedFromConversationSound *string `json:"RemovedFromConversation.Sound,omitempty"` - // Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is `false`. - NewMessageWithMediaEnabled *bool `json:"NewMessage.WithMedia.Enabled,omitempty"` - // The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation and `new_message.attachments.enabled` is `true`. - NewMessageWithMediaTemplate *string `json:"NewMessage.WithMedia.Template,omitempty"` -} - -func (params *UpdateServiceNotificationParams) SetLogEnabled(LogEnabled bool) *UpdateServiceNotificationParams { - params.LogEnabled = &LogEnabled - return params -} -func (params *UpdateServiceNotificationParams) SetNewMessageEnabled(NewMessageEnabled bool) *UpdateServiceNotificationParams { - params.NewMessageEnabled = &NewMessageEnabled - return params -} -func (params *UpdateServiceNotificationParams) SetNewMessageTemplate(NewMessageTemplate string) *UpdateServiceNotificationParams { - params.NewMessageTemplate = &NewMessageTemplate - return params -} -func (params *UpdateServiceNotificationParams) SetNewMessageSound(NewMessageSound string) *UpdateServiceNotificationParams { - params.NewMessageSound = &NewMessageSound - return params -} -func (params *UpdateServiceNotificationParams) SetNewMessageBadgeCountEnabled(NewMessageBadgeCountEnabled bool) *UpdateServiceNotificationParams { - params.NewMessageBadgeCountEnabled = &NewMessageBadgeCountEnabled - return params -} -func (params *UpdateServiceNotificationParams) SetAddedToConversationEnabled(AddedToConversationEnabled bool) *UpdateServiceNotificationParams { - params.AddedToConversationEnabled = &AddedToConversationEnabled - return params -} -func (params *UpdateServiceNotificationParams) SetAddedToConversationTemplate(AddedToConversationTemplate string) *UpdateServiceNotificationParams { - params.AddedToConversationTemplate = &AddedToConversationTemplate - return params -} -func (params *UpdateServiceNotificationParams) SetAddedToConversationSound(AddedToConversationSound string) *UpdateServiceNotificationParams { - params.AddedToConversationSound = &AddedToConversationSound - return params -} -func (params *UpdateServiceNotificationParams) SetRemovedFromConversationEnabled(RemovedFromConversationEnabled bool) *UpdateServiceNotificationParams { - params.RemovedFromConversationEnabled = &RemovedFromConversationEnabled - return params -} -func (params *UpdateServiceNotificationParams) SetRemovedFromConversationTemplate(RemovedFromConversationTemplate string) *UpdateServiceNotificationParams { - params.RemovedFromConversationTemplate = &RemovedFromConversationTemplate - return params -} -func (params *UpdateServiceNotificationParams) SetRemovedFromConversationSound(RemovedFromConversationSound string) *UpdateServiceNotificationParams { - params.RemovedFromConversationSound = &RemovedFromConversationSound - return params -} -func (params *UpdateServiceNotificationParams) SetNewMessageWithMediaEnabled(NewMessageWithMediaEnabled bool) *UpdateServiceNotificationParams { - params.NewMessageWithMediaEnabled = &NewMessageWithMediaEnabled - return params -} -func (params *UpdateServiceNotificationParams) SetNewMessageWithMediaTemplate(NewMessageWithMediaTemplate string) *UpdateServiceNotificationParams { - params.NewMessageWithMediaTemplate = &NewMessageWithMediaTemplate - return params + // Weather the notification logging is enabled. + LogEnabled *bool `json:"LogEnabled,omitempty"` + // Whether to send a notification when a new message is added to a conversation. The default is `false`. + NewMessageEnabled *bool `json:"NewMessage.Enabled,omitempty"` + // The template to use to create the notification text displayed when a new message is added to a conversation and `new_message.enabled` is `true`. + NewMessageTemplate *string `json:"NewMessage.Template,omitempty"` + // The name of the sound to play when a new message is added to a conversation and `new_message.enabled` is `true`. + NewMessageSound *string `json:"NewMessage.Sound,omitempty"` + // Whether the new message badge is enabled. The default is `false`. + NewMessageBadgeCountEnabled *bool `json:"NewMessage.BadgeCountEnabled,omitempty"` + // Whether to send a notification when a participant is added to a conversation. The default is `false`. + AddedToConversationEnabled *bool `json:"AddedToConversation.Enabled,omitempty"` + // The template to use to create the notification text displayed when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. + AddedToConversationTemplate *string `json:"AddedToConversation.Template,omitempty"` + // The name of the sound to play when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. + AddedToConversationSound *string `json:"AddedToConversation.Sound,omitempty"` + // Whether to send a notification to a user when they are removed from a conversation. The default is `false`. + RemovedFromConversationEnabled *bool `json:"RemovedFromConversation.Enabled,omitempty"` + // The template to use to create the notification text displayed to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. + RemovedFromConversationTemplate *string `json:"RemovedFromConversation.Template,omitempty"` + // The name of the sound to play to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. + RemovedFromConversationSound *string `json:"RemovedFromConversation.Sound,omitempty"` + // Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is `false`. + NewMessageWithMediaEnabled *bool `json:"NewMessage.WithMedia.Enabled,omitempty"` + // The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation and `new_message.attachments.enabled` is `true`. + NewMessageWithMediaTemplate *string `json:"NewMessage.WithMedia.Template,omitempty"` +} + +func (params *UpdateServiceNotificationParams) SetLogEnabled(LogEnabled bool) (*UpdateServiceNotificationParams){ + params.LogEnabled = &LogEnabled + return params +} +func (params *UpdateServiceNotificationParams) SetNewMessageEnabled(NewMessageEnabled bool) (*UpdateServiceNotificationParams){ + params.NewMessageEnabled = &NewMessageEnabled + return params +} +func (params *UpdateServiceNotificationParams) SetNewMessageTemplate(NewMessageTemplate string) (*UpdateServiceNotificationParams){ + params.NewMessageTemplate = &NewMessageTemplate + return params +} +func (params *UpdateServiceNotificationParams) SetNewMessageSound(NewMessageSound string) (*UpdateServiceNotificationParams){ + params.NewMessageSound = &NewMessageSound + return params +} +func (params *UpdateServiceNotificationParams) SetNewMessageBadgeCountEnabled(NewMessageBadgeCountEnabled bool) (*UpdateServiceNotificationParams){ + params.NewMessageBadgeCountEnabled = &NewMessageBadgeCountEnabled + return params +} +func (params *UpdateServiceNotificationParams) SetAddedToConversationEnabled(AddedToConversationEnabled bool) (*UpdateServiceNotificationParams){ + params.AddedToConversationEnabled = &AddedToConversationEnabled + return params +} +func (params *UpdateServiceNotificationParams) SetAddedToConversationTemplate(AddedToConversationTemplate string) (*UpdateServiceNotificationParams){ + params.AddedToConversationTemplate = &AddedToConversationTemplate + return params +} +func (params *UpdateServiceNotificationParams) SetAddedToConversationSound(AddedToConversationSound string) (*UpdateServiceNotificationParams){ + params.AddedToConversationSound = &AddedToConversationSound + return params +} +func (params *UpdateServiceNotificationParams) SetRemovedFromConversationEnabled(RemovedFromConversationEnabled bool) (*UpdateServiceNotificationParams){ + params.RemovedFromConversationEnabled = &RemovedFromConversationEnabled + return params +} +func (params *UpdateServiceNotificationParams) SetRemovedFromConversationTemplate(RemovedFromConversationTemplate string) (*UpdateServiceNotificationParams){ + params.RemovedFromConversationTemplate = &RemovedFromConversationTemplate + return params +} +func (params *UpdateServiceNotificationParams) SetRemovedFromConversationSound(RemovedFromConversationSound string) (*UpdateServiceNotificationParams){ + params.RemovedFromConversationSound = &RemovedFromConversationSound + return params +} +func (params *UpdateServiceNotificationParams) SetNewMessageWithMediaEnabled(NewMessageWithMediaEnabled bool) (*UpdateServiceNotificationParams){ + params.NewMessageWithMediaEnabled = &NewMessageWithMediaEnabled + return params +} +func (params *UpdateServiceNotificationParams) SetNewMessageWithMediaTemplate(NewMessageWithMediaTemplate string) (*UpdateServiceNotificationParams){ + params.NewMessageWithMediaTemplate = &NewMessageWithMediaTemplate + return params } // Update push notification service settings func (c *ApiService) UpdateServiceNotification(ChatServiceSid string, params *UpdateServiceNotificationParams) (*ConversationsV1ServiceNotification, error) { - path := "/v1/Services/{ChatServiceSid}/Configuration/Notifications" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.LogEnabled != nil { - data.Set("LogEnabled", fmt.Sprint(*params.LogEnabled)) - } - if params != nil && params.NewMessageEnabled != nil { - data.Set("NewMessage.Enabled", fmt.Sprint(*params.NewMessageEnabled)) - } - if params != nil && params.NewMessageTemplate != nil { - data.Set("NewMessage.Template", *params.NewMessageTemplate) - } - if params != nil && params.NewMessageSound != nil { - data.Set("NewMessage.Sound", *params.NewMessageSound) - } - if params != nil && params.NewMessageBadgeCountEnabled != nil { - data.Set("NewMessage.BadgeCountEnabled", fmt.Sprint(*params.NewMessageBadgeCountEnabled)) - } - if params != nil && params.AddedToConversationEnabled != nil { - data.Set("AddedToConversation.Enabled", fmt.Sprint(*params.AddedToConversationEnabled)) - } - if params != nil && params.AddedToConversationTemplate != nil { - data.Set("AddedToConversation.Template", *params.AddedToConversationTemplate) - } - if params != nil && params.AddedToConversationSound != nil { - data.Set("AddedToConversation.Sound", *params.AddedToConversationSound) - } - if params != nil && params.RemovedFromConversationEnabled != nil { - data.Set("RemovedFromConversation.Enabled", fmt.Sprint(*params.RemovedFromConversationEnabled)) - } - if params != nil && params.RemovedFromConversationTemplate != nil { - data.Set("RemovedFromConversation.Template", *params.RemovedFromConversationTemplate) - } - if params != nil && params.RemovedFromConversationSound != nil { - data.Set("RemovedFromConversation.Sound", *params.RemovedFromConversationSound) - } - if params != nil && params.NewMessageWithMediaEnabled != nil { - data.Set("NewMessage.WithMedia.Enabled", fmt.Sprint(*params.NewMessageWithMediaEnabled)) - } - if params != nil && params.NewMessageWithMediaTemplate != nil { - data.Set("NewMessage.WithMedia.Template", *params.NewMessageWithMediaTemplate) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceNotification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Configuration/Notifications" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.LogEnabled != nil { + data.Set("LogEnabled", fmt.Sprint(*params.LogEnabled)) + } + if params != nil && params.NewMessageEnabled != nil { + data.Set("NewMessage.Enabled", fmt.Sprint(*params.NewMessageEnabled)) + } + if params != nil && params.NewMessageTemplate != nil { + data.Set("NewMessage.Template", *params.NewMessageTemplate) + } + if params != nil && params.NewMessageSound != nil { + data.Set("NewMessage.Sound", *params.NewMessageSound) + } + if params != nil && params.NewMessageBadgeCountEnabled != nil { + data.Set("NewMessage.BadgeCountEnabled", fmt.Sprint(*params.NewMessageBadgeCountEnabled)) + } + if params != nil && params.AddedToConversationEnabled != nil { + data.Set("AddedToConversation.Enabled", fmt.Sprint(*params.AddedToConversationEnabled)) + } + if params != nil && params.AddedToConversationTemplate != nil { + data.Set("AddedToConversation.Template", *params.AddedToConversationTemplate) + } + if params != nil && params.AddedToConversationSound != nil { + data.Set("AddedToConversation.Sound", *params.AddedToConversationSound) + } + if params != nil && params.RemovedFromConversationEnabled != nil { + data.Set("RemovedFromConversation.Enabled", fmt.Sprint(*params.RemovedFromConversationEnabled)) + } + if params != nil && params.RemovedFromConversationTemplate != nil { + data.Set("RemovedFromConversation.Template", *params.RemovedFromConversationTemplate) + } + if params != nil && params.RemovedFromConversationSound != nil { + data.Set("RemovedFromConversation.Sound", *params.RemovedFromConversationSound) + } + if params != nil && params.NewMessageWithMediaEnabled != nil { + data.Set("NewMessage.WithMedia.Enabled", fmt.Sprint(*params.NewMessageWithMediaEnabled)) + } + if params != nil && params.NewMessageWithMediaTemplate != nil { + data.Set("NewMessage.WithMedia.Template", *params.NewMessageWithMediaTemplate) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceNotification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/services_configuration_webhooks.go b/rest/conversations/v1/services_configuration_webhooks.go index 8f2504f3a..7aea8156c 100644 --- a/rest/conversations/v1/services_configuration_webhooks.go +++ b/rest/conversations/v1/services_configuration_webhooks.go @@ -16,96 +16,102 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch a specific service webhook configuration. -func (c *ApiService) FetchServiceWebhookConfiguration(ChatServiceSid string) (*ConversationsV1ServiceWebhookConfiguration, error) { - path := "/v1/Services/{ChatServiceSid}/Configuration/Webhooks" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) +func (c *ApiService) FetchServiceWebhookConfiguration(ChatServiceSid string, ) (*ConversationsV1ServiceWebhookConfiguration, error) { + path := "/v1/Services/{ChatServiceSid}/Configuration/Webhooks" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceWebhookConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceWebhookConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateServiceWebhookConfiguration' type UpdateServiceWebhookConfigurationParams struct { - // The absolute url the pre-event webhook request should be sent to. - PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` - // The absolute url the post-event webhook request should be sent to. - PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` - // The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. - Filters *[]string `json:"Filters,omitempty"` - // The HTTP method to be used when sending a webhook request. One of `GET` or `POST`. - Method *string `json:"Method,omitempty"` + // The absolute url the pre-event webhook request should be sent to. + PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` + // The absolute url the post-event webhook request should be sent to. + PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` + // The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. + Filters *[]string `json:"Filters,omitempty"` + // The HTTP method to be used when sending a webhook request. One of `GET` or `POST`. + Method *string `json:"Method,omitempty"` } -func (params *UpdateServiceWebhookConfigurationParams) SetPreWebhookUrl(PreWebhookUrl string) *UpdateServiceWebhookConfigurationParams { - params.PreWebhookUrl = &PreWebhookUrl - return params +func (params *UpdateServiceWebhookConfigurationParams) SetPreWebhookUrl(PreWebhookUrl string) (*UpdateServiceWebhookConfigurationParams){ + params.PreWebhookUrl = &PreWebhookUrl + return params } -func (params *UpdateServiceWebhookConfigurationParams) SetPostWebhookUrl(PostWebhookUrl string) *UpdateServiceWebhookConfigurationParams { - params.PostWebhookUrl = &PostWebhookUrl - return params +func (params *UpdateServiceWebhookConfigurationParams) SetPostWebhookUrl(PostWebhookUrl string) (*UpdateServiceWebhookConfigurationParams){ + params.PostWebhookUrl = &PostWebhookUrl + return params } -func (params *UpdateServiceWebhookConfigurationParams) SetFilters(Filters []string) *UpdateServiceWebhookConfigurationParams { - params.Filters = &Filters - return params +func (params *UpdateServiceWebhookConfigurationParams) SetFilters(Filters []string) (*UpdateServiceWebhookConfigurationParams){ + params.Filters = &Filters + return params } -func (params *UpdateServiceWebhookConfigurationParams) SetMethod(Method string) *UpdateServiceWebhookConfigurationParams { - params.Method = &Method - return params +func (params *UpdateServiceWebhookConfigurationParams) SetMethod(Method string) (*UpdateServiceWebhookConfigurationParams){ + params.Method = &Method + return params } // Update a specific Webhook. func (c *ApiService) UpdateServiceWebhookConfiguration(ChatServiceSid string, params *UpdateServiceWebhookConfigurationParams) (*ConversationsV1ServiceWebhookConfiguration, error) { - path := "/v1/Services/{ChatServiceSid}/Configuration/Webhooks" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PreWebhookUrl != nil { - data.Set("PreWebhookUrl", *params.PreWebhookUrl) - } - if params != nil && params.PostWebhookUrl != nil { - data.Set("PostWebhookUrl", *params.PostWebhookUrl) - } - if params != nil && params.Filters != nil { - for _, item := range *params.Filters { - data.Add("Filters", item) - } - } - if params != nil && params.Method != nil { - data.Set("Method", *params.Method) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceWebhookConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Configuration/Webhooks" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PreWebhookUrl != nil { + data.Set("PreWebhookUrl", *params.PreWebhookUrl) + } + if params != nil && params.PostWebhookUrl != nil { + data.Set("PostWebhookUrl", *params.PostWebhookUrl) + } + if params != nil && params.Filters != nil { + for _, item := range *params.Filters { + data.Add("Filters", item) + } + } + if params != nil && params.Method != nil { + data.Set("Method", *params.Method) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceWebhookConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/services_conversations.go b/rest/conversations/v1/services_conversations.go index 219bb97d5..e21b244bb 100644 --- a/rest/conversations/v1/services_conversations.go +++ b/rest/conversations/v1/services_conversations.go @@ -18,285 +18,287 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateServiceConversation' type CreateServiceConversationParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - UniqueName *string `json:"UniqueName,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - State *string `json:"State,omitempty"` - // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. - TimersInactive *string `json:"Timers.Inactive,omitempty"` - // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. - TimersClosed *string `json:"Timers.Closed,omitempty"` - // The default email address that will be used when sending outbound emails in this conversation. - BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` - // The default name that will be used when sending outbound emails in this conversation. - BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` -} - -func (params *CreateServiceConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateServiceConversationParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateServiceConversationParams) SetFriendlyName(FriendlyName string) *CreateServiceConversationParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateServiceConversationParams) SetUniqueName(UniqueName string) *CreateServiceConversationParams { - params.UniqueName = &UniqueName - return params -} -func (params *CreateServiceConversationParams) SetAttributes(Attributes string) *CreateServiceConversationParams { - params.Attributes = &Attributes - return params -} -func (params *CreateServiceConversationParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateServiceConversationParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *CreateServiceConversationParams) SetDateCreated(DateCreated time.Time) *CreateServiceConversationParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateServiceConversationParams) SetDateUpdated(DateUpdated time.Time) *CreateServiceConversationParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateServiceConversationParams) SetState(State string) *CreateServiceConversationParams { - params.State = &State - return params -} -func (params *CreateServiceConversationParams) SetTimersInactive(TimersInactive string) *CreateServiceConversationParams { - params.TimersInactive = &TimersInactive - return params -} -func (params *CreateServiceConversationParams) SetTimersClosed(TimersClosed string) *CreateServiceConversationParams { - params.TimersClosed = &TimersClosed - return params -} -func (params *CreateServiceConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) *CreateServiceConversationParams { - params.BindingsEmailAddress = &BindingsEmailAddress - return params -} -func (params *CreateServiceConversationParams) SetBindingsEmailName(BindingsEmailName string) *CreateServiceConversationParams { - params.BindingsEmailName = &BindingsEmailName - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"UniqueName,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + State *string `json:"State,omitempty"` + // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + TimersInactive *string `json:"Timers.Inactive,omitempty"` + // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + TimersClosed *string `json:"Timers.Closed,omitempty"` + // The default email address that will be used when sending outbound emails in this conversation. + BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` + // The default name that will be used when sending outbound emails in this conversation. + BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` +} + +func (params *CreateServiceConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateServiceConversationParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateServiceConversationParams) SetFriendlyName(FriendlyName string) (*CreateServiceConversationParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateServiceConversationParams) SetUniqueName(UniqueName string) (*CreateServiceConversationParams){ + params.UniqueName = &UniqueName + return params +} +func (params *CreateServiceConversationParams) SetAttributes(Attributes string) (*CreateServiceConversationParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateServiceConversationParams) SetMessagingServiceSid(MessagingServiceSid string) (*CreateServiceConversationParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *CreateServiceConversationParams) SetDateCreated(DateCreated time.Time) (*CreateServiceConversationParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateServiceConversationParams) SetDateUpdated(DateUpdated time.Time) (*CreateServiceConversationParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateServiceConversationParams) SetState(State string) (*CreateServiceConversationParams){ + params.State = &State + return params +} +func (params *CreateServiceConversationParams) SetTimersInactive(TimersInactive string) (*CreateServiceConversationParams){ + params.TimersInactive = &TimersInactive + return params +} +func (params *CreateServiceConversationParams) SetTimersClosed(TimersClosed string) (*CreateServiceConversationParams){ + params.TimersClosed = &TimersClosed + return params +} +func (params *CreateServiceConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) (*CreateServiceConversationParams){ + params.BindingsEmailAddress = &BindingsEmailAddress + return params +} +func (params *CreateServiceConversationParams) SetBindingsEmailName(BindingsEmailName string) (*CreateServiceConversationParams){ + params.BindingsEmailName = &BindingsEmailName + return params } // Create a new conversation in your service func (c *ApiService) CreateServiceConversation(ChatServiceSid string, params *CreateServiceConversationParams) (*ConversationsV1ServiceConversation, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path := "/v1/Services/{ChatServiceSid}/Conversations" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.TimersInactive != nil { + data.Set("Timers.Inactive", *params.TimersInactive) + } + if params != nil && params.TimersClosed != nil { + data.Set("Timers.Closed", *params.TimersClosed) + } + if params != nil && params.BindingsEmailAddress != nil { + data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) + } + if params != nil && params.BindingsEmailName != nil { + data.Set("Bindings.Email.Name", *params.BindingsEmailName) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.TimersInactive != nil { - data.Set("Timers.Inactive", *params.TimersInactive) - } - if params != nil && params.TimersClosed != nil { - data.Set("Timers.Closed", *params.TimersClosed) - } - if params != nil && params.BindingsEmailAddress != nil { - data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) - } - if params != nil && params.BindingsEmailName != nil { - data.Set("Bindings.Email.Name", *params.BindingsEmailName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteServiceConversation' type DeleteServiceConversationParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteServiceConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteServiceConversationParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteServiceConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteServiceConversationParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a conversation from your service -func (c *ApiService) DeleteServiceConversation(ChatServiceSid string, Sid string, params *DeleteServiceConversationParams) error { - path := "/v1/Services/{ChatServiceSid}/Conversations/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceConversation(ChatServiceSid string, Sid string, params *DeleteServiceConversationParams) (error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Fetch a conversation from your service -func (c *ApiService) FetchServiceConversation(ChatServiceSid string, Sid string) (*ConversationsV1ServiceConversation, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceConversation(ChatServiceSid string, Sid string, ) (*ConversationsV1ServiceConversation, error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ServiceConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceConversation' type ListServiceConversationParams struct { - // Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. - StartDate *string `json:"StartDate,omitempty"` - // End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. - EndDate *string `json:"EndDate,omitempty"` - // State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` - State *string `json:"State,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Start date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the start time of the date is used (YYYY-MM-DDT00:00:00Z). Can be combined with other filters. + StartDate *string `json:"StartDate,omitempty"` + // End date or time in ISO8601 format for filtering list of Conversations. If a date is provided, the end time of the date is used (YYYY-MM-DDT23:59:59Z). Can be combined with other filters. + EndDate *string `json:"EndDate,omitempty"` + // State for sorting and filtering list of Conversations. Can be `active`, `inactive` or `closed` + State *string `json:"State,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceConversationParams) SetStartDate(StartDate string) *ListServiceConversationParams { - params.StartDate = &StartDate - return params +func (params *ListServiceConversationParams) SetStartDate(StartDate string) (*ListServiceConversationParams){ + params.StartDate = &StartDate + return params } -func (params *ListServiceConversationParams) SetEndDate(EndDate string) *ListServiceConversationParams { - params.EndDate = &EndDate - return params +func (params *ListServiceConversationParams) SetEndDate(EndDate string) (*ListServiceConversationParams){ + params.EndDate = &EndDate + return params } -func (params *ListServiceConversationParams) SetState(State string) *ListServiceConversationParams { - params.State = &State - return params +func (params *ListServiceConversationParams) SetState(State string) (*ListServiceConversationParams){ + params.State = &State + return params } -func (params *ListServiceConversationParams) SetPageSize(PageSize int) *ListServiceConversationParams { - params.PageSize = &PageSize - return params +func (params *ListServiceConversationParams) SetPageSize(PageSize int) (*ListServiceConversationParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceConversationParams) SetLimit(Limit int) *ListServiceConversationParams { - params.Limit = &Limit - return params +func (params *ListServiceConversationParams) SetLimit(Limit int) (*ListServiceConversationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceConversation records from the API. Request is executed immediately. func (c *ApiService) PageServiceConversation(ChatServiceSid string, params *ListServiceConversationParams, pageToken, pageNumber string) (*ListServiceConversationResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations" + path := "/v1/Services/{ChatServiceSid}/Conversations" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.StartDate != nil { - data.Set("StartDate", *params.StartDate) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", *params.EndDate) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.StartDate != nil { + data.Set("StartDate", *params.StartDate) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", *params.EndDate) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceConversation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -337,6 +339,7 @@ func (c *ApiService) StreamServiceConversation(ChatServiceSid string, params *Li return recordChannel, errorChannel } + func (c *ApiService) streamServiceConversation(response *ListServiceConversationResponse, params *ListServiceConversationParams, recordChannel chan ConversationsV1ServiceConversation, errorChannel chan error) { curRecord := 1 @@ -368,158 +371,159 @@ func (c *ApiService) streamServiceConversation(response *ListServiceConversation } func (c *ApiService) getNextListServiceConversationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceConversation' type UpdateServiceConversationParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The human-readable name of this conversation, limited to 256 characters. Optional. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // - State *string `json:"State,omitempty"` - // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. - TimersInactive *string `json:"Timers.Inactive,omitempty"` - // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. - TimersClosed *string `json:"Timers.Closed,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - UniqueName *string `json:"UniqueName,omitempty"` - // The default email address that will be used when sending outbound emails in this conversation. - BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` - // The default name that will be used when sending outbound emails in this conversation. - BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` -} - -func (params *UpdateServiceConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateServiceConversationParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateServiceConversationParams) SetFriendlyName(FriendlyName string) *UpdateServiceConversationParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceConversationParams) SetDateCreated(DateCreated time.Time) *UpdateServiceConversationParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateServiceConversationParams) SetDateUpdated(DateUpdated time.Time) *UpdateServiceConversationParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateServiceConversationParams) SetAttributes(Attributes string) *UpdateServiceConversationParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateServiceConversationParams) SetMessagingServiceSid(MessagingServiceSid string) *UpdateServiceConversationParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *UpdateServiceConversationParams) SetState(State string) *UpdateServiceConversationParams { - params.State = &State - return params -} -func (params *UpdateServiceConversationParams) SetTimersInactive(TimersInactive string) *UpdateServiceConversationParams { - params.TimersInactive = &TimersInactive - return params -} -func (params *UpdateServiceConversationParams) SetTimersClosed(TimersClosed string) *UpdateServiceConversationParams { - params.TimersClosed = &TimersClosed - return params -} -func (params *UpdateServiceConversationParams) SetUniqueName(UniqueName string) *UpdateServiceConversationParams { - params.UniqueName = &UniqueName - return params -} -func (params *UpdateServiceConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) *UpdateServiceConversationParams { - params.BindingsEmailAddress = &BindingsEmailAddress - return params -} -func (params *UpdateServiceConversationParams) SetBindingsEmailName(BindingsEmailName string) *UpdateServiceConversationParams { - params.BindingsEmailName = &BindingsEmailName - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The human-readable name of this conversation, limited to 256 characters. Optional. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // + State *string `json:"State,omitempty"` + // ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + TimersInactive *string `json:"Timers.Inactive,omitempty"` + // ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + TimersClosed *string `json:"Timers.Closed,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + UniqueName *string `json:"UniqueName,omitempty"` + // The default email address that will be used when sending outbound emails in this conversation. + BindingsEmailAddress *string `json:"Bindings.Email.Address,omitempty"` + // The default name that will be used when sending outbound emails in this conversation. + BindingsEmailName *string `json:"Bindings.Email.Name,omitempty"` +} + +func (params *UpdateServiceConversationParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateServiceConversationParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateServiceConversationParams) SetFriendlyName(FriendlyName string) (*UpdateServiceConversationParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceConversationParams) SetDateCreated(DateCreated time.Time) (*UpdateServiceConversationParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateServiceConversationParams) SetDateUpdated(DateUpdated time.Time) (*UpdateServiceConversationParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateServiceConversationParams) SetAttributes(Attributes string) (*UpdateServiceConversationParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateServiceConversationParams) SetMessagingServiceSid(MessagingServiceSid string) (*UpdateServiceConversationParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *UpdateServiceConversationParams) SetState(State string) (*UpdateServiceConversationParams){ + params.State = &State + return params +} +func (params *UpdateServiceConversationParams) SetTimersInactive(TimersInactive string) (*UpdateServiceConversationParams){ + params.TimersInactive = &TimersInactive + return params +} +func (params *UpdateServiceConversationParams) SetTimersClosed(TimersClosed string) (*UpdateServiceConversationParams){ + params.TimersClosed = &TimersClosed + return params +} +func (params *UpdateServiceConversationParams) SetUniqueName(UniqueName string) (*UpdateServiceConversationParams){ + params.UniqueName = &UniqueName + return params +} +func (params *UpdateServiceConversationParams) SetBindingsEmailAddress(BindingsEmailAddress string) (*UpdateServiceConversationParams){ + params.BindingsEmailAddress = &BindingsEmailAddress + return params +} +func (params *UpdateServiceConversationParams) SetBindingsEmailName(BindingsEmailName string) (*UpdateServiceConversationParams){ + params.BindingsEmailName = &BindingsEmailName + return params } // Update an existing conversation in your service func (c *ApiService) UpdateServiceConversation(ChatServiceSid string, Sid string, params *UpdateServiceConversationParams) (*ConversationsV1ServiceConversation, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Services/{ChatServiceSid}/Conversations/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.TimersInactive != nil { + data.Set("Timers.Inactive", *params.TimersInactive) + } + if params != nil && params.TimersClosed != nil { + data.Set("Timers.Closed", *params.TimersClosed) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.BindingsEmailAddress != nil { + data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) + } + if params != nil && params.BindingsEmailName != nil { + data.Set("Bindings.Email.Name", *params.BindingsEmailName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.TimersInactive != nil { - data.Set("Timers.Inactive", *params.TimersInactive) - } - if params != nil && params.TimersClosed != nil { - data.Set("Timers.Closed", *params.TimersClosed) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.BindingsEmailAddress != nil { - data.Set("Bindings.Email.Address", *params.BindingsEmailAddress) - } - if params != nil && params.BindingsEmailName != nil { - data.Set("Bindings.Email.Name", *params.BindingsEmailName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/services_conversations_messages.go b/rest/conversations/v1/services_conversations_messages.go index be944b1fc..56e322436 100644 --- a/rest/conversations/v1/services_conversations_messages.go +++ b/rest/conversations/v1/services_conversations_messages.go @@ -18,253 +18,255 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateServiceConversationMessage' type CreateServiceConversationMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The channel specific identifier of the message's author. Defaults to `system`. - Author *string `json:"Author,omitempty"` - // The content of the message, can be up to 1,600 characters long. - Body *string `json:"Body,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. `null` if the message has not been edited. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The Media SID to be attached to the new Message. - MediaSid *string `json:"MediaSid,omitempty"` - // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. - ContentSid *string `json:"ContentSid,omitempty"` - // A structurally valid JSON string that contains values to resolve Rich Content template variables. - ContentVariables *string `json:"ContentVariables,omitempty"` - // The subject of the message, can be up to 256 characters long. - Subject *string `json:"Subject,omitempty"` -} - -func (params *CreateServiceConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateServiceConversationMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateServiceConversationMessageParams) SetAuthor(Author string) *CreateServiceConversationMessageParams { - params.Author = &Author - return params -} -func (params *CreateServiceConversationMessageParams) SetBody(Body string) *CreateServiceConversationMessageParams { - params.Body = &Body - return params -} -func (params *CreateServiceConversationMessageParams) SetDateCreated(DateCreated time.Time) *CreateServiceConversationMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateServiceConversationMessageParams) SetDateUpdated(DateUpdated time.Time) *CreateServiceConversationMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateServiceConversationMessageParams) SetAttributes(Attributes string) *CreateServiceConversationMessageParams { - params.Attributes = &Attributes - return params -} -func (params *CreateServiceConversationMessageParams) SetMediaSid(MediaSid string) *CreateServiceConversationMessageParams { - params.MediaSid = &MediaSid - return params -} -func (params *CreateServiceConversationMessageParams) SetContentSid(ContentSid string) *CreateServiceConversationMessageParams { - params.ContentSid = &ContentSid - return params -} -func (params *CreateServiceConversationMessageParams) SetContentVariables(ContentVariables string) *CreateServiceConversationMessageParams { - params.ContentVariables = &ContentVariables - return params -} -func (params *CreateServiceConversationMessageParams) SetSubject(Subject string) *CreateServiceConversationMessageParams { - params.Subject = &Subject - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The channel specific identifier of the message's author. Defaults to `system`. + Author *string `json:"Author,omitempty"` + // The content of the message, can be up to 1,600 characters long. + Body *string `json:"Body,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. `null` if the message has not been edited. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The Media SID to be attached to the new Message. + MediaSid *string `json:"MediaSid,omitempty"` + // The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template, required for template-generated messages. **Note** that if this field is set, `Body` and `MediaSid` parameters are ignored. + ContentSid *string `json:"ContentSid,omitempty"` + // A structurally valid JSON string that contains values to resolve Rich Content template variables. + ContentVariables *string `json:"ContentVariables,omitempty"` + // The subject of the message, can be up to 256 characters long. + Subject *string `json:"Subject,omitempty"` +} + +func (params *CreateServiceConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateServiceConversationMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateServiceConversationMessageParams) SetAuthor(Author string) (*CreateServiceConversationMessageParams){ + params.Author = &Author + return params +} +func (params *CreateServiceConversationMessageParams) SetBody(Body string) (*CreateServiceConversationMessageParams){ + params.Body = &Body + return params +} +func (params *CreateServiceConversationMessageParams) SetDateCreated(DateCreated time.Time) (*CreateServiceConversationMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateServiceConversationMessageParams) SetDateUpdated(DateUpdated time.Time) (*CreateServiceConversationMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateServiceConversationMessageParams) SetAttributes(Attributes string) (*CreateServiceConversationMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateServiceConversationMessageParams) SetMediaSid(MediaSid string) (*CreateServiceConversationMessageParams){ + params.MediaSid = &MediaSid + return params +} +func (params *CreateServiceConversationMessageParams) SetContentSid(ContentSid string) (*CreateServiceConversationMessageParams){ + params.ContentSid = &ContentSid + return params +} +func (params *CreateServiceConversationMessageParams) SetContentVariables(ContentVariables string) (*CreateServiceConversationMessageParams){ + params.ContentVariables = &ContentVariables + return params +} +func (params *CreateServiceConversationMessageParams) SetSubject(Subject string) (*CreateServiceConversationMessageParams){ + params.Subject = &Subject + return params } // Add a new message to the conversation in a specific service func (c *ApiService) CreateServiceConversationMessage(ChatServiceSid string, ConversationSid string, params *CreateServiceConversationMessageParams) (*ConversationsV1ServiceConversationMessage, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Author != nil { + data.Set("Author", *params.Author) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MediaSid != nil { + data.Set("MediaSid", *params.MediaSid) + } + if params != nil && params.ContentSid != nil { + data.Set("ContentSid", *params.ContentSid) + } + if params != nil && params.ContentVariables != nil { + data.Set("ContentVariables", *params.ContentVariables) + } + if params != nil && params.Subject != nil { + data.Set("Subject", *params.Subject) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Author != nil { - data.Set("Author", *params.Author) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MediaSid != nil { - data.Set("MediaSid", *params.MediaSid) - } - if params != nil && params.ContentSid != nil { - data.Set("ContentSid", *params.ContentSid) - } - if params != nil && params.ContentVariables != nil { - data.Set("ContentVariables", *params.ContentVariables) - } - if params != nil && params.Subject != nil { - data.Set("Subject", *params.Subject) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceConversationMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConversationMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteServiceConversationMessage' type DeleteServiceConversationMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteServiceConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteServiceConversationMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteServiceConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteServiceConversationMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a message from the conversation -func (c *ApiService) DeleteServiceConversationMessage(ChatServiceSid string, ConversationSid string, Sid string, params *DeleteServiceConversationMessageParams) error { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceConversationMessage(ChatServiceSid string, ConversationSid string, Sid string, params *DeleteServiceConversationMessageParams) (error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } // Fetch a message from the conversation -func (c *ApiService) FetchServiceConversationMessage(ChatServiceSid string, ConversationSid string, Sid string) (*ConversationsV1ServiceConversationMessage, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceConversationMessage(ChatServiceSid string, ConversationSid string, Sid string, ) (*ConversationsV1ServiceConversationMessage, error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceConversationMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ConversationsV1ServiceConversationMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceConversationMessage' type ListServiceConversationMessageParams struct { - // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceConversationMessageParams) SetOrder(Order string) *ListServiceConversationMessageParams { - params.Order = &Order - return params +func (params *ListServiceConversationMessageParams) SetOrder(Order string) (*ListServiceConversationMessageParams){ + params.Order = &Order + return params } -func (params *ListServiceConversationMessageParams) SetPageSize(PageSize int) *ListServiceConversationMessageParams { - params.PageSize = &PageSize - return params +func (params *ListServiceConversationMessageParams) SetPageSize(PageSize int) (*ListServiceConversationMessageParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceConversationMessageParams) SetLimit(Limit int) *ListServiceConversationMessageParams { - params.Limit = &Limit - return params +func (params *ListServiceConversationMessageParams) SetLimit(Limit int) (*ListServiceConversationMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceConversationMessage records from the API. Request is executed immediately. func (c *ApiService) PageServiceConversationMessage(ChatServiceSid string, ConversationSid string, params *ListServiceConversationMessageParams, pageToken, pageNumber string) (*ListServiceConversationMessageResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages" + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceConversationMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceConversationMessage records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -305,6 +307,7 @@ func (c *ApiService) StreamServiceConversationMessage(ChatServiceSid string, Con return recordChannel, errorChannel } + func (c *ApiService) streamServiceConversationMessage(response *ListServiceConversationMessageResponse, params *ListServiceConversationMessageParams, recordChannel chan ConversationsV1ServiceConversationMessage, errorChannel chan error) { curRecord := 1 @@ -336,114 +339,115 @@ func (c *ApiService) streamServiceConversationMessage(response *ListServiceConve } func (c *ApiService) getNextListServiceConversationMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceConversationMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceConversationMessage' type UpdateServiceConversationMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The channel specific identifier of the message's author. Defaults to `system`. - Author *string `json:"Author,omitempty"` - // The content of the message, can be up to 1,600 characters long. - Body *string `json:"Body,omitempty"` - // The date that this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date that this resource was last updated. `null` if the message has not been edited. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The subject of the message, can be up to 256 characters long. - Subject *string `json:"Subject,omitempty"` -} - -func (params *UpdateServiceConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateServiceConversationMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateServiceConversationMessageParams) SetAuthor(Author string) *UpdateServiceConversationMessageParams { - params.Author = &Author - return params -} -func (params *UpdateServiceConversationMessageParams) SetBody(Body string) *UpdateServiceConversationMessageParams { - params.Body = &Body - return params -} -func (params *UpdateServiceConversationMessageParams) SetDateCreated(DateCreated time.Time) *UpdateServiceConversationMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateServiceConversationMessageParams) SetDateUpdated(DateUpdated time.Time) *UpdateServiceConversationMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateServiceConversationMessageParams) SetAttributes(Attributes string) *UpdateServiceConversationMessageParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateServiceConversationMessageParams) SetSubject(Subject string) *UpdateServiceConversationMessageParams { - params.Subject = &Subject - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The channel specific identifier of the message's author. Defaults to `system`. + Author *string `json:"Author,omitempty"` + // The content of the message, can be up to 1,600 characters long. + Body *string `json:"Body,omitempty"` + // The date that this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date that this resource was last updated. `null` if the message has not been edited. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The subject of the message, can be up to 256 characters long. + Subject *string `json:"Subject,omitempty"` +} + +func (params *UpdateServiceConversationMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateServiceConversationMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateServiceConversationMessageParams) SetAuthor(Author string) (*UpdateServiceConversationMessageParams){ + params.Author = &Author + return params +} +func (params *UpdateServiceConversationMessageParams) SetBody(Body string) (*UpdateServiceConversationMessageParams){ + params.Body = &Body + return params +} +func (params *UpdateServiceConversationMessageParams) SetDateCreated(DateCreated time.Time) (*UpdateServiceConversationMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateServiceConversationMessageParams) SetDateUpdated(DateUpdated time.Time) (*UpdateServiceConversationMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateServiceConversationMessageParams) SetAttributes(Attributes string) (*UpdateServiceConversationMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateServiceConversationMessageParams) SetSubject(Subject string) (*UpdateServiceConversationMessageParams){ + params.Subject = &Subject + return params } // Update an existing message in the conversation func (c *ApiService) UpdateServiceConversationMessage(ChatServiceSid string, ConversationSid string, Sid string, params *UpdateServiceConversationMessageParams) (*ConversationsV1ServiceConversationMessage, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Author != nil { + data.Set("Author", *params.Author) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.Subject != nil { + data.Set("Subject", *params.Subject) + } - if params != nil && params.Author != nil { - data.Set("Author", *params.Author) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.Subject != nil { - data.Set("Subject", *params.Subject) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ConversationsV1ServiceConversationMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConversationMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/services_conversations_messages_receipts.go b/rest/conversations/v1/services_conversations_messages_receipts.go index a722e39c2..f2ce716e6 100644 --- a/rest/conversations/v1/services_conversations_messages_receipts.go +++ b/rest/conversations/v1/services_conversations_messages_receipts.go @@ -18,89 +18,91 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch the delivery and read receipts of the conversation message -func (c *ApiService) FetchServiceConversationMessageReceipt(ChatServiceSid string, ConversationSid string, MessageSid string, Sid string) (*ConversationsV1ServiceConversationMessageReceipt, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceConversationMessageReceipt(ChatServiceSid string, ConversationSid string, MessageSid string, Sid string, ) (*ConversationsV1ServiceConversationMessageReceipt, error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceConversationMessageReceipt{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ServiceConversationMessageReceipt{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceConversationMessageReceipt' type ListServiceConversationMessageReceiptParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceConversationMessageReceiptParams) SetPageSize(PageSize int) *ListServiceConversationMessageReceiptParams { - params.PageSize = &PageSize - return params +func (params *ListServiceConversationMessageReceiptParams) SetPageSize(PageSize int) (*ListServiceConversationMessageReceiptParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceConversationMessageReceiptParams) SetLimit(Limit int) *ListServiceConversationMessageReceiptParams { - params.Limit = &Limit - return params +func (params *ListServiceConversationMessageReceiptParams) SetLimit(Limit int) (*ListServiceConversationMessageReceiptParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceConversationMessageReceipt records from the API. Request is executed immediately. func (c *ApiService) PageServiceConversationMessageReceipt(ChatServiceSid string, ConversationSid string, MessageSid string, params *ListServiceConversationMessageReceiptParams, pageToken, pageNumber string) (*ListServiceConversationMessageReceiptResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts" + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages/{MessageSid}/Receipts" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationMessageReceiptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceConversationMessageReceiptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceConversationMessageReceipt records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -141,6 +143,7 @@ func (c *ApiService) StreamServiceConversationMessageReceipt(ChatServiceSid stri return recordChannel, errorChannel } + func (c *ApiService) streamServiceConversationMessageReceipt(response *ListServiceConversationMessageReceiptResponse, params *ListServiceConversationMessageReceiptParams, recordChannel chan ConversationsV1ServiceConversationMessageReceipt, errorChannel chan error) { curRecord := 1 @@ -172,19 +175,20 @@ func (c *ApiService) streamServiceConversationMessageReceipt(response *ListServi } func (c *ApiService) getNextListServiceConversationMessageReceiptResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceConversationMessageReceiptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceConversationMessageReceiptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/conversations/v1/services_conversations_participants.go b/rest/conversations/v1/services_conversations_participants.go index 170a3536c..1e0237413 100644 --- a/rest/conversations/v1/services_conversations_participants.go +++ b/rest/conversations/v1/services_conversations_participants.go @@ -18,235 +18,237 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateServiceConversationParticipant' type CreateServiceConversationParticipantParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. - Identity *string `json:"Identity,omitempty"` - // The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). - MessagingBindingAddress *string `json:"MessagingBinding.Address,omitempty"` - // The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). - MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` - // The date on which this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date on which this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The address of the Twilio phone number that is used in Group MMS. - MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` - // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. - RoleSid *string `json:"RoleSid,omitempty"` -} - -func (params *CreateServiceConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateServiceConversationParticipantParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateServiceConversationParticipantParams) SetIdentity(Identity string) *CreateServiceConversationParticipantParams { - params.Identity = &Identity - return params -} -func (params *CreateServiceConversationParticipantParams) SetMessagingBindingAddress(MessagingBindingAddress string) *CreateServiceConversationParticipantParams { - params.MessagingBindingAddress = &MessagingBindingAddress - return params -} -func (params *CreateServiceConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) *CreateServiceConversationParticipantParams { - params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress - return params -} -func (params *CreateServiceConversationParticipantParams) SetDateCreated(DateCreated time.Time) *CreateServiceConversationParticipantParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateServiceConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) *CreateServiceConversationParticipantParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateServiceConversationParticipantParams) SetAttributes(Attributes string) *CreateServiceConversationParticipantParams { - params.Attributes = &Attributes - return params -} -func (params *CreateServiceConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) *CreateServiceConversationParticipantParams { - params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress - return params -} -func (params *CreateServiceConversationParticipantParams) SetRoleSid(RoleSid string) *CreateServiceConversationParticipantParams { - params.RoleSid = &RoleSid - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. + Identity *string `json:"Identity,omitempty"` + // The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with `proxy_address`) is only null when the participant is interacting from an SDK endpoint (see the `identity` field). + MessagingBindingAddress *string `json:"MessagingBinding.Address,omitempty"` + // The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the `identity` field). + MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` + // The date on which this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date on which this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The address of the Twilio phone number that is used in Group MMS. + MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` + // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + RoleSid *string `json:"RoleSid,omitempty"` +} + +func (params *CreateServiceConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateServiceConversationParticipantParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateServiceConversationParticipantParams) SetIdentity(Identity string) (*CreateServiceConversationParticipantParams){ + params.Identity = &Identity + return params +} +func (params *CreateServiceConversationParticipantParams) SetMessagingBindingAddress(MessagingBindingAddress string) (*CreateServiceConversationParticipantParams){ + params.MessagingBindingAddress = &MessagingBindingAddress + return params +} +func (params *CreateServiceConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) (*CreateServiceConversationParticipantParams){ + params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress + return params +} +func (params *CreateServiceConversationParticipantParams) SetDateCreated(DateCreated time.Time) (*CreateServiceConversationParticipantParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateServiceConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) (*CreateServiceConversationParticipantParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateServiceConversationParticipantParams) SetAttributes(Attributes string) (*CreateServiceConversationParticipantParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateServiceConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) (*CreateServiceConversationParticipantParams){ + params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress + return params +} +func (params *CreateServiceConversationParticipantParams) SetRoleSid(RoleSid string) (*CreateServiceConversationParticipantParams){ + params.RoleSid = &RoleSid + return params } // Add a new participant to the conversation in a specific service func (c *ApiService) CreateServiceConversationParticipant(ChatServiceSid string, ConversationSid string, params *CreateServiceConversationParticipantParams) (*ConversationsV1ServiceConversationParticipant, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.MessagingBindingAddress != nil { + data.Set("MessagingBinding.Address", *params.MessagingBindingAddress) + } + if params != nil && params.MessagingBindingProxyAddress != nil { + data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.MessagingBindingProjectedAddress != nil { + data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.MessagingBindingAddress != nil { - data.Set("MessagingBinding.Address", *params.MessagingBindingAddress) - } - if params != nil && params.MessagingBindingProxyAddress != nil { - data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.MessagingBindingProjectedAddress != nil { - data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceConversationParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConversationParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteServiceConversationParticipant' type DeleteServiceConversationParticipantParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteServiceConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteServiceConversationParticipantParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteServiceConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteServiceConversationParticipantParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a participant from the conversation -func (c *ApiService) DeleteServiceConversationParticipant(ChatServiceSid string, ConversationSid string, Sid string, params *DeleteServiceConversationParticipantParams) error { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceConversationParticipant(ChatServiceSid string, ConversationSid string, Sid string, params *DeleteServiceConversationParticipantParams) (error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Fetch a participant of the conversation -func (c *ApiService) FetchServiceConversationParticipant(ChatServiceSid string, ConversationSid string, Sid string) (*ConversationsV1ServiceConversationParticipant, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceConversationParticipant(ChatServiceSid string, ConversationSid string, Sid string, ) (*ConversationsV1ServiceConversationParticipant, error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceConversationParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ServiceConversationParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceConversationParticipant' type ListServiceConversationParticipantParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceConversationParticipantParams) SetPageSize(PageSize int) *ListServiceConversationParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListServiceConversationParticipantParams) SetPageSize(PageSize int) (*ListServiceConversationParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceConversationParticipantParams) SetLimit(Limit int) *ListServiceConversationParticipantParams { - params.Limit = &Limit - return params +func (params *ListServiceConversationParticipantParams) SetLimit(Limit int) (*ListServiceConversationParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceConversationParticipant records from the API. Request is executed immediately. func (c *ApiService) PageServiceConversationParticipant(ChatServiceSid string, ConversationSid string, params *ListServiceConversationParticipantParams, pageToken, pageNumber string) (*ListServiceConversationParticipantResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants" + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceConversationParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceConversationParticipant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -287,6 +289,7 @@ func (c *ApiService) StreamServiceConversationParticipant(ChatServiceSid string, return recordChannel, errorChannel } + func (c *ApiService) streamServiceConversationParticipant(response *ListServiceConversationParticipantResponse, params *ListServiceConversationParticipantParams, recordChannel chan ConversationsV1ServiceConversationParticipant, errorChannel chan error) { curRecord := 1 @@ -318,141 +321,142 @@ func (c *ApiService) streamServiceConversationParticipant(response *ListServiceC } func (c *ApiService) getNextListServiceConversationParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceConversationParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceConversationParticipant' type UpdateServiceConversationParticipantParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The date on which this resource was created. - DateCreated *time.Time `json:"DateCreated,omitempty"` - // The date on which this resource was last updated. - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. - Identity *string `json:"Identity,omitempty"` - // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. - Attributes *string `json:"Attributes,omitempty"` - // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. - RoleSid *string `json:"RoleSid,omitempty"` - // The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it. - MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` - // The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it. - MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` - // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` - // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - LastReadTimestamp *string `json:"LastReadTimestamp,omitempty"` -} - -func (params *UpdateServiceConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateServiceConversationParticipantParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateServiceConversationParticipantParams) SetDateCreated(DateCreated time.Time) *UpdateServiceConversationParticipantParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateServiceConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) *UpdateServiceConversationParticipantParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateServiceConversationParticipantParams) SetIdentity(Identity string) *UpdateServiceConversationParticipantParams { - params.Identity = &Identity - return params -} -func (params *UpdateServiceConversationParticipantParams) SetAttributes(Attributes string) *UpdateServiceConversationParticipantParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateServiceConversationParticipantParams) SetRoleSid(RoleSid string) *UpdateServiceConversationParticipantParams { - params.RoleSid = &RoleSid - return params -} -func (params *UpdateServiceConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) *UpdateServiceConversationParticipantParams { - params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress - return params -} -func (params *UpdateServiceConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) *UpdateServiceConversationParticipantParams { - params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress - return params -} -func (params *UpdateServiceConversationParticipantParams) SetLastReadMessageIndex(LastReadMessageIndex int) *UpdateServiceConversationParticipantParams { - params.LastReadMessageIndex = &LastReadMessageIndex - return params -} -func (params *UpdateServiceConversationParticipantParams) SetLastReadTimestamp(LastReadTimestamp string) *UpdateServiceConversationParticipantParams { - params.LastReadTimestamp = &LastReadTimestamp - return params + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The date on which this resource was created. + DateCreated *time.Time `json:"DateCreated,omitempty"` + // The date on which this resource was last updated. + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](https://www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters. + Identity *string `json:"Identity,omitempty"` + // An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set `{}` will be returned. + Attributes *string `json:"Attributes,omitempty"` + // The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + RoleSid *string `json:"RoleSid,omitempty"` + // The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it. + MessagingBindingProxyAddress *string `json:"MessagingBinding.ProxyAddress,omitempty"` + // The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it. + MessagingBindingProjectedAddress *string `json:"MessagingBinding.ProjectedAddress,omitempty"` + // Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` + // Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + LastReadTimestamp *string `json:"LastReadTimestamp,omitempty"` +} + +func (params *UpdateServiceConversationParticipantParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateServiceConversationParticipantParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateServiceConversationParticipantParams) SetDateCreated(DateCreated time.Time) (*UpdateServiceConversationParticipantParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateServiceConversationParticipantParams) SetDateUpdated(DateUpdated time.Time) (*UpdateServiceConversationParticipantParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateServiceConversationParticipantParams) SetIdentity(Identity string) (*UpdateServiceConversationParticipantParams){ + params.Identity = &Identity + return params +} +func (params *UpdateServiceConversationParticipantParams) SetAttributes(Attributes string) (*UpdateServiceConversationParticipantParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateServiceConversationParticipantParams) SetRoleSid(RoleSid string) (*UpdateServiceConversationParticipantParams){ + params.RoleSid = &RoleSid + return params +} +func (params *UpdateServiceConversationParticipantParams) SetMessagingBindingProxyAddress(MessagingBindingProxyAddress string) (*UpdateServiceConversationParticipantParams){ + params.MessagingBindingProxyAddress = &MessagingBindingProxyAddress + return params +} +func (params *UpdateServiceConversationParticipantParams) SetMessagingBindingProjectedAddress(MessagingBindingProjectedAddress string) (*UpdateServiceConversationParticipantParams){ + params.MessagingBindingProjectedAddress = &MessagingBindingProjectedAddress + return params +} +func (params *UpdateServiceConversationParticipantParams) SetLastReadMessageIndex(LastReadMessageIndex int) (*UpdateServiceConversationParticipantParams){ + params.LastReadMessageIndex = &LastReadMessageIndex + return params +} +func (params *UpdateServiceConversationParticipantParams) SetLastReadTimestamp(LastReadTimestamp string) (*UpdateServiceConversationParticipantParams){ + params.LastReadTimestamp = &LastReadTimestamp + return params } // Update an existing participant in the conversation func (c *ApiService) UpdateServiceConversationParticipant(ChatServiceSid string, ConversationSid string, Sid string, params *UpdateServiceConversationParticipantParams) (*ConversationsV1ServiceConversationParticipant, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.MessagingBindingProxyAddress != nil { + data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) + } + if params != nil && params.MessagingBindingProjectedAddress != nil { + data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) + } + if params != nil && params.LastReadMessageIndex != nil { + data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) + } + if params != nil && params.LastReadTimestamp != nil { + data.Set("LastReadTimestamp", *params.LastReadTimestamp) + } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.MessagingBindingProxyAddress != nil { - data.Set("MessagingBinding.ProxyAddress", *params.MessagingBindingProxyAddress) - } - if params != nil && params.MessagingBindingProjectedAddress != nil { - data.Set("MessagingBinding.ProjectedAddress", *params.MessagingBindingProjectedAddress) - } - if params != nil && params.LastReadMessageIndex != nil { - data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) - } - if params != nil && params.LastReadTimestamp != nil { - data.Set("LastReadTimestamp", *params.LastReadTimestamp) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ConversationsV1ServiceConversationParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceConversationParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/services_conversations_webhooks.go b/rest/conversations/v1/services_conversations_webhooks.go index 6bdc940ce..18d000874 100644 --- a/rest/conversations/v1/services_conversations_webhooks.go +++ b/rest/conversations/v1/services_conversations_webhooks.go @@ -18,204 +18,209 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateServiceConversationScopedWebhook' type CreateServiceConversationScopedWebhookParams struct { - // - Target *string `json:"Target,omitempty"` - // The absolute url the webhook request should be sent to. - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // The list of events, firing webhook event for this Conversation. - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // The list of keywords, firing webhook event for this Conversation. - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // The studio flow SID, where the webhook should be sent to. - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` - // The message index for which and it's successors the webhook will be replayed. Not set by default - ConfigurationReplayAfter *int `json:"Configuration.ReplayAfter,omitempty"` + // + Target *string `json:"Target,omitempty"` + // The absolute url the webhook request should be sent to. + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // The list of events, firing webhook event for this Conversation. + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // The list of keywords, firing webhook event for this Conversation. + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // The studio flow SID, where the webhook should be sent to. + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // The message index for which and it's successors the webhook will be replayed. Not set by default + ConfigurationReplayAfter *int `json:"Configuration.ReplayAfter,omitempty"` } -func (params *CreateServiceConversationScopedWebhookParams) SetTarget(Target string) *CreateServiceConversationScopedWebhookParams { - params.Target = &Target - return params +func (params *CreateServiceConversationScopedWebhookParams) SetTarget(Target string) (*CreateServiceConversationScopedWebhookParams){ + params.Target = &Target + return params } -func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *CreateServiceConversationScopedWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*CreateServiceConversationScopedWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *CreateServiceConversationScopedWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*CreateServiceConversationScopedWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *CreateServiceConversationScopedWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*CreateServiceConversationScopedWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *CreateServiceConversationScopedWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*CreateServiceConversationScopedWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *CreateServiceConversationScopedWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*CreateServiceConversationScopedWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } -func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationReplayAfter(ConfigurationReplayAfter int) *CreateServiceConversationScopedWebhookParams { - params.ConfigurationReplayAfter = &ConfigurationReplayAfter - return params +func (params *CreateServiceConversationScopedWebhookParams) SetConfigurationReplayAfter(ConfigurationReplayAfter int) (*CreateServiceConversationScopedWebhookParams){ + params.ConfigurationReplayAfter = &ConfigurationReplayAfter + return params } // Create a new webhook scoped to the conversation in a specific service func (c *ApiService) CreateServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, params *CreateServiceConversationScopedWebhookParams) (*ConversationsV1ServiceConversationScopedWebhook, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Target != nil { - data.Set("Target", *params.Target) - } - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - if params != nil && params.ConfigurationReplayAfter != nil { - data.Set("Configuration.ReplayAfter", fmt.Sprint(*params.ConfigurationReplayAfter)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceConversationScopedWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Target != nil { + data.Set("Target", *params.Target) + } + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + if params != nil && params.ConfigurationReplayAfter != nil { + data.Set("Configuration.ReplayAfter", fmt.Sprint(*params.ConfigurationReplayAfter)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceConversationScopedWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Remove an existing webhook scoped to the conversation -func (c *ApiService) DeleteServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, Sid string) error { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, Sid string, ) (error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch the configuration of a conversation-scoped webhook -func (c *ApiService) FetchServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, Sid string) (*ConversationsV1ServiceConversationScopedWebhook, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, Sid string, ) (*ConversationsV1ServiceConversationScopedWebhook, error) { + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceConversationScopedWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ConversationsV1ServiceConversationScopedWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceConversationScopedWebhook' type ListServiceConversationScopedWebhookParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceConversationScopedWebhookParams) SetPageSize(PageSize int) *ListServiceConversationScopedWebhookParams { - params.PageSize = &PageSize - return params +func (params *ListServiceConversationScopedWebhookParams) SetPageSize(PageSize int) (*ListServiceConversationScopedWebhookParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceConversationScopedWebhookParams) SetLimit(Limit int) *ListServiceConversationScopedWebhookParams { - params.Limit = &Limit - return params +func (params *ListServiceConversationScopedWebhookParams) SetLimit(Limit int) (*ListServiceConversationScopedWebhookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceConversationScopedWebhook records from the API. Request is executed immediately. func (c *ApiService) PageServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, params *ListServiceConversationScopedWebhookParams, pageToken, pageNumber string) (*ListServiceConversationScopedWebhookResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks" + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceConversationScopedWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceConversationScopedWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceConversationScopedWebhook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -256,6 +261,7 @@ func (c *ApiService) StreamServiceConversationScopedWebhook(ChatServiceSid strin return recordChannel, errorChannel } + func (c *ApiService) streamServiceConversationScopedWebhook(response *ListServiceConversationScopedWebhookResponse, params *ListServiceConversationScopedWebhookParams, recordChannel chan ConversationsV1ServiceConversationScopedWebhook, errorChannel chan error) { curRecord := 1 @@ -287,99 +293,101 @@ func (c *ApiService) streamServiceConversationScopedWebhook(response *ListServic } func (c *ApiService) getNextListServiceConversationScopedWebhookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceConversationScopedWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceConversationScopedWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceConversationScopedWebhook' type UpdateServiceConversationScopedWebhookParams struct { - // The absolute url the webhook request should be sent to. - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // The list of events, firing webhook event for this Conversation. - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // The list of keywords, firing webhook event for this Conversation. - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // The studio flow SID, where the webhook should be sent to. - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // The absolute url the webhook request should be sent to. + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // The list of events, firing webhook event for this Conversation. + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // The list of keywords, firing webhook event for this Conversation. + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // The studio flow SID, where the webhook should be sent to. + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` } -func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *UpdateServiceConversationScopedWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*UpdateServiceConversationScopedWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *UpdateServiceConversationScopedWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*UpdateServiceConversationScopedWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *UpdateServiceConversationScopedWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*UpdateServiceConversationScopedWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *UpdateServiceConversationScopedWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*UpdateServiceConversationScopedWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *UpdateServiceConversationScopedWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *UpdateServiceConversationScopedWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*UpdateServiceConversationScopedWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } // Update an existing conversation-scoped webhook func (c *ApiService) UpdateServiceConversationScopedWebhook(ChatServiceSid string, ConversationSid string, Sid string, params *UpdateServiceConversationScopedWebhookParams) (*ConversationsV1ServiceConversationScopedWebhook, error) { - path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceConversationScopedWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceConversationScopedWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/services_participant_conversations.go b/rest/conversations/v1/services_participant_conversations.go index 745cea43f..217e240c4 100644 --- a/rest/conversations/v1/services_participant_conversations.go +++ b/rest/conversations/v1/services_participant_conversations.go @@ -18,79 +18,79 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListServiceParticipantConversation' type ListServiceParticipantConversationParams struct { - // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - Identity *string `json:"Identity,omitempty"` - // A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. - Address *string `json:"Address,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + Identity *string `json:"Identity,omitempty"` + // A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. + Address *string `json:"Address,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParticipantConversationParams) SetIdentity(Identity string) *ListServiceParticipantConversationParams { - params.Identity = &Identity - return params +func (params *ListServiceParticipantConversationParams) SetIdentity(Identity string) (*ListServiceParticipantConversationParams){ + params.Identity = &Identity + return params } -func (params *ListServiceParticipantConversationParams) SetAddress(Address string) *ListServiceParticipantConversationParams { - params.Address = &Address - return params +func (params *ListServiceParticipantConversationParams) SetAddress(Address string) (*ListServiceParticipantConversationParams){ + params.Address = &Address + return params } -func (params *ListServiceParticipantConversationParams) SetPageSize(PageSize int) *ListServiceParticipantConversationParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParticipantConversationParams) SetPageSize(PageSize int) (*ListServiceParticipantConversationParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParticipantConversationParams) SetLimit(Limit int) *ListServiceParticipantConversationParams { - params.Limit = &Limit - return params +func (params *ListServiceParticipantConversationParams) SetLimit(Limit int) (*ListServiceParticipantConversationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceParticipantConversation records from the API. Request is executed immediately. func (c *ApiService) PageServiceParticipantConversation(ChatServiceSid string, params *ListServiceParticipantConversationParams, pageToken, pageNumber string) (*ListServiceParticipantConversationResponse, error) { - path := "/v1/Services/{ChatServiceSid}/ParticipantConversations" - - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.Address != nil { - data.Set("Address", *params.Address) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceParticipantConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/ParticipantConversations" + + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.Address != nil { + data.Set("Address", *params.Address) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceParticipantConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists ServiceParticipantConversation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -131,6 +131,7 @@ func (c *ApiService) StreamServiceParticipantConversation(ChatServiceSid string, return recordChannel, errorChannel } + func (c *ApiService) streamServiceParticipantConversation(response *ListServiceParticipantConversationResponse, params *ListServiceParticipantConversationParams, recordChannel chan ConversationsV1ServiceParticipantConversation, errorChannel chan error) { curRecord := 1 @@ -162,19 +163,20 @@ func (c *ApiService) streamServiceParticipantConversation(response *ListServiceP } func (c *ApiService) getNextListServiceParticipantConversationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceParticipantConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceParticipantConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/conversations/v1/services_roles.go b/rest/conversations/v1/services_roles.go index 9e97aa28d..942830927 100644 --- a/rest/conversations/v1/services_roles.go +++ b/rest/conversations/v1/services_roles.go @@ -18,162 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateServiceRole' type CreateServiceRoleParams struct { - // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`. - Permission *[]string `json:"Permission,omitempty"` + // A descriptive string that you create to describe the new resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`. + Permission *[]string `json:"Permission,omitempty"` } -func (params *CreateServiceRoleParams) SetFriendlyName(FriendlyName string) *CreateServiceRoleParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceRoleParams) SetFriendlyName(FriendlyName string) (*CreateServiceRoleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateServiceRoleParams) SetType(Type string) *CreateServiceRoleParams { - params.Type = &Type - return params +func (params *CreateServiceRoleParams) SetType(Type string) (*CreateServiceRoleParams){ + params.Type = &Type + return params } -func (params *CreateServiceRoleParams) SetPermission(Permission []string) *CreateServiceRoleParams { - params.Permission = &Permission - return params +func (params *CreateServiceRoleParams) SetPermission(Permission []string) (*CreateServiceRoleParams){ + params.Permission = &Permission + return params } // Create a new user role in your service func (c *ApiService) CreateServiceRole(ChatServiceSid string, params *CreateServiceRoleParams) (*ConversationsV1ServiceRole, error) { - path := "/v1/Services/{ChatServiceSid}/Roles" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceRole{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Roles" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceRole{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Remove a user role from your service -func (c *ApiService) DeleteServiceRole(ChatServiceSid string, Sid string) error { - path := "/v1/Services/{ChatServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceRole(ChatServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ChatServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a user role from your service -func (c *ApiService) FetchServiceRole(ChatServiceSid string, Sid string) (*ConversationsV1ServiceRole, error) { - path := "/v1/Services/{ChatServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceRole(ChatServiceSid string, Sid string, ) (*ConversationsV1ServiceRole, error) { + path := "/v1/Services/{ChatServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceRole{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceRole{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListServiceRole' type ListServiceRoleParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceRoleParams) SetPageSize(PageSize int) *ListServiceRoleParams { - params.PageSize = &PageSize - return params +func (params *ListServiceRoleParams) SetPageSize(PageSize int) (*ListServiceRoleParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceRoleParams) SetLimit(Limit int) *ListServiceRoleParams { - params.Limit = &Limit - return params +func (params *ListServiceRoleParams) SetLimit(Limit int) (*ListServiceRoleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceRole records from the API. Request is executed immediately. func (c *ApiService) PageServiceRole(ChatServiceSid string, params *ListServiceRoleParams, pageToken, pageNumber string) (*ListServiceRoleResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Roles" + path := "/v1/Services/{ChatServiceSid}/Roles" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceRole records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -214,6 +219,7 @@ func (c *ApiService) StreamServiceRole(ChatServiceSid string, params *ListServic return recordChannel, errorChannel } + func (c *ApiService) streamServiceRole(response *ListServiceRoleResponse, params *ListServiceRoleParams, recordChannel chan ConversationsV1ServiceRole, errorChannel chan error) { curRecord := 1 @@ -245,60 +251,62 @@ func (c *ApiService) streamServiceRole(response *ListServiceRoleResponse, params } func (c *ApiService) getNextListServiceRoleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceRole' type UpdateServiceRoleParams struct { - // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`. - Permission *[]string `json:"Permission,omitempty"` + // A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`. + Permission *[]string `json:"Permission,omitempty"` } -func (params *UpdateServiceRoleParams) SetPermission(Permission []string) *UpdateServiceRoleParams { - params.Permission = &Permission - return params +func (params *UpdateServiceRoleParams) SetPermission(Permission []string) (*UpdateServiceRoleParams){ + params.Permission = &Permission + return params } // Update an existing user role in your service func (c *ApiService) UpdateServiceRole(ChatServiceSid string, Sid string, params *UpdateServiceRoleParams) (*ConversationsV1ServiceRole, error) { - path := "/v1/Services/{ChatServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ChatServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ConversationsV1ServiceRole{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ConversationsV1ServiceRole{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/services_users.go b/rest/conversations/v1/services_users.go index 59cd24513..269443763 100644 --- a/rest/conversations/v1/services_users.go +++ b/rest/conversations/v1/services_users.go @@ -18,194 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateServiceUser' type CreateServiceUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. - Identity *string `json:"Identity,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. - Attributes *string `json:"Attributes,omitempty"` - // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. - RoleSid *string `json:"RoleSid,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. + Identity *string `json:"Identity,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + Attributes *string `json:"Attributes,omitempty"` + // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateServiceUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateServiceUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *CreateServiceUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateServiceUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *CreateServiceUserParams) SetIdentity(Identity string) *CreateServiceUserParams { - params.Identity = &Identity - return params +func (params *CreateServiceUserParams) SetIdentity(Identity string) (*CreateServiceUserParams){ + params.Identity = &Identity + return params } -func (params *CreateServiceUserParams) SetFriendlyName(FriendlyName string) *CreateServiceUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceUserParams) SetFriendlyName(FriendlyName string) (*CreateServiceUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateServiceUserParams) SetAttributes(Attributes string) *CreateServiceUserParams { - params.Attributes = &Attributes - return params +func (params *CreateServiceUserParams) SetAttributes(Attributes string) (*CreateServiceUserParams){ + params.Attributes = &Attributes + return params } -func (params *CreateServiceUserParams) SetRoleSid(RoleSid string) *CreateServiceUserParams { - params.RoleSid = &RoleSid - return params +func (params *CreateServiceUserParams) SetRoleSid(RoleSid string) (*CreateServiceUserParams){ + params.RoleSid = &RoleSid + return params } // Add a new conversation user to your service func (c *ApiService) CreateServiceUser(ChatServiceSid string, params *CreateServiceUserParams) (*ConversationsV1ServiceUser, error) { - path := "/v1/Services/{ChatServiceSid}/Users" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path := "/v1/Services/{ChatServiceSid}/Users" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1ServiceUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteServiceUser' type DeleteServiceUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteServiceUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteServiceUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteServiceUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteServiceUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a conversation user from your service -func (c *ApiService) DeleteServiceUser(ChatServiceSid string, Sid string, params *DeleteServiceUserParams) error { - path := "/v1/Services/{ChatServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteServiceUser(ChatServiceSid string, Sid string, params *DeleteServiceUserParams) (error) { + path := "/v1/Services/{ChatServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Fetch a conversation user from your service -func (c *ApiService) FetchServiceUser(ChatServiceSid string, Sid string) (*ConversationsV1ServiceUser, error) { - path := "/v1/Services/{ChatServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchServiceUser(ChatServiceSid string, Sid string, ) (*ConversationsV1ServiceUser, error) { + path := "/v1/Services/{ChatServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ServiceUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceUser' type ListServiceUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceUserParams) SetPageSize(PageSize int) *ListServiceUserParams { - params.PageSize = &PageSize - return params +func (params *ListServiceUserParams) SetPageSize(PageSize int) (*ListServiceUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceUserParams) SetLimit(Limit int) *ListServiceUserParams { - params.Limit = &Limit - return params +func (params *ListServiceUserParams) SetLimit(Limit int) (*ListServiceUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceUser records from the API. Request is executed immediately. func (c *ApiService) PageServiceUser(ChatServiceSid string, params *ListServiceUserParams, pageToken, pageNumber string) (*ListServiceUserResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Users" + path := "/v1/Services/{ChatServiceSid}/Users" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceUser records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -246,6 +249,7 @@ func (c *ApiService) StreamServiceUser(ChatServiceSid string, params *ListServic return recordChannel, errorChannel } + func (c *ApiService) streamServiceUser(response *ListServiceUserResponse, params *ListServiceUserParams, recordChannel chan ConversationsV1ServiceUser, errorChannel chan error) { curRecord := 1 @@ -277,86 +281,87 @@ func (c *ApiService) streamServiceUser(response *ListServiceUserResponse, params } func (c *ApiService) getNextListServiceUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceUser' type UpdateServiceUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. - Attributes *string `json:"Attributes,omitempty"` - // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. - RoleSid *string `json:"RoleSid,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + Attributes *string `json:"Attributes,omitempty"` + // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *UpdateServiceUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateServiceUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *UpdateServiceUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateServiceUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *UpdateServiceUserParams) SetFriendlyName(FriendlyName string) *UpdateServiceUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateServiceUserParams) SetFriendlyName(FriendlyName string) (*UpdateServiceUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateServiceUserParams) SetAttributes(Attributes string) *UpdateServiceUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateServiceUserParams) SetAttributes(Attributes string) (*UpdateServiceUserParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateServiceUserParams) SetRoleSid(RoleSid string) *UpdateServiceUserParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateServiceUserParams) SetRoleSid(RoleSid string) (*UpdateServiceUserParams){ + params.RoleSid = &RoleSid + return params } // Update an existing conversation user in your service func (c *ApiService) UpdateServiceUser(ChatServiceSid string, Sid string, params *UpdateServiceUserParams) (*ConversationsV1ServiceUser, error) { - path := "/v1/Services/{ChatServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ChatServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ConversationsV1ServiceUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1ServiceUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/services_users_conversations.go b/rest/conversations/v1/services_users_conversations.go index 9db74c531..dc8d8127d 100644 --- a/rest/conversations/v1/services_users_conversations.go +++ b/rest/conversations/v1/services_users_conversations.go @@ -18,108 +18,111 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific User Conversation. -func (c *ApiService) DeleteServiceUserConversation(ChatServiceSid string, UserSid string, ConversationSid string) error { - path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations/{ConversationSid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) +func (c *ApiService) DeleteServiceUserConversation(ChatServiceSid string, UserSid string, ConversationSid string, ) (error) { + path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations/{ConversationSid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific User Conversation. -func (c *ApiService) FetchServiceUserConversation(ChatServiceSid string, UserSid string, ConversationSid string) (*ConversationsV1ServiceUserConversation, error) { - path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations/{ConversationSid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) +func (c *ApiService) FetchServiceUserConversation(ChatServiceSid string, UserSid string, ConversationSid string, ) (*ConversationsV1ServiceUserConversation, error) { + path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations/{ConversationSid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1ServiceUserConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1ServiceUserConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListServiceUserConversation' type ListServiceUserConversationParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceUserConversationParams) SetPageSize(PageSize int) *ListServiceUserConversationParams { - params.PageSize = &PageSize - return params +func (params *ListServiceUserConversationParams) SetPageSize(PageSize int) (*ListServiceUserConversationParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceUserConversationParams) SetLimit(Limit int) *ListServiceUserConversationParams { - params.Limit = &Limit - return params +func (params *ListServiceUserConversationParams) SetLimit(Limit int) (*ListServiceUserConversationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ServiceUserConversation records from the API. Request is executed immediately. func (c *ApiService) PageServiceUserConversation(ChatServiceSid string, UserSid string, params *ListServiceUserConversationParams, pageToken, pageNumber string) (*ListServiceUserConversationResponse, error) { - path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations" + path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceUserConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceUserConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ServiceUserConversation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -160,6 +163,7 @@ func (c *ApiService) StreamServiceUserConversation(ChatServiceSid string, UserSi return recordChannel, errorChannel } + func (c *ApiService) streamServiceUserConversation(response *ListServiceUserConversationResponse, params *ListServiceUserConversationParams, recordChannel chan ConversationsV1ServiceUserConversation, errorChannel chan error) { curRecord := 1 @@ -191,77 +195,79 @@ func (c *ApiService) streamServiceUserConversation(response *ListServiceUserConv } func (c *ApiService) getNextListServiceUserConversationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceUserConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceUserConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateServiceUserConversation' type UpdateServiceUserConversationParams struct { - // - NotificationLevel *string `json:"NotificationLevel,omitempty"` - // The date of the last message read in conversation by the user, given in ISO 8601 format. - LastReadTimestamp *time.Time `json:"LastReadTimestamp,omitempty"` - // The index of the last Message in the Conversation that the Participant has read. - LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` + // + NotificationLevel *string `json:"NotificationLevel,omitempty"` + // The date of the last message read in conversation by the user, given in ISO 8601 format. + LastReadTimestamp *time.Time `json:"LastReadTimestamp,omitempty"` + // The index of the last Message in the Conversation that the Participant has read. + LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` } -func (params *UpdateServiceUserConversationParams) SetNotificationLevel(NotificationLevel string) *UpdateServiceUserConversationParams { - params.NotificationLevel = &NotificationLevel - return params +func (params *UpdateServiceUserConversationParams) SetNotificationLevel(NotificationLevel string) (*UpdateServiceUserConversationParams){ + params.NotificationLevel = &NotificationLevel + return params } -func (params *UpdateServiceUserConversationParams) SetLastReadTimestamp(LastReadTimestamp time.Time) *UpdateServiceUserConversationParams { - params.LastReadTimestamp = &LastReadTimestamp - return params +func (params *UpdateServiceUserConversationParams) SetLastReadTimestamp(LastReadTimestamp time.Time) (*UpdateServiceUserConversationParams){ + params.LastReadTimestamp = &LastReadTimestamp + return params } -func (params *UpdateServiceUserConversationParams) SetLastReadMessageIndex(LastReadMessageIndex int) *UpdateServiceUserConversationParams { - params.LastReadMessageIndex = &LastReadMessageIndex - return params +func (params *UpdateServiceUserConversationParams) SetLastReadMessageIndex(LastReadMessageIndex int) (*UpdateServiceUserConversationParams){ + params.LastReadMessageIndex = &LastReadMessageIndex + return params } // Update a specific User Conversation. func (c *ApiService) UpdateServiceUserConversation(ChatServiceSid string, UserSid string, ConversationSid string, params *UpdateServiceUserConversationParams) (*ConversationsV1ServiceUserConversation, error) { - path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations/{ConversationSid}" - path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.NotificationLevel != nil { - data.Set("NotificationLevel", *params.NotificationLevel) - } - if params != nil && params.LastReadTimestamp != nil { - data.Set("LastReadTimestamp", fmt.Sprint((*params.LastReadTimestamp).Format(time.RFC3339))) - } - if params != nil && params.LastReadMessageIndex != nil { - data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ConversationsV1ServiceUserConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ChatServiceSid}/Users/{UserSid}/Conversations/{ConversationSid}" + path = strings.Replace(path, "{"+"ChatServiceSid"+"}", ChatServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.NotificationLevel != nil { + data.Set("NotificationLevel", *params.NotificationLevel) + } + if params != nil && params.LastReadTimestamp != nil { + data.Set("LastReadTimestamp", fmt.Sprint((*params.LastReadTimestamp).Format(time.RFC3339))) + } + if params != nil && params.LastReadMessageIndex != nil { + data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ConversationsV1ServiceUserConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/conversations/v1/users.go b/rest/conversations/v1/users.go index 225256e19..d3c62a943 100644 --- a/rest/conversations/v1/users.go +++ b/rest/conversations/v1/users.go @@ -18,189 +18,193 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUser' type CreateUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. - Identity *string `json:"Identity,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. - Attributes *string `json:"Attributes,omitempty"` - // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. - RoleSid *string `json:"RoleSid,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. + Identity *string `json:"Identity,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + Attributes *string `json:"Attributes,omitempty"` + // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *CreateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *CreateUserParams) SetIdentity(Identity string) *CreateUserParams { - params.Identity = &Identity - return params +func (params *CreateUserParams) SetIdentity(Identity string) (*CreateUserParams){ + params.Identity = &Identity + return params } -func (params *CreateUserParams) SetFriendlyName(FriendlyName string) *CreateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateUserParams) SetFriendlyName(FriendlyName string) (*CreateUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateUserParams) SetAttributes(Attributes string) *CreateUserParams { - params.Attributes = &Attributes - return params +func (params *CreateUserParams) SetAttributes(Attributes string) (*CreateUserParams){ + params.Attributes = &Attributes + return params } -func (params *CreateUserParams) SetRoleSid(RoleSid string) *CreateUserParams { - params.RoleSid = &RoleSid - return params +func (params *CreateUserParams) SetRoleSid(RoleSid string) (*CreateUserParams){ + params.RoleSid = &RoleSid + return params } // Add a new conversation user to your account's default service func (c *ApiService) CreateUser(params *CreateUserParams) (*ConversationsV1User, error) { - path := "/v1/Users" + path := "/v1/Users" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ConversationsV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteUser' type DeleteUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } // Remove a conversation user from your account's default service -func (c *ApiService) DeleteUser(Sid string, params *DeleteUserParams) error { - path := "/v1/Users/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteUser(Sid string, params *DeleteUserParams) (error) { + path := "/v1/Users/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Fetch a conversation user from your account's default service -func (c *ApiService) FetchUser(Sid string) (*ConversationsV1User, error) { - path := "/v1/Users/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchUser(Sid string, ) (*ConversationsV1User, error) { + path := "/v1/Users/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ConversationsV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUser' type ListUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserParams) SetPageSize(PageSize int) *ListUserParams { - params.PageSize = &PageSize - return params +func (params *ListUserParams) SetPageSize(PageSize int) (*ListUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserParams) SetLimit(Limit int) *ListUserParams { - params.Limit = &Limit - return params +func (params *ListUserParams) SetLimit(Limit int) (*ListUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of User records from the API. Request is executed immediately. func (c *ApiService) PageUser(params *ListUserParams, pageToken, pageNumber string) (*ListUserResponse, error) { - path := "/v1/Users" + path := "/v1/Users" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists User records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -241,6 +245,7 @@ func (c *ApiService) StreamUser(params *ListUserParams) (chan ConversationsV1Use return recordChannel, errorChannel } + func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserParams, recordChannel chan ConversationsV1User, errorChannel chan error) { curRecord := 1 @@ -272,85 +277,86 @@ func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserPara } func (c *ApiService) getNextListUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUser' type UpdateUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. - Attributes *string `json:"Attributes,omitempty"` - // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. - RoleSid *string `json:"RoleSid,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + Attributes *string `json:"Attributes,omitempty"` + // The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *UpdateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *UpdateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) *UpdateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) (*UpdateUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateUserParams) SetAttributes(Attributes string) *UpdateUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateUserParams) SetAttributes(Attributes string) (*UpdateUserParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateUserParams) SetRoleSid(RoleSid string) *UpdateUserParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateUserParams) SetRoleSid(RoleSid string) (*UpdateUserParams){ + params.RoleSid = &RoleSid + return params } // Update an existing conversation user in your account's default service func (c *ApiService) UpdateUser(Sid string, params *UpdateUserParams) (*ConversationsV1User, error) { - path := "/v1/Users/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Users/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &ConversationsV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ConversationsV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/conversations/v1/users_conversations.go b/rest/conversations/v1/users_conversations.go index 9e31f8968..3d043e64c 100644 --- a/rest/conversations/v1/users_conversations.go +++ b/rest/conversations/v1/users_conversations.go @@ -18,105 +18,108 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific User Conversation. -func (c *ApiService) DeleteUserConversation(UserSid string, ConversationSid string) error { - path := "/v1/Users/{UserSid}/Conversations/{ConversationSid}" - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) +func (c *ApiService) DeleteUserConversation(UserSid string, ConversationSid string, ) (error) { + path := "/v1/Users/{UserSid}/Conversations/{ConversationSid}" + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific User Conversation. -func (c *ApiService) FetchUserConversation(UserSid string, ConversationSid string) (*ConversationsV1UserConversation, error) { - path := "/v1/Users/{UserSid}/Conversations/{ConversationSid}" - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) +func (c *ApiService) FetchUserConversation(UserSid string, ConversationSid string, ) (*ConversationsV1UserConversation, error) { + path := "/v1/Users/{UserSid}/Conversations/{ConversationSid}" + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ConversationsV1UserConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ConversationsV1UserConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUserConversation' type ListUserConversationParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserConversationParams) SetPageSize(PageSize int) *ListUserConversationParams { - params.PageSize = &PageSize - return params +func (params *ListUserConversationParams) SetPageSize(PageSize int) (*ListUserConversationParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserConversationParams) SetLimit(Limit int) *ListUserConversationParams { - params.Limit = &Limit - return params +func (params *ListUserConversationParams) SetLimit(Limit int) (*ListUserConversationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserConversation records from the API. Request is executed immediately. func (c *ApiService) PageUserConversation(UserSid string, params *ListUserConversationParams, pageToken, pageNumber string) (*ListUserConversationResponse, error) { - path := "/v1/Users/{UserSid}/Conversations" + path := "/v1/Users/{UserSid}/Conversations" - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UserConversation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -157,6 +160,7 @@ func (c *ApiService) StreamUserConversation(UserSid string, params *ListUserConv return recordChannel, errorChannel } + func (c *ApiService) streamUserConversation(response *ListUserConversationResponse, params *ListUserConversationParams, recordChannel chan ConversationsV1UserConversation, errorChannel chan error) { curRecord := 1 @@ -188,76 +192,78 @@ func (c *ApiService) streamUserConversation(response *ListUserConversationRespon } func (c *ApiService) getNextListUserConversationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserConversationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserConversationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUserConversation' type UpdateUserConversationParams struct { - // - NotificationLevel *string `json:"NotificationLevel,omitempty"` - // The date of the last message read in conversation by the user, given in ISO 8601 format. - LastReadTimestamp *time.Time `json:"LastReadTimestamp,omitempty"` - // The index of the last Message in the Conversation that the Participant has read. - LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` + // + NotificationLevel *string `json:"NotificationLevel,omitempty"` + // The date of the last message read in conversation by the user, given in ISO 8601 format. + LastReadTimestamp *time.Time `json:"LastReadTimestamp,omitempty"` + // The index of the last Message in the Conversation that the Participant has read. + LastReadMessageIndex *int `json:"LastReadMessageIndex,omitempty"` } -func (params *UpdateUserConversationParams) SetNotificationLevel(NotificationLevel string) *UpdateUserConversationParams { - params.NotificationLevel = &NotificationLevel - return params +func (params *UpdateUserConversationParams) SetNotificationLevel(NotificationLevel string) (*UpdateUserConversationParams){ + params.NotificationLevel = &NotificationLevel + return params } -func (params *UpdateUserConversationParams) SetLastReadTimestamp(LastReadTimestamp time.Time) *UpdateUserConversationParams { - params.LastReadTimestamp = &LastReadTimestamp - return params +func (params *UpdateUserConversationParams) SetLastReadTimestamp(LastReadTimestamp time.Time) (*UpdateUserConversationParams){ + params.LastReadTimestamp = &LastReadTimestamp + return params } -func (params *UpdateUserConversationParams) SetLastReadMessageIndex(LastReadMessageIndex int) *UpdateUserConversationParams { - params.LastReadMessageIndex = &LastReadMessageIndex - return params +func (params *UpdateUserConversationParams) SetLastReadMessageIndex(LastReadMessageIndex int) (*UpdateUserConversationParams){ + params.LastReadMessageIndex = &LastReadMessageIndex + return params } // Update a specific User Conversation. func (c *ApiService) UpdateUserConversation(UserSid string, ConversationSid string, params *UpdateUserConversationParams) (*ConversationsV1UserConversation, error) { - path := "/v1/Users/{UserSid}/Conversations/{ConversationSid}" - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) + path := "/v1/Users/{UserSid}/Conversations/{ConversationSid}" + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ConversationSid"+"}", ConversationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.NotificationLevel != nil { - data.Set("NotificationLevel", *params.NotificationLevel) - } - if params != nil && params.LastReadTimestamp != nil { - data.Set("LastReadTimestamp", fmt.Sprint((*params.LastReadTimestamp).Format(time.RFC3339))) - } - if params != nil && params.LastReadMessageIndex != nil { - data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) - } + if params != nil && params.NotificationLevel != nil { + data.Set("NotificationLevel", *params.NotificationLevel) + } + if params != nil && params.LastReadTimestamp != nil { + data.Set("LastReadTimestamp", fmt.Sprint((*params.LastReadTimestamp).Format(time.RFC3339))) + } + if params != nil && params.LastReadMessageIndex != nil { + data.Set("LastReadMessageIndex", fmt.Sprint(*params.LastReadMessageIndex)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ConversationsV1UserConversation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ConversationsV1UserConversation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/README.md b/rest/events/v1/README.md index 8e88a8e67..780e7040b 100644 --- a/rest/events/v1/README.md +++ b/rest/events/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/events/v1/api_service.go b/rest/events/v1/api_service.go index 89bb15ad1..948380ca7 100644 --- a/rest/events/v1/api_service.go +++ b/rest/events/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://events.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/events/v1/docs/ListEventTypeResponseMeta.md b/rest/events/v1/docs/ListEventTypeResponseMeta.md index d7efddb60..0951793c9 100644 --- a/rest/events/v1/docs/ListEventTypeResponseMeta.md +++ b/rest/events/v1/docs/ListEventTypeResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/events/v1/model_events_v1_event_type.go b/rest/events/v1/model_events_v1_event_type.go index 6e49a7392..bab6740fe 100644 --- a/rest/events/v1/model_events_v1_event_type.go +++ b/rest/events/v1/model_events_v1_event_type.go @@ -13,24 +13,26 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // EventsV1EventType struct for EventsV1EventType type EventsV1EventType struct { - // A string that uniquely identifies this Event Type. + // A string that uniquely identifies this Event Type. Type *string `json:"type,omitempty"` - // A string that uniquely identifies the Schema this Event Type adheres to. + // A string that uniquely identifies the Schema this Event Type adheres to. SchemaId *string `json:"schema_id,omitempty"` - // The date that this Event Type was created, given in ISO 8601 format. + // The date that this Event Type was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Event Type was updated, given in ISO 8601 format. + // The date that this Event Type was updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // A human readable description for this Event Type. + // A human readable description for this Event Type. Description *string `json:"description,omitempty"` - // The URL of this resource. - Url *string `json:"url,omitempty"` + // The URL of this resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_schema.go b/rest/events/v1/model_events_v1_schema.go index 328776ce3..75aa033a9 100644 --- a/rest/events/v1/model_events_v1_schema.go +++ b/rest/events/v1/model_events_v1_schema.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // EventsV1Schema struct for EventsV1Schema type EventsV1Schema struct { - // The unique identifier of the schema. Each schema can have multiple versions, that share the same id. + // The unique identifier of the schema. Each schema can have multiple versions, that share the same id. Id *string `json:"id,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this schema. + // Contains a dictionary of URL links to nested resources of this schema. Links *map[string]interface{} `json:"links,omitempty"` - // The date that the latest schema version was created, given in ISO 8601 format. + // The date that the latest schema version was created, given in ISO 8601 format. LatestVersionDateCreated *time.Time `json:"latest_version_date_created,omitempty"` - // The latest version published of this schema. + // The latest version published of this schema. LatestVersion *int `json:"latest_version,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_schema_version.go b/rest/events/v1/model_events_v1_schema_version.go index cde2ec38d..eec14afeb 100644 --- a/rest/events/v1/model_events_v1_schema_version.go +++ b/rest/events/v1/model_events_v1_schema_version.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // EventsV1SchemaVersion struct for EventsV1SchemaVersion type EventsV1SchemaVersion struct { - // The unique identifier of the schema. Each schema can have multiple versions, that share the same id. + // The unique identifier of the schema. Each schema can have multiple versions, that share the same id. Id *string `json:"id,omitempty"` - // The version of this schema. + // The version of this schema. SchemaVersion *int `json:"schema_version,omitempty"` - // The date the schema version was created, given in ISO 8601 format. + // The date the schema version was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` Raw *string `json:"raw,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_sink.go b/rest/events/v1/model_events_v1_sink.go index 09b8940c4..36fcb8f62 100644 --- a/rest/events/v1/model_events_v1_sink.go +++ b/rest/events/v1/model_events_v1_sink.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // EventsV1Sink struct for EventsV1Sink type EventsV1Sink struct { - // The date that this Sink was created, given in ISO 8601 format. + // The date that this Sink was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Sink was updated, given in ISO 8601 format. + // The date that this Sink was updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // A human readable description for the Sink + // A human readable description for the Sink Description *string `json:"description,omitempty"` - // A 34 character string that uniquely identifies this Sink. + // A 34 character string that uniquely identifies this Sink. Sid *string `json:"sid,omitempty"` - // The information required for Twilio to connect to the provided Sink encoded as JSON. + // The information required for Twilio to connect to the provided Sink encoded as JSON. SinkConfiguration *interface{} `json:"sink_configuration,omitempty"` - SinkType *string `json:"sink_type,omitempty"` - Status *string `json:"status,omitempty"` - // The URL of this resource. + SinkType *string `json:"sink_type,omitempty"` + Status *string `json:"status,omitempty"` + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this Sink. + // Contains a dictionary of URL links to nested resources of this Sink. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_sink_test_.go b/rest/events/v1/model_events_v1_sink_test_.go index f029a36cd..462b8bb80 100644 --- a/rest/events/v1/model_events_v1_sink_test_.go +++ b/rest/events/v1/model_events_v1_sink_test_.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // EventsV1SinkTest struct for EventsV1SinkTest type EventsV1SinkTest struct { - // Feedback indicating whether the test event was generated. + // Feedback indicating whether the test event was generated. Result *string `json:"result,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_sink_validate.go b/rest/events/v1/model_events_v1_sink_validate.go index f43c6cb04..91084c9e5 100644 --- a/rest/events/v1/model_events_v1_sink_validate.go +++ b/rest/events/v1/model_events_v1_sink_validate.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // EventsV1SinkValidate struct for EventsV1SinkValidate type EventsV1SinkValidate struct { - // Feedback indicating whether the given Sink was validated. + // Feedback indicating whether the given Sink was validated. Result *string `json:"result,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_subscribed_event.go b/rest/events/v1/model_events_v1_subscribed_event.go index bbe505789..922d86abe 100644 --- a/rest/events/v1/model_events_v1_subscribed_event.go +++ b/rest/events/v1/model_events_v1_subscribed_event.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // EventsV1SubscribedEvent struct for EventsV1SubscribedEvent type EventsV1SubscribedEvent struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // Type of event being subscribed to. + // Type of event being subscribed to. Type *string `json:"type,omitempty"` - // The schema version that the subscription should use. + // The schema version that the subscription should use. SchemaVersion *int `json:"schema_version,omitempty"` - // The unique SID identifier of the Subscription. + // The unique SID identifier of the Subscription. SubscriptionSid *string `json:"subscription_sid,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/events/v1/model_events_v1_subscription.go b/rest/events/v1/model_events_v1_subscription.go index d5074e91d..606663899 100644 --- a/rest/events/v1/model_events_v1_subscription.go +++ b/rest/events/v1/model_events_v1_subscription.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // EventsV1Subscription struct for EventsV1Subscription type EventsV1Subscription struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // A 34 character string that uniquely identifies this Subscription. + // A 34 character string that uniquely identifies this Subscription. Sid *string `json:"sid,omitempty"` - // The date that this Subscription was created, given in ISO 8601 format. + // The date that this Subscription was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Subscription was updated, given in ISO 8601 format. + // The date that this Subscription was updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // A human readable description for the Subscription + // A human readable description for the Subscription Description *string `json:"description,omitempty"` - // The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + // The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. SinkSid *string `json:"sink_sid,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this Subscription. + // Contains a dictionary of URL links to nested resources of this Subscription. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/events/v1/model_list_event_type_response.go b/rest/events/v1/model_list_event_type_response.go index 151f08665..fda36d4df 100644 --- a/rest/events/v1/model_list_event_type_response.go +++ b/rest/events/v1/model_list_event_type_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEventTypeResponse struct for ListEventTypeResponse type ListEventTypeResponse struct { - Types []EventsV1EventType `json:"types,omitempty"` - Meta ListEventTypeResponseMeta `json:"meta,omitempty"` + Types []EventsV1EventType `json:"types,omitempty"` + Meta ListEventTypeResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/events/v1/model_list_event_type_response_meta.go b/rest/events/v1/model_list_event_type_response_meta.go index 16567c764..9b550d6d5 100644 --- a/rest/events/v1/model_list_event_type_response_meta.go +++ b/rest/events/v1/model_list_event_type_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEventTypeResponseMeta struct for ListEventTypeResponseMeta type ListEventTypeResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/events/v1/model_list_schema_version_response.go b/rest/events/v1/model_list_schema_version_response.go index 930164977..f9d1539b0 100644 --- a/rest/events/v1/model_list_schema_version_response.go +++ b/rest/events/v1/model_list_schema_version_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSchemaVersionResponse struct for ListSchemaVersionResponse type ListSchemaVersionResponse struct { - SchemaVersions []EventsV1SchemaVersion `json:"schema_versions,omitempty"` - Meta ListEventTypeResponseMeta `json:"meta,omitempty"` + SchemaVersions []EventsV1SchemaVersion `json:"schema_versions,omitempty"` + Meta ListEventTypeResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/events/v1/model_list_sink_response.go b/rest/events/v1/model_list_sink_response.go index 1845aeabd..c468fff0f 100644 --- a/rest/events/v1/model_list_sink_response.go +++ b/rest/events/v1/model_list_sink_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSinkResponse struct for ListSinkResponse type ListSinkResponse struct { - Sinks []EventsV1Sink `json:"sinks,omitempty"` - Meta ListEventTypeResponseMeta `json:"meta,omitempty"` + Sinks []EventsV1Sink `json:"sinks,omitempty"` + Meta ListEventTypeResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/events/v1/model_list_subscribed_event_response.go b/rest/events/v1/model_list_subscribed_event_response.go index 5e596d671..ee88ffbe5 100644 --- a/rest/events/v1/model_list_subscribed_event_response.go +++ b/rest/events/v1/model_list_subscribed_event_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSubscribedEventResponse struct for ListSubscribedEventResponse type ListSubscribedEventResponse struct { Types []EventsV1SubscribedEvent `json:"types,omitempty"` - Meta ListEventTypeResponseMeta `json:"meta,omitempty"` + Meta ListEventTypeResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/events/v1/model_list_subscription_response.go b/rest/events/v1/model_list_subscription_response.go index 67c776e49..352a6c3be 100644 --- a/rest/events/v1/model_list_subscription_response.go +++ b/rest/events/v1/model_list_subscription_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSubscriptionResponse struct for ListSubscriptionResponse type ListSubscriptionResponse struct { - Subscriptions []EventsV1Subscription `json:"subscriptions,omitempty"` - Meta ListEventTypeResponseMeta `json:"meta,omitempty"` + Subscriptions []EventsV1Subscription `json:"subscriptions,omitempty"` + Meta ListEventTypeResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/events/v1/schemas.go b/rest/events/v1/schemas.go index f17c80ec5..1f98ae5b8 100644 --- a/rest/events/v1/schemas.go +++ b/rest/events/v1/schemas.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch a specific schema with its nested versions. -func (c *ApiService) FetchSchema(Id string) (*EventsV1Schema, error) { - path := "/v1/Schemas/{Id}" - path = strings.Replace(path, "{"+"Id"+"}", Id, -1) +func (c *ApiService) FetchSchema(Id string, ) (*EventsV1Schema, error) { + path := "/v1/Schemas/{Id}" + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &EventsV1Schema{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &EventsV1Schema{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/schemas_versions.go b/rest/events/v1/schemas_versions.go index 84aaa0292..f2b3154e7 100644 --- a/rest/events/v1/schemas_versions.go +++ b/rest/events/v1/schemas_versions.go @@ -18,85 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific schema and version. -func (c *ApiService) FetchSchemaVersion(Id string, SchemaVersion int) (*EventsV1SchemaVersion, error) { - path := "/v1/Schemas/{Id}/Versions/{SchemaVersion}" - path = strings.Replace(path, "{"+"Id"+"}", Id, -1) - path = strings.Replace(path, "{"+"SchemaVersion"+"}", fmt.Sprint(SchemaVersion), -1) +func (c *ApiService) FetchSchemaVersion(Id string, SchemaVersion int, ) (*EventsV1SchemaVersion, error) { + path := "/v1/Schemas/{Id}/Versions/{SchemaVersion}" + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + path = strings.Replace(path, "{"+"SchemaVersion"+"}", fmt.Sprint(SchemaVersion), -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &EventsV1SchemaVersion{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &EventsV1SchemaVersion{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSchemaVersion' type ListSchemaVersionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSchemaVersionParams) SetPageSize(PageSize int) *ListSchemaVersionParams { - params.PageSize = &PageSize - return params +func (params *ListSchemaVersionParams) SetPageSize(PageSize int) (*ListSchemaVersionParams){ + params.PageSize = &PageSize + return params } -func (params *ListSchemaVersionParams) SetLimit(Limit int) *ListSchemaVersionParams { - params.Limit = &Limit - return params +func (params *ListSchemaVersionParams) SetLimit(Limit int) (*ListSchemaVersionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SchemaVersion records from the API. Request is executed immediately. func (c *ApiService) PageSchemaVersion(Id string, params *ListSchemaVersionParams, pageToken, pageNumber string) (*ListSchemaVersionResponse, error) { - path := "/v1/Schemas/{Id}/Versions" + path := "/v1/Schemas/{Id}/Versions" - path = strings.Replace(path, "{"+"Id"+"}", Id, -1) + path = strings.Replace(path, "{"+"Id"+"}", Id, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSchemaVersionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSchemaVersionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SchemaVersion records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -137,6 +139,7 @@ func (c *ApiService) StreamSchemaVersion(Id string, params *ListSchemaVersionPar return recordChannel, errorChannel } + func (c *ApiService) streamSchemaVersion(response *ListSchemaVersionResponse, params *ListSchemaVersionParams, recordChannel chan EventsV1SchemaVersion, errorChannel chan error) { curRecord := 1 @@ -168,19 +171,20 @@ func (c *ApiService) streamSchemaVersion(response *ListSchemaVersionResponse, pa } func (c *ApiService) getNextListSchemaVersionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSchemaVersionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSchemaVersionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/events/v1/sinks.go b/rest/events/v1/sinks.go index d8be25b86..6556a66dc 100644 --- a/rest/events/v1/sinks.go +++ b/rest/events/v1/sinks.go @@ -18,179 +18,185 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSink' type CreateSinkParams struct { - // A human readable description for the Sink **This value should not contain PII.** - Description *string `json:"Description,omitempty"` - // The information required for Twilio to connect to the provided Sink encoded as JSON. - SinkConfiguration *interface{} `json:"SinkConfiguration,omitempty"` - // - SinkType *string `json:"SinkType,omitempty"` + // A human readable description for the Sink **This value should not contain PII.** + Description *string `json:"Description,omitempty"` + // The information required for Twilio to connect to the provided Sink encoded as JSON. + SinkConfiguration *interface{} `json:"SinkConfiguration,omitempty"` + // + SinkType *string `json:"SinkType,omitempty"` } -func (params *CreateSinkParams) SetDescription(Description string) *CreateSinkParams { - params.Description = &Description - return params +func (params *CreateSinkParams) SetDescription(Description string) (*CreateSinkParams){ + params.Description = &Description + return params } -func (params *CreateSinkParams) SetSinkConfiguration(SinkConfiguration interface{}) *CreateSinkParams { - params.SinkConfiguration = &SinkConfiguration - return params +func (params *CreateSinkParams) SetSinkConfiguration(SinkConfiguration interface{}) (*CreateSinkParams){ + params.SinkConfiguration = &SinkConfiguration + return params } -func (params *CreateSinkParams) SetSinkType(SinkType string) *CreateSinkParams { - params.SinkType = &SinkType - return params +func (params *CreateSinkParams) SetSinkType(SinkType string) (*CreateSinkParams){ + params.SinkType = &SinkType + return params } // Create a new Sink func (c *ApiService) CreateSink(params *CreateSinkParams) (*EventsV1Sink, error) { - path := "/v1/Sinks" + path := "/v1/Sinks" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.SinkConfiguration != nil { + v, err := json.Marshal(params.SinkConfiguration) - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.SinkConfiguration != nil { - v, err := json.Marshal(params.SinkConfiguration) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("SinkConfiguration", string(v)) + } + if params != nil && params.SinkType != nil { + data.Set("SinkType", *params.SinkType) + } - data.Set("SinkConfiguration", string(v)) - } - if params != nil && params.SinkType != nil { - data.Set("SinkType", *params.SinkType) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &EventsV1Sink{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &EventsV1Sink{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Sink. -func (c *ApiService) DeleteSink(Sid string) error { - path := "/v1/Sinks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSink(Sid string, ) (error) { + path := "/v1/Sinks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific Sink. -func (c *ApiService) FetchSink(Sid string) (*EventsV1Sink, error) { - path := "/v1/Sinks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSink(Sid string, ) (*EventsV1Sink, error) { + path := "/v1/Sinks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &EventsV1Sink{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &EventsV1Sink{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSink' type ListSinkParams struct { - // A boolean query parameter filtering the results to return sinks used/not used by a subscription. - InUse *bool `json:"InUse,omitempty"` - // A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // A boolean query parameter filtering the results to return sinks used/not used by a subscription. + InUse *bool `json:"InUse,omitempty"` + // A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSinkParams) SetInUse(InUse bool) *ListSinkParams { - params.InUse = &InUse - return params +func (params *ListSinkParams) SetInUse(InUse bool) (*ListSinkParams){ + params.InUse = &InUse + return params } -func (params *ListSinkParams) SetStatus(Status string) *ListSinkParams { - params.Status = &Status - return params +func (params *ListSinkParams) SetStatus(Status string) (*ListSinkParams){ + params.Status = &Status + return params } -func (params *ListSinkParams) SetPageSize(PageSize int) *ListSinkParams { - params.PageSize = &PageSize - return params +func (params *ListSinkParams) SetPageSize(PageSize int) (*ListSinkParams){ + params.PageSize = &PageSize + return params } -func (params *ListSinkParams) SetLimit(Limit int) *ListSinkParams { - params.Limit = &Limit - return params +func (params *ListSinkParams) SetLimit(Limit int) (*ListSinkParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Sink records from the API. Request is executed immediately. func (c *ApiService) PageSink(params *ListSinkParams, pageToken, pageNumber string) (*ListSinkResponse, error) { - path := "/v1/Sinks" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.InUse != nil { - data.Set("InUse", fmt.Sprint(*params.InUse)) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSinkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Sinks" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.InUse != nil { + data.Set("InUse", fmt.Sprint(*params.InUse)) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSinkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Sink records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -231,6 +237,7 @@ func (c *ApiService) StreamSink(params *ListSinkParams) (chan EventsV1Sink, chan return recordChannel, errorChannel } + func (c *ApiService) streamSink(response *ListSinkResponse, params *ListSinkParams, recordChannel chan EventsV1Sink, errorChannel chan error) { curRecord := 1 @@ -262,57 +269,59 @@ func (c *ApiService) streamSink(response *ListSinkResponse, params *ListSinkPara } func (c *ApiService) getNextListSinkResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSinkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSinkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSink' type UpdateSinkParams struct { - // A human readable description for the Sink **This value should not contain PII.** - Description *string `json:"Description,omitempty"` + // A human readable description for the Sink **This value should not contain PII.** + Description *string `json:"Description,omitempty"` } -func (params *UpdateSinkParams) SetDescription(Description string) *UpdateSinkParams { - params.Description = &Description - return params +func (params *UpdateSinkParams) SetDescription(Description string) (*UpdateSinkParams){ + params.Description = &Description + return params } // Update a specific Sink func (c *ApiService) UpdateSink(Sid string, params *UpdateSinkParams) (*EventsV1Sink, error) { - path := "/v1/Sinks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Sinks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &EventsV1Sink{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &EventsV1Sink{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/sinks_test_.go b/rest/events/v1/sinks_test_.go index 4fb88f431..443c0f6ff 100644 --- a/rest/events/v1/sinks_test_.go +++ b/rest/events/v1/sinks_test_.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Create a new Sink Test Event for the given Sink. -func (c *ApiService) CreateSinkTest(Sid string) (*EventsV1SinkTest, error) { - path := "/v1/Sinks/{Sid}/Test" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) CreateSinkTest(Sid string, ) (*EventsV1SinkTest, error) { + path := "/v1/Sinks/{Sid}/Test" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &EventsV1SinkTest{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &EventsV1SinkTest{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/sinks_validate.go b/rest/events/v1/sinks_validate.go index 691d80272..88653dc43 100644 --- a/rest/events/v1/sinks_validate.go +++ b/rest/events/v1/sinks_validate.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSinkValidate' type CreateSinkValidateParams struct { - // A 34 character string that uniquely identifies the test event for a Sink being validated. - TestId *string `json:"TestId,omitempty"` + // A 34 character string that uniquely identifies the test event for a Sink being validated. + TestId *string `json:"TestId,omitempty"` } -func (params *CreateSinkValidateParams) SetTestId(TestId string) *CreateSinkValidateParams { - params.TestId = &TestId - return params +func (params *CreateSinkValidateParams) SetTestId(TestId string) (*CreateSinkValidateParams){ + params.TestId = &TestId + return params } // Validate that a test event for a Sink was received. func (c *ApiService) CreateSinkValidate(Sid string, params *CreateSinkValidateParams) (*EventsV1SinkValidate, error) { - path := "/v1/Sinks/{Sid}/Validate" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Sinks/{Sid}/Validate" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TestId != nil { + data.Set("TestId", *params.TestId) + } - if params != nil && params.TestId != nil { - data.Set("TestId", *params.TestId) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &EventsV1SinkValidate{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &EventsV1SinkValidate{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/subscriptions.go b/rest/events/v1/subscriptions.go index d7dcbb567..db2569c70 100644 --- a/rest/events/v1/subscriptions.go +++ b/rest/events/v1/subscriptions.go @@ -18,172 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSubscription' type CreateSubscriptionParams struct { - // A human readable description for the Subscription **This value should not contain PII.** - Description *string `json:"Description,omitempty"` - // The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. - SinkSid *string `json:"SinkSid,omitempty"` - // An array of objects containing the subscribed Event Types - Types *[]interface{} `json:"Types,omitempty"` + // A human readable description for the Subscription **This value should not contain PII.** + Description *string `json:"Description,omitempty"` + // The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + SinkSid *string `json:"SinkSid,omitempty"` + // An array of objects containing the subscribed Event Types + Types *[]interface{} `json:"Types,omitempty"` } -func (params *CreateSubscriptionParams) SetDescription(Description string) *CreateSubscriptionParams { - params.Description = &Description - return params +func (params *CreateSubscriptionParams) SetDescription(Description string) (*CreateSubscriptionParams){ + params.Description = &Description + return params } -func (params *CreateSubscriptionParams) SetSinkSid(SinkSid string) *CreateSubscriptionParams { - params.SinkSid = &SinkSid - return params +func (params *CreateSubscriptionParams) SetSinkSid(SinkSid string) (*CreateSubscriptionParams){ + params.SinkSid = &SinkSid + return params } -func (params *CreateSubscriptionParams) SetTypes(Types []interface{}) *CreateSubscriptionParams { - params.Types = &Types - return params +func (params *CreateSubscriptionParams) SetTypes(Types []interface{}) (*CreateSubscriptionParams){ + params.Types = &Types + return params } // Create a new Subscription. func (c *ApiService) CreateSubscription(params *CreateSubscriptionParams) (*EventsV1Subscription, error) { - path := "/v1/Subscriptions" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Subscriptions" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.SinkSid != nil { + data.Set("SinkSid", *params.SinkSid) + } + if params != nil && params.Types != nil { + for _, item := range *params.Types { + v, err := json.Marshal(item) + + if err != nil { + return nil, err + } + + data.Add("Types", string(v)) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &EventsV1Subscription{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.SinkSid != nil { - data.Set("SinkSid", *params.SinkSid) - } - if params != nil && params.Types != nil { - for _, item := range *params.Types { - v, err := json.Marshal(item) +// Delete a specific Subscription. +func (c *ApiService) DeleteSubscription(Sid string, ) (error) { + path := "/v1/Subscriptions/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - data.Add("Types", string(v)) - } - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - ps := &EventsV1Subscription{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + return nil } -// Delete a specific Subscription. -func (c *ApiService) DeleteSubscription(Sid string) error { - path := "/v1/Subscriptions/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) +// Fetch a specific Subscription. +func (c *ApiService) FetchSubscription(Sid string, ) (*EventsV1Subscription, error) { + path := "/v1/Subscriptions/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - return nil -} -// Fetch a specific Subscription. -func (c *ApiService) FetchSubscription(Sid string) (*EventsV1Subscription, error) { - path := "/v1/Subscriptions/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + ps := &EventsV1Subscription{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - defer resp.Body.Close() - - ps := &EventsV1Subscription{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListSubscription' type ListSubscriptionParams struct { - // The SID of the sink that the list of Subscriptions should be filtered by. - SinkSid *string `json:"SinkSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the sink that the list of Subscriptions should be filtered by. + SinkSid *string `json:"SinkSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSubscriptionParams) SetSinkSid(SinkSid string) *ListSubscriptionParams { - params.SinkSid = &SinkSid - return params +func (params *ListSubscriptionParams) SetSinkSid(SinkSid string) (*ListSubscriptionParams){ + params.SinkSid = &SinkSid + return params } -func (params *ListSubscriptionParams) SetPageSize(PageSize int) *ListSubscriptionParams { - params.PageSize = &PageSize - return params +func (params *ListSubscriptionParams) SetPageSize(PageSize int) (*ListSubscriptionParams){ + params.PageSize = &PageSize + return params } -func (params *ListSubscriptionParams) SetLimit(Limit int) *ListSubscriptionParams { - params.Limit = &Limit - return params +func (params *ListSubscriptionParams) SetLimit(Limit int) (*ListSubscriptionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Subscription records from the API. Request is executed immediately. func (c *ApiService) PageSubscription(params *ListSubscriptionParams, pageToken, pageNumber string) (*ListSubscriptionResponse, error) { - path := "/v1/Subscriptions" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.SinkSid != nil { - data.Set("SinkSid", *params.SinkSid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSubscriptionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Subscriptions" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.SinkSid != nil { + data.Set("SinkSid", *params.SinkSid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSubscriptionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Subscription records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -224,6 +230,7 @@ func (c *ApiService) StreamSubscription(params *ListSubscriptionParams) (chan Ev return recordChannel, errorChannel } + func (c *ApiService) streamSubscription(response *ListSubscriptionResponse, params *ListSubscriptionParams, recordChannel chan EventsV1Subscription, errorChannel chan error) { curRecord := 1 @@ -255,66 +262,68 @@ func (c *ApiService) streamSubscription(response *ListSubscriptionResponse, para } func (c *ApiService) getNextListSubscriptionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSubscriptionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSubscriptionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSubscription' type UpdateSubscriptionParams struct { - // A human readable description for the Subscription. - Description *string `json:"Description,omitempty"` - // The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. - SinkSid *string `json:"SinkSid,omitempty"` + // A human readable description for the Subscription. + Description *string `json:"Description,omitempty"` + // The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + SinkSid *string `json:"SinkSid,omitempty"` } -func (params *UpdateSubscriptionParams) SetDescription(Description string) *UpdateSubscriptionParams { - params.Description = &Description - return params +func (params *UpdateSubscriptionParams) SetDescription(Description string) (*UpdateSubscriptionParams){ + params.Description = &Description + return params } -func (params *UpdateSubscriptionParams) SetSinkSid(SinkSid string) *UpdateSubscriptionParams { - params.SinkSid = &SinkSid - return params +func (params *UpdateSubscriptionParams) SetSinkSid(SinkSid string) (*UpdateSubscriptionParams){ + params.SinkSid = &SinkSid + return params } // Update a Subscription. func (c *ApiService) UpdateSubscription(Sid string, params *UpdateSubscriptionParams) (*EventsV1Subscription, error) { - path := "/v1/Subscriptions/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Subscriptions/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.SinkSid != nil { - data.Set("SinkSid", *params.SinkSid) - } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.SinkSid != nil { + data.Set("SinkSid", *params.SinkSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &EventsV1Subscription{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &EventsV1Subscription{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/subscriptions_subscribed_events.go b/rest/events/v1/subscriptions_subscribed_events.go index 0c2d85e0c..c63d37d57 100644 --- a/rest/events/v1/subscriptions_subscribed_events.go +++ b/rest/events/v1/subscriptions_subscribed_events.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSubscribedEvent' type CreateSubscribedEventParams struct { - // Type of event being subscribed to. - Type *string `json:"Type,omitempty"` - // The schema version that the subscription should use. - SchemaVersion *int `json:"SchemaVersion,omitempty"` + // Type of event being subscribed to. + Type *string `json:"Type,omitempty"` + // The schema version that the subscription should use. + SchemaVersion *int `json:"SchemaVersion,omitempty"` } -func (params *CreateSubscribedEventParams) SetType(Type string) *CreateSubscribedEventParams { - params.Type = &Type - return params +func (params *CreateSubscribedEventParams) SetType(Type string) (*CreateSubscribedEventParams){ + params.Type = &Type + return params } -func (params *CreateSubscribedEventParams) SetSchemaVersion(SchemaVersion int) *CreateSubscribedEventParams { - params.SchemaVersion = &SchemaVersion - return params +func (params *CreateSubscribedEventParams) SetSchemaVersion(SchemaVersion int) (*CreateSubscribedEventParams){ + params.SchemaVersion = &SchemaVersion + return params } // Create a new Subscribed Event type for the subscription func (c *ApiService) CreateSubscribedEvent(SubscriptionSid string, params *CreateSubscribedEventParams) (*EventsV1SubscribedEvent, error) { - path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents" - path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) + path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents" + path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.SchemaVersion != nil { - data.Set("SchemaVersion", fmt.Sprint(*params.SchemaVersion)) - } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.SchemaVersion != nil { + data.Set("SchemaVersion", fmt.Sprint(*params.SchemaVersion)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &EventsV1SubscribedEvent{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &EventsV1SubscribedEvent{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an event type from a subscription. -func (c *ApiService) DeleteSubscribedEvent(SubscriptionSid string, Type string) error { - path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}" - path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) - path = strings.Replace(path, "{"+"Type"+"}", Type, -1) +func (c *ApiService) DeleteSubscribedEvent(SubscriptionSid string, Type string, ) (error) { + path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}" + path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) + path = strings.Replace(path, "{"+"Type"+"}", Type, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Read an Event for a Subscription. -func (c *ApiService) FetchSubscribedEvent(SubscriptionSid string, Type string) (*EventsV1SubscribedEvent, error) { - path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}" - path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) - path = strings.Replace(path, "{"+"Type"+"}", Type, -1) +func (c *ApiService) FetchSubscribedEvent(SubscriptionSid string, Type string, ) (*EventsV1SubscribedEvent, error) { + path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}" + path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) + path = strings.Replace(path, "{"+"Type"+"}", Type, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &EventsV1SubscribedEvent{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &EventsV1SubscribedEvent{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSubscribedEvent' type ListSubscribedEventParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSubscribedEventParams) SetPageSize(PageSize int) *ListSubscribedEventParams { - params.PageSize = &PageSize - return params +func (params *ListSubscribedEventParams) SetPageSize(PageSize int) (*ListSubscribedEventParams){ + params.PageSize = &PageSize + return params } -func (params *ListSubscribedEventParams) SetLimit(Limit int) *ListSubscribedEventParams { - params.Limit = &Limit - return params +func (params *ListSubscribedEventParams) SetLimit(Limit int) (*ListSubscribedEventParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SubscribedEvent records from the API. Request is executed immediately. func (c *ApiService) PageSubscribedEvent(SubscriptionSid string, params *ListSubscribedEventParams, pageToken, pageNumber string) (*ListSubscribedEventResponse, error) { - path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents" + path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents" - path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) + path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSubscribedEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSubscribedEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SubscribedEvent records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamSubscribedEvent(SubscriptionSid string, params *ListS return recordChannel, errorChannel } + func (c *ApiService) streamSubscribedEvent(response *ListSubscribedEventResponse, params *ListSubscribedEventParams, recordChannel chan EventsV1SubscribedEvent, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamSubscribedEvent(response *ListSubscribedEventResponse } func (c *ApiService) getNextListSubscribedEventResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSubscribedEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSubscribedEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSubscribedEvent' type UpdateSubscribedEventParams struct { - // The schema version that the subscription should use. - SchemaVersion *int `json:"SchemaVersion,omitempty"` + // The schema version that the subscription should use. + SchemaVersion *int `json:"SchemaVersion,omitempty"` } -func (params *UpdateSubscribedEventParams) SetSchemaVersion(SchemaVersion int) *UpdateSubscribedEventParams { - params.SchemaVersion = &SchemaVersion - return params +func (params *UpdateSubscribedEventParams) SetSchemaVersion(SchemaVersion int) (*UpdateSubscribedEventParams){ + params.SchemaVersion = &SchemaVersion + return params } // Update an Event for a Subscription. func (c *ApiService) UpdateSubscribedEvent(SubscriptionSid string, Type string, params *UpdateSubscribedEventParams) (*EventsV1SubscribedEvent, error) { - path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}" - path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) - path = strings.Replace(path, "{"+"Type"+"}", Type, -1) + path := "/v1/Subscriptions/{SubscriptionSid}/SubscribedEvents/{Type}" + path = strings.Replace(path, "{"+"SubscriptionSid"+"}", SubscriptionSid, -1) + path = strings.Replace(path, "{"+"Type"+"}", Type, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.SchemaVersion != nil { - data.Set("SchemaVersion", fmt.Sprint(*params.SchemaVersion)) - } + if params != nil && params.SchemaVersion != nil { + data.Set("SchemaVersion", fmt.Sprint(*params.SchemaVersion)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &EventsV1SubscribedEvent{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &EventsV1SubscribedEvent{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/events/v1/types.go b/rest/events/v1/types.go index a0423bc62..69ac416a4 100644 --- a/rest/events/v1/types.go +++ b/rest/events/v1/types.go @@ -18,91 +18,94 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Event Type. -func (c *ApiService) FetchEventType(Type string) (*EventsV1EventType, error) { - path := "/v1/Types/{Type}" - path = strings.Replace(path, "{"+"Type"+"}", Type, -1) +func (c *ApiService) FetchEventType(Type string, ) (*EventsV1EventType, error) { + path := "/v1/Types/{Type}" + path = strings.Replace(path, "{"+"Type"+"}", Type, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &EventsV1EventType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &EventsV1EventType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEventType' type ListEventTypeParams struct { - // A string parameter filtering the results to return only the Event Types using a given schema. - SchemaId *string `json:"SchemaId,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // A string parameter filtering the results to return only the Event Types using a given schema. + SchemaId *string `json:"SchemaId,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEventTypeParams) SetSchemaId(SchemaId string) *ListEventTypeParams { - params.SchemaId = &SchemaId - return params +func (params *ListEventTypeParams) SetSchemaId(SchemaId string) (*ListEventTypeParams){ + params.SchemaId = &SchemaId + return params } -func (params *ListEventTypeParams) SetPageSize(PageSize int) *ListEventTypeParams { - params.PageSize = &PageSize - return params +func (params *ListEventTypeParams) SetPageSize(PageSize int) (*ListEventTypeParams){ + params.PageSize = &PageSize + return params } -func (params *ListEventTypeParams) SetLimit(Limit int) *ListEventTypeParams { - params.Limit = &Limit - return params +func (params *ListEventTypeParams) SetLimit(Limit int) (*ListEventTypeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of EventType records from the API. Request is executed immediately. func (c *ApiService) PageEventType(params *ListEventTypeParams, pageToken, pageNumber string) (*ListEventTypeResponse, error) { - path := "/v1/Types" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.SchemaId != nil { - data.Set("SchemaId", *params.SchemaId) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Types" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.SchemaId != nil { + data.Set("SchemaId", *params.SchemaId) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists EventType records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -143,6 +146,7 @@ func (c *ApiService) StreamEventType(params *ListEventTypeParams) (chan EventsV1 return recordChannel, errorChannel } + func (c *ApiService) streamEventType(response *ListEventTypeResponse, params *ListEventTypeParams, recordChannel chan EventsV1EventType, errorChannel chan error) { curRecord := 1 @@ -174,19 +178,20 @@ func (c *ApiService) streamEventType(response *ListEventTypeResponse, params *Li } func (c *ApiService) getNextListEventTypeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/flex/v1/README.md b/rest/flex/v1/README.md index 529ea439c..7c2b3dcd7 100644 --- a/rest/flex/v1/README.md +++ b/rest/flex/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -31,12 +31,12 @@ All URIs are relative to *https://flex-api.twilio.com* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AccountProvisionStatusApi* | [**FetchProvisioningStatus**](docs/AccountProvisionStatusApi.md#fetchprovisioningstatus) | **Get** /v1/account/provision/status | *ChannelsApi* | [**CreateChannel**](docs/ChannelsApi.md#createchannel) | **Post** /v1/Channels | *ChannelsApi* | [**DeleteChannel**](docs/ChannelsApi.md#deletechannel) | **Delete** /v1/Channels/{Sid} | *ChannelsApi* | [**FetchChannel**](docs/ChannelsApi.md#fetchchannel) | **Get** /v1/Channels/{Sid} | *ChannelsApi* | [**ListChannel**](docs/ChannelsApi.md#listchannel) | **Get** /v1/Channels | *ConfigurationApi* | [**FetchConfiguration**](docs/ConfigurationApi.md#fetchconfiguration) | **Get** /v1/Configuration | +*ConfigurationApi* | [**UpdateConfiguration**](docs/ConfigurationApi.md#updateconfiguration) | **Post** /v1/Configuration | *FlexFlowsApi* | [**CreateFlexFlow**](docs/FlexFlowsApi.md#createflexflow) | **Post** /v1/FlexFlows | *FlexFlowsApi* | [**DeleteFlexFlow**](docs/FlexFlowsApi.md#deleteflexflow) | **Delete** /v1/FlexFlows/{Sid} | *FlexFlowsApi* | [**FetchFlexFlow**](docs/FlexFlowsApi.md#fetchflexflow) | **Get** /v1/FlexFlows/{Sid} | @@ -116,7 +116,6 @@ Class | Method | HTTP request | Description - [FlexV1InsightsAssessments](docs/FlexV1InsightsAssessments.md) - [FlexV1InsightsConversations](docs/FlexV1InsightsConversations.md) - [FlexV1InsightsQuestionnairesCategory](docs/FlexV1InsightsQuestionnairesCategory.md) - - [FlexV1ProvisioningStatus](docs/FlexV1ProvisioningStatus.md) - [ListChannelResponseMeta](docs/ListChannelResponseMeta.md) - [ListInteractionChannelInviteResponse](docs/ListInteractionChannelInviteResponse.md) diff --git a/rest/flex/v1/api_service.go b/rest/flex/v1/api_service.go index f6d8c27bc..8e6c04cd7 100644 --- a/rest/flex/v1/api_service.go +++ b/rest/flex/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://flex-api.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/flex/v1/channels.go b/rest/flex/v1/channels.go index ddf91c9f7..e5d00ed74 100644 --- a/rest/flex/v1/channels.go +++ b/rest/flex/v1/channels.go @@ -18,218 +18,224 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannel' type CreateChannelParams struct { - // The SID of the Flex Flow. - FlexFlowSid *string `json:"FlexFlowSid,omitempty"` - // The `identity` value that uniquely identifies the new resource's chat User. - Identity *string `json:"Identity,omitempty"` - // The chat participant's friendly name. - ChatUserFriendlyName *string `json:"ChatUserFriendlyName,omitempty"` - // The chat channel's friendly name. - ChatFriendlyName *string `json:"ChatFriendlyName,omitempty"` - // The Target Contact Identity, for example the phone number of an SMS. - Target *string `json:"Target,omitempty"` - // The chat channel's unique name. - ChatUniqueName *string `json:"ChatUniqueName,omitempty"` - // The pre-engagement data. - PreEngagementData *string `json:"PreEngagementData,omitempty"` - // The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` - TaskSid *string `json:"TaskSid,omitempty"` - // The Task attributes to be added for the TaskRouter Task. - TaskAttributes *string `json:"TaskAttributes,omitempty"` - // Whether to create the channel as long-lived. - LongLived *bool `json:"LongLived,omitempty"` + // The SID of the Flex Flow. + FlexFlowSid *string `json:"FlexFlowSid,omitempty"` + // The `identity` value that uniquely identifies the new resource's chat User. + Identity *string `json:"Identity,omitempty"` + // The chat participant's friendly name. + ChatUserFriendlyName *string `json:"ChatUserFriendlyName,omitempty"` + // The chat channel's friendly name. + ChatFriendlyName *string `json:"ChatFriendlyName,omitempty"` + // The Target Contact Identity, for example the phone number of an SMS. + Target *string `json:"Target,omitempty"` + // The chat channel's unique name. + ChatUniqueName *string `json:"ChatUniqueName,omitempty"` + // The pre-engagement data. + PreEngagementData *string `json:"PreEngagementData,omitempty"` + // The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` + TaskSid *string `json:"TaskSid,omitempty"` + // The Task attributes to be added for the TaskRouter Task. + TaskAttributes *string `json:"TaskAttributes,omitempty"` + // Whether to create the channel as long-lived. + LongLived *bool `json:"LongLived,omitempty"` } -func (params *CreateChannelParams) SetFlexFlowSid(FlexFlowSid string) *CreateChannelParams { - params.FlexFlowSid = &FlexFlowSid - return params +func (params *CreateChannelParams) SetFlexFlowSid(FlexFlowSid string) (*CreateChannelParams){ + params.FlexFlowSid = &FlexFlowSid + return params } -func (params *CreateChannelParams) SetIdentity(Identity string) *CreateChannelParams { - params.Identity = &Identity - return params +func (params *CreateChannelParams) SetIdentity(Identity string) (*CreateChannelParams){ + params.Identity = &Identity + return params } -func (params *CreateChannelParams) SetChatUserFriendlyName(ChatUserFriendlyName string) *CreateChannelParams { - params.ChatUserFriendlyName = &ChatUserFriendlyName - return params +func (params *CreateChannelParams) SetChatUserFriendlyName(ChatUserFriendlyName string) (*CreateChannelParams){ + params.ChatUserFriendlyName = &ChatUserFriendlyName + return params } -func (params *CreateChannelParams) SetChatFriendlyName(ChatFriendlyName string) *CreateChannelParams { - params.ChatFriendlyName = &ChatFriendlyName - return params +func (params *CreateChannelParams) SetChatFriendlyName(ChatFriendlyName string) (*CreateChannelParams){ + params.ChatFriendlyName = &ChatFriendlyName + return params } -func (params *CreateChannelParams) SetTarget(Target string) *CreateChannelParams { - params.Target = &Target - return params +func (params *CreateChannelParams) SetTarget(Target string) (*CreateChannelParams){ + params.Target = &Target + return params } -func (params *CreateChannelParams) SetChatUniqueName(ChatUniqueName string) *CreateChannelParams { - params.ChatUniqueName = &ChatUniqueName - return params +func (params *CreateChannelParams) SetChatUniqueName(ChatUniqueName string) (*CreateChannelParams){ + params.ChatUniqueName = &ChatUniqueName + return params } -func (params *CreateChannelParams) SetPreEngagementData(PreEngagementData string) *CreateChannelParams { - params.PreEngagementData = &PreEngagementData - return params +func (params *CreateChannelParams) SetPreEngagementData(PreEngagementData string) (*CreateChannelParams){ + params.PreEngagementData = &PreEngagementData + return params } -func (params *CreateChannelParams) SetTaskSid(TaskSid string) *CreateChannelParams { - params.TaskSid = &TaskSid - return params +func (params *CreateChannelParams) SetTaskSid(TaskSid string) (*CreateChannelParams){ + params.TaskSid = &TaskSid + return params } -func (params *CreateChannelParams) SetTaskAttributes(TaskAttributes string) *CreateChannelParams { - params.TaskAttributes = &TaskAttributes - return params +func (params *CreateChannelParams) SetTaskAttributes(TaskAttributes string) (*CreateChannelParams){ + params.TaskAttributes = &TaskAttributes + return params } -func (params *CreateChannelParams) SetLongLived(LongLived bool) *CreateChannelParams { - params.LongLived = &LongLived - return params +func (params *CreateChannelParams) SetLongLived(LongLived bool) (*CreateChannelParams){ + params.LongLived = &LongLived + return params } -// +// func (c *ApiService) CreateChannel(params *CreateChannelParams) (*FlexV1Channel, error) { - path := "/v1/Channels" + path := "/v1/Channels" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FlexFlowSid != nil { + data.Set("FlexFlowSid", *params.FlexFlowSid) + } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.ChatUserFriendlyName != nil { + data.Set("ChatUserFriendlyName", *params.ChatUserFriendlyName) + } + if params != nil && params.ChatFriendlyName != nil { + data.Set("ChatFriendlyName", *params.ChatFriendlyName) + } + if params != nil && params.Target != nil { + data.Set("Target", *params.Target) + } + if params != nil && params.ChatUniqueName != nil { + data.Set("ChatUniqueName", *params.ChatUniqueName) + } + if params != nil && params.PreEngagementData != nil { + data.Set("PreEngagementData", *params.PreEngagementData) + } + if params != nil && params.TaskSid != nil { + data.Set("TaskSid", *params.TaskSid) + } + if params != nil && params.TaskAttributes != nil { + data.Set("TaskAttributes", *params.TaskAttributes) + } + if params != nil && params.LongLived != nil { + data.Set("LongLived", fmt.Sprint(*params.LongLived)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FlexV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteChannel(Sid string, ) (error) { + path := "/v1/Channels/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FlexFlowSid != nil { - data.Set("FlexFlowSid", *params.FlexFlowSid) - } - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.ChatUserFriendlyName != nil { - data.Set("ChatUserFriendlyName", *params.ChatUserFriendlyName) - } - if params != nil && params.ChatFriendlyName != nil { - data.Set("ChatFriendlyName", *params.ChatFriendlyName) - } - if params != nil && params.Target != nil { - data.Set("Target", *params.Target) - } - if params != nil && params.ChatUniqueName != nil { - data.Set("ChatUniqueName", *params.ChatUniqueName) - } - if params != nil && params.PreEngagementData != nil { - data.Set("PreEngagementData", *params.PreEngagementData) - } - if params != nil && params.TaskSid != nil { - data.Set("TaskSid", *params.TaskSid) - } - if params != nil && params.TaskAttributes != nil { - data.Set("TaskAttributes", *params.TaskAttributes) - } - if params != nil && params.LongLived != nil { - data.Set("LongLived", fmt.Sprint(*params.LongLived)) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &FlexV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() - return ps, err + return nil } -// -func (c *ApiService) DeleteChannel(Sid string) error { - path := "/v1/Channels/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchChannel(Sid string, ) (*FlexV1Channel, error) { + path := "/v1/Channels/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil -} + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } -// -func (c *ApiService) FetchChannel(Sid string) (*FlexV1Channel, error) { - path := "/v1/Channels/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + ps := &FlexV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &FlexV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListChannel' type ListChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelParams) SetPageSize(PageSize int) *ListChannelParams { - params.PageSize = &PageSize - return params +func (params *ListChannelParams) SetPageSize(PageSize int) (*ListChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelParams) SetLimit(Limit int) *ListChannelParams { - params.Limit = &Limit - return params +func (params *ListChannelParams) SetLimit(Limit int) (*ListChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Channel records from the API. Request is executed immediately. func (c *ApiService) PageChannel(params *ListChannelParams, pageToken, pageNumber string) (*ListChannelResponse, error) { - path := "/v1/Channels" + path := "/v1/Channels" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Channel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -270,6 +276,7 @@ func (c *ApiService) StreamChannel(params *ListChannelParams) (chan FlexV1Channe return recordChannel, errorChannel } + func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListChannelParams, recordChannel chan FlexV1Channel, errorChannel chan error) { curRecord := 1 @@ -301,19 +308,20 @@ func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListCh } func (c *ApiService) getNextListChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/flex/v1/configuration.go b/rest/flex/v1/configuration.go index a106cb399..9d0788902 100644 --- a/rest/flex/v1/configuration.go +++ b/rest/flex/v1/configuration.go @@ -16,42 +16,71 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchConfiguration' type FetchConfigurationParams struct { - // The Pinned UI version of the Configuration resource to fetch. - UiVersion *string `json:"UiVersion,omitempty"` + // The Pinned UI version of the Configuration resource to fetch. + UiVersion *string `json:"UiVersion,omitempty"` } -func (params *FetchConfigurationParams) SetUiVersion(UiVersion string) *FetchConfigurationParams { - params.UiVersion = &UiVersion - return params +func (params *FetchConfigurationParams) SetUiVersion(UiVersion string) (*FetchConfigurationParams){ + params.UiVersion = &UiVersion + return params } -// +// func (c *ApiService) FetchConfiguration(params *FetchConfigurationParams) (*FlexV1Configuration, error) { - path := "/v1/Configuration" + path := "/v1/Configuration" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UiVersion != nil { + data.Set("UiVersion", *params.UiVersion) + } + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FlexV1Configuration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// +func (c *ApiService) UpdateConfiguration() (*FlexV1Configuration, error) { + path := "/v1/Configuration" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - if params != nil && params.UiVersion != nil { - data.Set("UiVersion", *params.UiVersion) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1Configuration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1Configuration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/docs/ConfigurationApi.md b/rest/flex/v1/docs/ConfigurationApi.md index 587f244f9..947d466ba 100644 --- a/rest/flex/v1/docs/ConfigurationApi.md +++ b/rest/flex/v1/docs/ConfigurationApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://flex-api.twilio.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**FetchConfiguration**](ConfigurationApi.md#FetchConfiguration) | **Get** /v1/Configuration | +[**UpdateConfiguration**](ConfigurationApi.md#UpdateConfiguration) | **Post** /v1/Configuration | @@ -46,3 +47,38 @@ Name | Type | Description [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## UpdateConfiguration + +> FlexV1Configuration UpdateConfiguration(ctx, ) + + + + + +### Path Parameters + +This endpoint does not need any path parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a UpdateConfigurationParams struct + + +### Return type + +[**FlexV1Configuration**](FlexV1Configuration.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/rest/flex/v1/docs/FlexV1Configuration.md b/rest/flex/v1/docs/FlexV1Configuration.md index 61cb24f21..05a7f0344 100644 --- a/rest/flex/v1/docs/FlexV1Configuration.md +++ b/rest/flex/v1/docs/FlexV1Configuration.md @@ -51,7 +51,6 @@ Name | Type | Description | Notes **FlexUiStatusReport** | Pointer to **interface{}** | Configurable parameters for Flex UI Status report. | **AgentConvEndMethods** | Pointer to **interface{}** | Agent conversation end methods. | **CitrixVoiceVdi** | Pointer to **interface{}** | Citrix voice vdi configuration and settings. | -**OfflineConfig** | Pointer to **interface{}** | Presence and presence ttl configuration | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/flex/v1/docs/ListChannelResponseMeta.md b/rest/flex/v1/docs/ListChannelResponseMeta.md index d507879b9..b007fb5e6 100644 --- a/rest/flex/v1/docs/ListChannelResponseMeta.md +++ b/rest/flex/v1/docs/ListChannelResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/flex/v1/flex_flows.go b/rest/flex/v1/flex_flows.go index 705066713..e05a35ddc 100644 --- a/rest/flex/v1/flex_flows.go +++ b/rest/flex/v1/flex_flows.go @@ -18,290 +18,296 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateFlexFlow' type CreateFlexFlowParams struct { - // A descriptive string that you create to describe the Flex Flow resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the chat service. - ChatServiceSid *string `json:"ChatServiceSid,omitempty"` - // - ChannelType *string `json:"ChannelType,omitempty"` - // The channel contact's Identity. - ContactIdentity *string `json:"ContactIdentity,omitempty"` - // Whether the new Flex Flow is enabled. - Enabled *bool `json:"Enabled,omitempty"` - // - IntegrationType *string `json:"IntegrationType,omitempty"` - // The SID of the Studio Flow. Required when `integrationType` is `studio`. - IntegrationFlowSid *string `json:"Integration.FlowSid,omitempty"` - // The URL of the external webhook. Required when `integrationType` is `external`. - IntegrationUrl *string `json:"Integration.Url,omitempty"` - // The Workspace SID for a new Task. Required when `integrationType` is `task`. - IntegrationWorkspaceSid *string `json:"Integration.WorkspaceSid,omitempty"` - // The Workflow SID for a new Task. Required when `integrationType` is `task`. - IntegrationWorkflowSid *string `json:"Integration.WorkflowSid,omitempty"` - // 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`. - IntegrationChannel *string `json:"Integration.Channel,omitempty"` - // The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. - IntegrationTimeout *int `json:"Integration.Timeout,omitempty"` - // The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. - IntegrationPriority *int `json:"Integration.Priority,omitempty"` - // 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. - IntegrationCreationOnMessage *bool `json:"Integration.CreationOnMessage,omitempty"` - // 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`. - LongLived *bool `json:"LongLived,omitempty"` - // 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`. - JanitorEnabled *bool `json:"JanitorEnabled,omitempty"` - // 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. - IntegrationRetryCount *int `json:"Integration.RetryCount,omitempty"` -} - -func (params *CreateFlexFlowParams) SetFriendlyName(FriendlyName string) *CreateFlexFlowParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateFlexFlowParams) SetChatServiceSid(ChatServiceSid string) *CreateFlexFlowParams { - params.ChatServiceSid = &ChatServiceSid - return params -} -func (params *CreateFlexFlowParams) SetChannelType(ChannelType string) *CreateFlexFlowParams { - params.ChannelType = &ChannelType - return params -} -func (params *CreateFlexFlowParams) SetContactIdentity(ContactIdentity string) *CreateFlexFlowParams { - params.ContactIdentity = &ContactIdentity - return params -} -func (params *CreateFlexFlowParams) SetEnabled(Enabled bool) *CreateFlexFlowParams { - params.Enabled = &Enabled - return params -} -func (params *CreateFlexFlowParams) SetIntegrationType(IntegrationType string) *CreateFlexFlowParams { - params.IntegrationType = &IntegrationType - return params -} -func (params *CreateFlexFlowParams) SetIntegrationFlowSid(IntegrationFlowSid string) *CreateFlexFlowParams { - params.IntegrationFlowSid = &IntegrationFlowSid - return params -} -func (params *CreateFlexFlowParams) SetIntegrationUrl(IntegrationUrl string) *CreateFlexFlowParams { - params.IntegrationUrl = &IntegrationUrl - return params -} -func (params *CreateFlexFlowParams) SetIntegrationWorkspaceSid(IntegrationWorkspaceSid string) *CreateFlexFlowParams { - params.IntegrationWorkspaceSid = &IntegrationWorkspaceSid - return params -} -func (params *CreateFlexFlowParams) SetIntegrationWorkflowSid(IntegrationWorkflowSid string) *CreateFlexFlowParams { - params.IntegrationWorkflowSid = &IntegrationWorkflowSid - return params -} -func (params *CreateFlexFlowParams) SetIntegrationChannel(IntegrationChannel string) *CreateFlexFlowParams { - params.IntegrationChannel = &IntegrationChannel - return params -} -func (params *CreateFlexFlowParams) SetIntegrationTimeout(IntegrationTimeout int) *CreateFlexFlowParams { - params.IntegrationTimeout = &IntegrationTimeout - return params -} -func (params *CreateFlexFlowParams) SetIntegrationPriority(IntegrationPriority int) *CreateFlexFlowParams { - params.IntegrationPriority = &IntegrationPriority - return params -} -func (params *CreateFlexFlowParams) SetIntegrationCreationOnMessage(IntegrationCreationOnMessage bool) *CreateFlexFlowParams { - params.IntegrationCreationOnMessage = &IntegrationCreationOnMessage - return params -} -func (params *CreateFlexFlowParams) SetLongLived(LongLived bool) *CreateFlexFlowParams { - params.LongLived = &LongLived - return params -} -func (params *CreateFlexFlowParams) SetJanitorEnabled(JanitorEnabled bool) *CreateFlexFlowParams { - params.JanitorEnabled = &JanitorEnabled - return params -} -func (params *CreateFlexFlowParams) SetIntegrationRetryCount(IntegrationRetryCount int) *CreateFlexFlowParams { - params.IntegrationRetryCount = &IntegrationRetryCount - return params -} - -// + // A descriptive string that you create to describe the Flex Flow resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the chat service. + ChatServiceSid *string `json:"ChatServiceSid,omitempty"` + // + ChannelType *string `json:"ChannelType,omitempty"` + // The channel contact's Identity. + ContactIdentity *string `json:"ContactIdentity,omitempty"` + // Whether the new Flex Flow is enabled. + Enabled *bool `json:"Enabled,omitempty"` + // + IntegrationType *string `json:"IntegrationType,omitempty"` + // The SID of the Studio Flow. Required when `integrationType` is `studio`. + IntegrationFlowSid *string `json:"Integration.FlowSid,omitempty"` + // The URL of the external webhook. Required when `integrationType` is `external`. + IntegrationUrl *string `json:"Integration.Url,omitempty"` + // The Workspace SID for a new Task. Required when `integrationType` is `task`. + IntegrationWorkspaceSid *string `json:"Integration.WorkspaceSid,omitempty"` + // The Workflow SID for a new Task. Required when `integrationType` is `task`. + IntegrationWorkflowSid *string `json:"Integration.WorkflowSid,omitempty"` + // 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`. + IntegrationChannel *string `json:"Integration.Channel,omitempty"` + // The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. + IntegrationTimeout *int `json:"Integration.Timeout,omitempty"` + // The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. + IntegrationPriority *int `json:"Integration.Priority,omitempty"` + // 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. + IntegrationCreationOnMessage *bool `json:"Integration.CreationOnMessage,omitempty"` + // 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`. + LongLived *bool `json:"LongLived,omitempty"` + // 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`. + JanitorEnabled *bool `json:"JanitorEnabled,omitempty"` + // 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. + IntegrationRetryCount *int `json:"Integration.RetryCount,omitempty"` +} + +func (params *CreateFlexFlowParams) SetFriendlyName(FriendlyName string) (*CreateFlexFlowParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateFlexFlowParams) SetChatServiceSid(ChatServiceSid string) (*CreateFlexFlowParams){ + params.ChatServiceSid = &ChatServiceSid + return params +} +func (params *CreateFlexFlowParams) SetChannelType(ChannelType string) (*CreateFlexFlowParams){ + params.ChannelType = &ChannelType + return params +} +func (params *CreateFlexFlowParams) SetContactIdentity(ContactIdentity string) (*CreateFlexFlowParams){ + params.ContactIdentity = &ContactIdentity + return params +} +func (params *CreateFlexFlowParams) SetEnabled(Enabled bool) (*CreateFlexFlowParams){ + params.Enabled = &Enabled + return params +} +func (params *CreateFlexFlowParams) SetIntegrationType(IntegrationType string) (*CreateFlexFlowParams){ + params.IntegrationType = &IntegrationType + return params +} +func (params *CreateFlexFlowParams) SetIntegrationFlowSid(IntegrationFlowSid string) (*CreateFlexFlowParams){ + params.IntegrationFlowSid = &IntegrationFlowSid + return params +} +func (params *CreateFlexFlowParams) SetIntegrationUrl(IntegrationUrl string) (*CreateFlexFlowParams){ + params.IntegrationUrl = &IntegrationUrl + return params +} +func (params *CreateFlexFlowParams) SetIntegrationWorkspaceSid(IntegrationWorkspaceSid string) (*CreateFlexFlowParams){ + params.IntegrationWorkspaceSid = &IntegrationWorkspaceSid + return params +} +func (params *CreateFlexFlowParams) SetIntegrationWorkflowSid(IntegrationWorkflowSid string) (*CreateFlexFlowParams){ + params.IntegrationWorkflowSid = &IntegrationWorkflowSid + return params +} +func (params *CreateFlexFlowParams) SetIntegrationChannel(IntegrationChannel string) (*CreateFlexFlowParams){ + params.IntegrationChannel = &IntegrationChannel + return params +} +func (params *CreateFlexFlowParams) SetIntegrationTimeout(IntegrationTimeout int) (*CreateFlexFlowParams){ + params.IntegrationTimeout = &IntegrationTimeout + return params +} +func (params *CreateFlexFlowParams) SetIntegrationPriority(IntegrationPriority int) (*CreateFlexFlowParams){ + params.IntegrationPriority = &IntegrationPriority + return params +} +func (params *CreateFlexFlowParams) SetIntegrationCreationOnMessage(IntegrationCreationOnMessage bool) (*CreateFlexFlowParams){ + params.IntegrationCreationOnMessage = &IntegrationCreationOnMessage + return params +} +func (params *CreateFlexFlowParams) SetLongLived(LongLived bool) (*CreateFlexFlowParams){ + params.LongLived = &LongLived + return params +} +func (params *CreateFlexFlowParams) SetJanitorEnabled(JanitorEnabled bool) (*CreateFlexFlowParams){ + params.JanitorEnabled = &JanitorEnabled + return params +} +func (params *CreateFlexFlowParams) SetIntegrationRetryCount(IntegrationRetryCount int) (*CreateFlexFlowParams){ + params.IntegrationRetryCount = &IntegrationRetryCount + return params +} + +// func (c *ApiService) CreateFlexFlow(params *CreateFlexFlowParams) (*FlexV1FlexFlow, error) { - path := "/v1/FlexFlows" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ChatServiceSid != nil { - data.Set("ChatServiceSid", *params.ChatServiceSid) - } - if params != nil && params.ChannelType != nil { - data.Set("ChannelType", *params.ChannelType) - } - if params != nil && params.ContactIdentity != nil { - data.Set("ContactIdentity", *params.ContactIdentity) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.IntegrationType != nil { - data.Set("IntegrationType", *params.IntegrationType) - } - if params != nil && params.IntegrationFlowSid != nil { - data.Set("Integration.FlowSid", *params.IntegrationFlowSid) - } - if params != nil && params.IntegrationUrl != nil { - data.Set("Integration.Url", *params.IntegrationUrl) - } - if params != nil && params.IntegrationWorkspaceSid != nil { - data.Set("Integration.WorkspaceSid", *params.IntegrationWorkspaceSid) - } - if params != nil && params.IntegrationWorkflowSid != nil { - data.Set("Integration.WorkflowSid", *params.IntegrationWorkflowSid) - } - if params != nil && params.IntegrationChannel != nil { - data.Set("Integration.Channel", *params.IntegrationChannel) - } - if params != nil && params.IntegrationTimeout != nil { - data.Set("Integration.Timeout", fmt.Sprint(*params.IntegrationTimeout)) - } - if params != nil && params.IntegrationPriority != nil { - data.Set("Integration.Priority", fmt.Sprint(*params.IntegrationPriority)) - } - if params != nil && params.IntegrationCreationOnMessage != nil { - data.Set("Integration.CreationOnMessage", fmt.Sprint(*params.IntegrationCreationOnMessage)) - } - if params != nil && params.LongLived != nil { - data.Set("LongLived", fmt.Sprint(*params.LongLived)) - } - if params != nil && params.JanitorEnabled != nil { - data.Set("JanitorEnabled", fmt.Sprint(*params.JanitorEnabled)) - } - if params != nil && params.IntegrationRetryCount != nil { - data.Set("Integration.RetryCount", fmt.Sprint(*params.IntegrationRetryCount)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &FlexV1FlexFlow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err -} - -// -func (c *ApiService) DeleteFlexFlow(Sid string) error { - path := "/v1/FlexFlows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() - - return nil -} - -// -func (c *ApiService) FetchFlexFlow(Sid string) (*FlexV1FlexFlow, error) { - path := "/v1/FlexFlows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &FlexV1FlexFlow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/FlexFlows" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ChatServiceSid != nil { + data.Set("ChatServiceSid", *params.ChatServiceSid) + } + if params != nil && params.ChannelType != nil { + data.Set("ChannelType", *params.ChannelType) + } + if params != nil && params.ContactIdentity != nil { + data.Set("ContactIdentity", *params.ContactIdentity) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.IntegrationType != nil { + data.Set("IntegrationType", *params.IntegrationType) + } + if params != nil && params.IntegrationFlowSid != nil { + data.Set("Integration.FlowSid", *params.IntegrationFlowSid) + } + if params != nil && params.IntegrationUrl != nil { + data.Set("Integration.Url", *params.IntegrationUrl) + } + if params != nil && params.IntegrationWorkspaceSid != nil { + data.Set("Integration.WorkspaceSid", *params.IntegrationWorkspaceSid) + } + if params != nil && params.IntegrationWorkflowSid != nil { + data.Set("Integration.WorkflowSid", *params.IntegrationWorkflowSid) + } + if params != nil && params.IntegrationChannel != nil { + data.Set("Integration.Channel", *params.IntegrationChannel) + } + if params != nil && params.IntegrationTimeout != nil { + data.Set("Integration.Timeout", fmt.Sprint(*params.IntegrationTimeout)) + } + if params != nil && params.IntegrationPriority != nil { + data.Set("Integration.Priority", fmt.Sprint(*params.IntegrationPriority)) + } + if params != nil && params.IntegrationCreationOnMessage != nil { + data.Set("Integration.CreationOnMessage", fmt.Sprint(*params.IntegrationCreationOnMessage)) + } + if params != nil && params.LongLived != nil { + data.Set("LongLived", fmt.Sprint(*params.LongLived)) + } + if params != nil && params.JanitorEnabled != nil { + data.Set("JanitorEnabled", fmt.Sprint(*params.JanitorEnabled)) + } + if params != nil && params.IntegrationRetryCount != nil { + data.Set("Integration.RetryCount", fmt.Sprint(*params.IntegrationRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FlexV1FlexFlow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// +func (c *ApiService) DeleteFlexFlow(Sid string, ) (error) { + path := "/v1/FlexFlows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// +func (c *ApiService) FetchFlexFlow(Sid string, ) (*FlexV1FlexFlow, error) { + path := "/v1/FlexFlows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FlexV1FlexFlow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFlexFlow' type ListFlexFlowParams struct { - // The `friendly_name` of the Flex Flow resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The `friendly_name` of the Flex Flow resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFlexFlowParams) SetFriendlyName(FriendlyName string) *ListFlexFlowParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListFlexFlowParams) SetFriendlyName(FriendlyName string) (*ListFlexFlowParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListFlexFlowParams) SetPageSize(PageSize int) *ListFlexFlowParams { - params.PageSize = &PageSize - return params +func (params *ListFlexFlowParams) SetPageSize(PageSize int) (*ListFlexFlowParams){ + params.PageSize = &PageSize + return params } -func (params *ListFlexFlowParams) SetLimit(Limit int) *ListFlexFlowParams { - params.Limit = &Limit - return params +func (params *ListFlexFlowParams) SetLimit(Limit int) (*ListFlexFlowParams){ + params.Limit = &Limit + return params } // Retrieve a single page of FlexFlow records from the API. Request is executed immediately. func (c *ApiService) PageFlexFlow(params *ListFlexFlowParams, pageToken, pageNumber string) (*ListFlexFlowResponse, error) { - path := "/v1/FlexFlows" + path := "/v1/FlexFlows" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFlexFlowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFlexFlowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists FlexFlow records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -342,6 +348,7 @@ func (c *ApiService) StreamFlexFlow(params *ListFlexFlowParams) (chan FlexV1Flex return recordChannel, errorChannel } + func (c *ApiService) streamFlexFlow(response *ListFlexFlowResponse, params *ListFlexFlowParams, recordChannel chan FlexV1FlexFlow, errorChannel chan error) { curRecord := 1 @@ -373,201 +380,203 @@ func (c *ApiService) streamFlexFlow(response *ListFlexFlowResponse, params *List } func (c *ApiService) getNextListFlexFlowResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFlexFlowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListFlexFlowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateFlexFlow' type UpdateFlexFlowParams struct { - // A descriptive string that you create to describe the Flex Flow resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the chat service. - ChatServiceSid *string `json:"ChatServiceSid,omitempty"` - // - ChannelType *string `json:"ChannelType,omitempty"` - // The channel contact's Identity. - ContactIdentity *string `json:"ContactIdentity,omitempty"` - // Whether the new Flex Flow is enabled. - Enabled *bool `json:"Enabled,omitempty"` - // - IntegrationType *string `json:"IntegrationType,omitempty"` - // The SID of the Studio Flow. Required when `integrationType` is `studio`. - IntegrationFlowSid *string `json:"Integration.FlowSid,omitempty"` - // The URL of the external webhook. Required when `integrationType` is `external`. - IntegrationUrl *string `json:"Integration.Url,omitempty"` - // The Workspace SID for a new Task. Required when `integrationType` is `task`. - IntegrationWorkspaceSid *string `json:"Integration.WorkspaceSid,omitempty"` - // The Workflow SID for a new Task. Required when `integrationType` is `task`. - IntegrationWorkflowSid *string `json:"Integration.WorkflowSid,omitempty"` - // 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`. - IntegrationChannel *string `json:"Integration.Channel,omitempty"` - // The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. - IntegrationTimeout *int `json:"Integration.Timeout,omitempty"` - // The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. - IntegrationPriority *int `json:"Integration.Priority,omitempty"` - // 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. - IntegrationCreationOnMessage *bool `json:"Integration.CreationOnMessage,omitempty"` - // 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`. - LongLived *bool `json:"LongLived,omitempty"` - // 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`. - JanitorEnabled *bool `json:"JanitorEnabled,omitempty"` - // 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. - IntegrationRetryCount *int `json:"Integration.RetryCount,omitempty"` -} - -func (params *UpdateFlexFlowParams) SetFriendlyName(FriendlyName string) *UpdateFlexFlowParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateFlexFlowParams) SetChatServiceSid(ChatServiceSid string) *UpdateFlexFlowParams { - params.ChatServiceSid = &ChatServiceSid - return params -} -func (params *UpdateFlexFlowParams) SetChannelType(ChannelType string) *UpdateFlexFlowParams { - params.ChannelType = &ChannelType - return params -} -func (params *UpdateFlexFlowParams) SetContactIdentity(ContactIdentity string) *UpdateFlexFlowParams { - params.ContactIdentity = &ContactIdentity - return params -} -func (params *UpdateFlexFlowParams) SetEnabled(Enabled bool) *UpdateFlexFlowParams { - params.Enabled = &Enabled - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationType(IntegrationType string) *UpdateFlexFlowParams { - params.IntegrationType = &IntegrationType - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationFlowSid(IntegrationFlowSid string) *UpdateFlexFlowParams { - params.IntegrationFlowSid = &IntegrationFlowSid - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationUrl(IntegrationUrl string) *UpdateFlexFlowParams { - params.IntegrationUrl = &IntegrationUrl - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationWorkspaceSid(IntegrationWorkspaceSid string) *UpdateFlexFlowParams { - params.IntegrationWorkspaceSid = &IntegrationWorkspaceSid - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationWorkflowSid(IntegrationWorkflowSid string) *UpdateFlexFlowParams { - params.IntegrationWorkflowSid = &IntegrationWorkflowSid - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationChannel(IntegrationChannel string) *UpdateFlexFlowParams { - params.IntegrationChannel = &IntegrationChannel - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationTimeout(IntegrationTimeout int) *UpdateFlexFlowParams { - params.IntegrationTimeout = &IntegrationTimeout - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationPriority(IntegrationPriority int) *UpdateFlexFlowParams { - params.IntegrationPriority = &IntegrationPriority - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationCreationOnMessage(IntegrationCreationOnMessage bool) *UpdateFlexFlowParams { - params.IntegrationCreationOnMessage = &IntegrationCreationOnMessage - return params -} -func (params *UpdateFlexFlowParams) SetLongLived(LongLived bool) *UpdateFlexFlowParams { - params.LongLived = &LongLived - return params -} -func (params *UpdateFlexFlowParams) SetJanitorEnabled(JanitorEnabled bool) *UpdateFlexFlowParams { - params.JanitorEnabled = &JanitorEnabled - return params -} -func (params *UpdateFlexFlowParams) SetIntegrationRetryCount(IntegrationRetryCount int) *UpdateFlexFlowParams { - params.IntegrationRetryCount = &IntegrationRetryCount - return params -} - -// + // A descriptive string that you create to describe the Flex Flow resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the chat service. + ChatServiceSid *string `json:"ChatServiceSid,omitempty"` + // + ChannelType *string `json:"ChannelType,omitempty"` + // The channel contact's Identity. + ContactIdentity *string `json:"ContactIdentity,omitempty"` + // Whether the new Flex Flow is enabled. + Enabled *bool `json:"Enabled,omitempty"` + // + IntegrationType *string `json:"IntegrationType,omitempty"` + // The SID of the Studio Flow. Required when `integrationType` is `studio`. + IntegrationFlowSid *string `json:"Integration.FlowSid,omitempty"` + // The URL of the external webhook. Required when `integrationType` is `external`. + IntegrationUrl *string `json:"Integration.Url,omitempty"` + // The Workspace SID for a new Task. Required when `integrationType` is `task`. + IntegrationWorkspaceSid *string `json:"Integration.WorkspaceSid,omitempty"` + // The Workflow SID for a new Task. Required when `integrationType` is `task`. + IntegrationWorkflowSid *string `json:"Integration.WorkflowSid,omitempty"` + // 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`. + IntegrationChannel *string `json:"Integration.Channel,omitempty"` + // The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. + IntegrationTimeout *int `json:"Integration.Timeout,omitempty"` + // The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. + IntegrationPriority *int `json:"Integration.Priority,omitempty"` + // 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. + IntegrationCreationOnMessage *bool `json:"Integration.CreationOnMessage,omitempty"` + // 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`. + LongLived *bool `json:"LongLived,omitempty"` + // 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`. + JanitorEnabled *bool `json:"JanitorEnabled,omitempty"` + // 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. + IntegrationRetryCount *int `json:"Integration.RetryCount,omitempty"` +} + +func (params *UpdateFlexFlowParams) SetFriendlyName(FriendlyName string) (*UpdateFlexFlowParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateFlexFlowParams) SetChatServiceSid(ChatServiceSid string) (*UpdateFlexFlowParams){ + params.ChatServiceSid = &ChatServiceSid + return params +} +func (params *UpdateFlexFlowParams) SetChannelType(ChannelType string) (*UpdateFlexFlowParams){ + params.ChannelType = &ChannelType + return params +} +func (params *UpdateFlexFlowParams) SetContactIdentity(ContactIdentity string) (*UpdateFlexFlowParams){ + params.ContactIdentity = &ContactIdentity + return params +} +func (params *UpdateFlexFlowParams) SetEnabled(Enabled bool) (*UpdateFlexFlowParams){ + params.Enabled = &Enabled + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationType(IntegrationType string) (*UpdateFlexFlowParams){ + params.IntegrationType = &IntegrationType + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationFlowSid(IntegrationFlowSid string) (*UpdateFlexFlowParams){ + params.IntegrationFlowSid = &IntegrationFlowSid + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationUrl(IntegrationUrl string) (*UpdateFlexFlowParams){ + params.IntegrationUrl = &IntegrationUrl + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationWorkspaceSid(IntegrationWorkspaceSid string) (*UpdateFlexFlowParams){ + params.IntegrationWorkspaceSid = &IntegrationWorkspaceSid + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationWorkflowSid(IntegrationWorkflowSid string) (*UpdateFlexFlowParams){ + params.IntegrationWorkflowSid = &IntegrationWorkflowSid + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationChannel(IntegrationChannel string) (*UpdateFlexFlowParams){ + params.IntegrationChannel = &IntegrationChannel + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationTimeout(IntegrationTimeout int) (*UpdateFlexFlowParams){ + params.IntegrationTimeout = &IntegrationTimeout + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationPriority(IntegrationPriority int) (*UpdateFlexFlowParams){ + params.IntegrationPriority = &IntegrationPriority + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationCreationOnMessage(IntegrationCreationOnMessage bool) (*UpdateFlexFlowParams){ + params.IntegrationCreationOnMessage = &IntegrationCreationOnMessage + return params +} +func (params *UpdateFlexFlowParams) SetLongLived(LongLived bool) (*UpdateFlexFlowParams){ + params.LongLived = &LongLived + return params +} +func (params *UpdateFlexFlowParams) SetJanitorEnabled(JanitorEnabled bool) (*UpdateFlexFlowParams){ + params.JanitorEnabled = &JanitorEnabled + return params +} +func (params *UpdateFlexFlowParams) SetIntegrationRetryCount(IntegrationRetryCount int) (*UpdateFlexFlowParams){ + params.IntegrationRetryCount = &IntegrationRetryCount + return params +} + +// func (c *ApiService) UpdateFlexFlow(Sid string, params *UpdateFlexFlowParams) (*FlexV1FlexFlow, error) { - path := "/v1/FlexFlows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ChatServiceSid != nil { - data.Set("ChatServiceSid", *params.ChatServiceSid) - } - if params != nil && params.ChannelType != nil { - data.Set("ChannelType", *params.ChannelType) - } - if params != nil && params.ContactIdentity != nil { - data.Set("ContactIdentity", *params.ContactIdentity) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.IntegrationType != nil { - data.Set("IntegrationType", *params.IntegrationType) - } - if params != nil && params.IntegrationFlowSid != nil { - data.Set("Integration.FlowSid", *params.IntegrationFlowSid) - } - if params != nil && params.IntegrationUrl != nil { - data.Set("Integration.Url", *params.IntegrationUrl) - } - if params != nil && params.IntegrationWorkspaceSid != nil { - data.Set("Integration.WorkspaceSid", *params.IntegrationWorkspaceSid) - } - if params != nil && params.IntegrationWorkflowSid != nil { - data.Set("Integration.WorkflowSid", *params.IntegrationWorkflowSid) - } - if params != nil && params.IntegrationChannel != nil { - data.Set("Integration.Channel", *params.IntegrationChannel) - } - if params != nil && params.IntegrationTimeout != nil { - data.Set("Integration.Timeout", fmt.Sprint(*params.IntegrationTimeout)) - } - if params != nil && params.IntegrationPriority != nil { - data.Set("Integration.Priority", fmt.Sprint(*params.IntegrationPriority)) - } - if params != nil && params.IntegrationCreationOnMessage != nil { - data.Set("Integration.CreationOnMessage", fmt.Sprint(*params.IntegrationCreationOnMessage)) - } - if params != nil && params.LongLived != nil { - data.Set("LongLived", fmt.Sprint(*params.LongLived)) - } - if params != nil && params.JanitorEnabled != nil { - data.Set("JanitorEnabled", fmt.Sprint(*params.JanitorEnabled)) - } - if params != nil && params.IntegrationRetryCount != nil { - data.Set("Integration.RetryCount", fmt.Sprint(*params.IntegrationRetryCount)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &FlexV1FlexFlow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/FlexFlows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ChatServiceSid != nil { + data.Set("ChatServiceSid", *params.ChatServiceSid) + } + if params != nil && params.ChannelType != nil { + data.Set("ChannelType", *params.ChannelType) + } + if params != nil && params.ContactIdentity != nil { + data.Set("ContactIdentity", *params.ContactIdentity) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.IntegrationType != nil { + data.Set("IntegrationType", *params.IntegrationType) + } + if params != nil && params.IntegrationFlowSid != nil { + data.Set("Integration.FlowSid", *params.IntegrationFlowSid) + } + if params != nil && params.IntegrationUrl != nil { + data.Set("Integration.Url", *params.IntegrationUrl) + } + if params != nil && params.IntegrationWorkspaceSid != nil { + data.Set("Integration.WorkspaceSid", *params.IntegrationWorkspaceSid) + } + if params != nil && params.IntegrationWorkflowSid != nil { + data.Set("Integration.WorkflowSid", *params.IntegrationWorkflowSid) + } + if params != nil && params.IntegrationChannel != nil { + data.Set("Integration.Channel", *params.IntegrationChannel) + } + if params != nil && params.IntegrationTimeout != nil { + data.Set("Integration.Timeout", fmt.Sprint(*params.IntegrationTimeout)) + } + if params != nil && params.IntegrationPriority != nil { + data.Set("Integration.Priority", fmt.Sprint(*params.IntegrationPriority)) + } + if params != nil && params.IntegrationCreationOnMessage != nil { + data.Set("Integration.CreationOnMessage", fmt.Sprint(*params.IntegrationCreationOnMessage)) + } + if params != nil && params.LongLived != nil { + data.Set("LongLived", fmt.Sprint(*params.LongLived)) + } + if params != nil && params.JanitorEnabled != nil { + data.Set("JanitorEnabled", fmt.Sprint(*params.JanitorEnabled)) + } + if params != nil && params.IntegrationRetryCount != nil { + data.Set("Integration.RetryCount", fmt.Sprint(*params.IntegrationRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FlexV1FlexFlow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/flex/v1/insights_conversations.go b/rest/flex/v1/insights_conversations.go index e11742e53..7f2584ae5 100644 --- a/rest/flex/v1/insights_conversations.go +++ b/rest/flex/v1/insights_conversations.go @@ -19,72 +19,74 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListInsightsConversations' type ListInsightsConversationsParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // Unique Id of the segment for which conversation details needs to be fetched - SegmentId *string `json:"SegmentId,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // Unique Id of the segment for which conversation details needs to be fetched + SegmentId *string `json:"SegmentId,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsConversationsParams) SetAuthorization(Authorization string) *ListInsightsConversationsParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsConversationsParams) SetAuthorization(Authorization string) (*ListInsightsConversationsParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsConversationsParams) SetSegmentId(SegmentId string) *ListInsightsConversationsParams { - params.SegmentId = &SegmentId - return params +func (params *ListInsightsConversationsParams) SetSegmentId(SegmentId string) (*ListInsightsConversationsParams){ + params.SegmentId = &SegmentId + return params } -func (params *ListInsightsConversationsParams) SetPageSize(PageSize int) *ListInsightsConversationsParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsConversationsParams) SetPageSize(PageSize int) (*ListInsightsConversationsParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsConversationsParams) SetLimit(Limit int) *ListInsightsConversationsParams { - params.Limit = &Limit - return params +func (params *ListInsightsConversationsParams) SetLimit(Limit int) (*ListInsightsConversationsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsConversations records from the API. Request is executed immediately. func (c *ApiService) PageInsightsConversations(params *ListInsightsConversationsParams, pageToken, pageNumber string) (*ListInsightsConversationsResponse, error) { - path := "/v1/Insights/Conversations" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.SegmentId != nil { - data.Set("SegmentId", *params.SegmentId) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsConversationsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Insights/Conversations" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.SegmentId != nil { + data.Set("SegmentId", *params.SegmentId) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsConversationsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists InsightsConversations records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -125,6 +127,7 @@ func (c *ApiService) StreamInsightsConversations(params *ListInsightsConversatio return recordChannel, errorChannel } + func (c *ApiService) streamInsightsConversations(response *ListInsightsConversationsResponse, params *ListInsightsConversationsParams, recordChannel chan FlexV1InsightsConversations, errorChannel chan error) { curRecord := 1 @@ -156,19 +159,20 @@ func (c *ApiService) streamInsightsConversations(response *ListInsightsConversat } func (c *ApiService) getNextListInsightsConversationsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsConversationsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsConversationsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/flex/v1/insights_quality_management_assessments.go b/rest/flex/v1/insights_quality_management_assessments.go index 370444215..7043719a6 100644 --- a/rest/flex/v1/insights_quality_management_assessments.go +++ b/rest/flex/v1/insights_quality_management_assessments.go @@ -18,202 +18,203 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInsightsAssessments' type CreateInsightsAssessmentsParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The SID of the category - CategorySid *string `json:"CategorySid,omitempty"` - // The name of the category - CategoryName *string `json:"CategoryName,omitempty"` - // Segment Id of the conversation - SegmentId *string `json:"SegmentId,omitempty"` - // The id of the Agent - AgentId *string `json:"AgentId,omitempty"` - // The offset of the conversation. - Offset *float32 `json:"Offset,omitempty"` - // The question SID selected for assessment - MetricId *string `json:"MetricId,omitempty"` - // The question name of the assessment - MetricName *string `json:"MetricName,omitempty"` - // The answer text selected by user - AnswerText *string `json:"AnswerText,omitempty"` - // The id of the answer selected by user - AnswerId *string `json:"AnswerId,omitempty"` - // Questionnaire SID of the associated question - QuestionnaireSid *string `json:"QuestionnaireSid,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The SID of the category + CategorySid *string `json:"CategorySid,omitempty"` + // The name of the category + CategoryName *string `json:"CategoryName,omitempty"` + // Segment Id of the conversation + SegmentId *string `json:"SegmentId,omitempty"` + // The id of the Agent + AgentId *string `json:"AgentId,omitempty"` + // The offset of the conversation. + Offset *float32 `json:"Offset,omitempty"` + // The question SID selected for assessment + MetricId *string `json:"MetricId,omitempty"` + // The question name of the assessment + MetricName *string `json:"MetricName,omitempty"` + // The answer text selected by user + AnswerText *string `json:"AnswerText,omitempty"` + // The id of the answer selected by user + AnswerId *string `json:"AnswerId,omitempty"` + // Questionnaire SID of the associated question + QuestionnaireSid *string `json:"QuestionnaireSid,omitempty"` } -func (params *CreateInsightsAssessmentsParams) SetAuthorization(Authorization string) *CreateInsightsAssessmentsParams { - params.Authorization = &Authorization - return params +func (params *CreateInsightsAssessmentsParams) SetAuthorization(Authorization string) (*CreateInsightsAssessmentsParams){ + params.Authorization = &Authorization + return params } -func (params *CreateInsightsAssessmentsParams) SetCategorySid(CategorySid string) *CreateInsightsAssessmentsParams { - params.CategorySid = &CategorySid - return params +func (params *CreateInsightsAssessmentsParams) SetCategorySid(CategorySid string) (*CreateInsightsAssessmentsParams){ + params.CategorySid = &CategorySid + return params } -func (params *CreateInsightsAssessmentsParams) SetCategoryName(CategoryName string) *CreateInsightsAssessmentsParams { - params.CategoryName = &CategoryName - return params +func (params *CreateInsightsAssessmentsParams) SetCategoryName(CategoryName string) (*CreateInsightsAssessmentsParams){ + params.CategoryName = &CategoryName + return params } -func (params *CreateInsightsAssessmentsParams) SetSegmentId(SegmentId string) *CreateInsightsAssessmentsParams { - params.SegmentId = &SegmentId - return params +func (params *CreateInsightsAssessmentsParams) SetSegmentId(SegmentId string) (*CreateInsightsAssessmentsParams){ + params.SegmentId = &SegmentId + return params } -func (params *CreateInsightsAssessmentsParams) SetAgentId(AgentId string) *CreateInsightsAssessmentsParams { - params.AgentId = &AgentId - return params +func (params *CreateInsightsAssessmentsParams) SetAgentId(AgentId string) (*CreateInsightsAssessmentsParams){ + params.AgentId = &AgentId + return params } -func (params *CreateInsightsAssessmentsParams) SetOffset(Offset float32) *CreateInsightsAssessmentsParams { - params.Offset = &Offset - return params +func (params *CreateInsightsAssessmentsParams) SetOffset(Offset float32) (*CreateInsightsAssessmentsParams){ + params.Offset = &Offset + return params } -func (params *CreateInsightsAssessmentsParams) SetMetricId(MetricId string) *CreateInsightsAssessmentsParams { - params.MetricId = &MetricId - return params +func (params *CreateInsightsAssessmentsParams) SetMetricId(MetricId string) (*CreateInsightsAssessmentsParams){ + params.MetricId = &MetricId + return params } -func (params *CreateInsightsAssessmentsParams) SetMetricName(MetricName string) *CreateInsightsAssessmentsParams { - params.MetricName = &MetricName - return params +func (params *CreateInsightsAssessmentsParams) SetMetricName(MetricName string) (*CreateInsightsAssessmentsParams){ + params.MetricName = &MetricName + return params } -func (params *CreateInsightsAssessmentsParams) SetAnswerText(AnswerText string) *CreateInsightsAssessmentsParams { - params.AnswerText = &AnswerText - return params +func (params *CreateInsightsAssessmentsParams) SetAnswerText(AnswerText string) (*CreateInsightsAssessmentsParams){ + params.AnswerText = &AnswerText + return params } -func (params *CreateInsightsAssessmentsParams) SetAnswerId(AnswerId string) *CreateInsightsAssessmentsParams { - params.AnswerId = &AnswerId - return params +func (params *CreateInsightsAssessmentsParams) SetAnswerId(AnswerId string) (*CreateInsightsAssessmentsParams){ + params.AnswerId = &AnswerId + return params } -func (params *CreateInsightsAssessmentsParams) SetQuestionnaireSid(QuestionnaireSid string) *CreateInsightsAssessmentsParams { - params.QuestionnaireSid = &QuestionnaireSid - return params +func (params *CreateInsightsAssessmentsParams) SetQuestionnaireSid(QuestionnaireSid string) (*CreateInsightsAssessmentsParams){ + params.QuestionnaireSid = &QuestionnaireSid + return params } // Add assessments against conversation to dynamo db. Used in assessments screen by user. Users can select the questionnaire and pick up answers for each and every question. func (c *ApiService) CreateInsightsAssessments(params *CreateInsightsAssessmentsParams) (*FlexV1InsightsAssessments, error) { - path := "/v1/Insights/QualityManagement/Assessments" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Insights/QualityManagement/Assessments" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CategorySid != nil { + data.Set("CategorySid", *params.CategorySid) + } + if params != nil && params.CategoryName != nil { + data.Set("CategoryName", *params.CategoryName) + } + if params != nil && params.SegmentId != nil { + data.Set("SegmentId", *params.SegmentId) + } + if params != nil && params.AgentId != nil { + data.Set("AgentId", *params.AgentId) + } + if params != nil && params.Offset != nil { + data.Set("Offset", fmt.Sprint(*params.Offset)) + } + if params != nil && params.MetricId != nil { + data.Set("MetricId", *params.MetricId) + } + if params != nil && params.MetricName != nil { + data.Set("MetricName", *params.MetricName) + } + if params != nil && params.AnswerText != nil { + data.Set("AnswerText", *params.AnswerText) + } + if params != nil && params.AnswerId != nil { + data.Set("AnswerId", *params.AnswerId) + } + if params != nil && params.QuestionnaireSid != nil { + data.Set("QuestionnaireSid", *params.QuestionnaireSid) + } - if params != nil && params.CategorySid != nil { - data.Set("CategorySid", *params.CategorySid) - } - if params != nil && params.CategoryName != nil { - data.Set("CategoryName", *params.CategoryName) - } - if params != nil && params.SegmentId != nil { - data.Set("SegmentId", *params.SegmentId) - } - if params != nil && params.AgentId != nil { - data.Set("AgentId", *params.AgentId) - } - if params != nil && params.Offset != nil { - data.Set("Offset", fmt.Sprint(*params.Offset)) - } - if params != nil && params.MetricId != nil { - data.Set("MetricId", *params.MetricId) - } - if params != nil && params.MetricName != nil { - data.Set("MetricName", *params.MetricName) - } - if params != nil && params.AnswerText != nil { - data.Set("AnswerText", *params.AnswerText) - } - if params != nil && params.AnswerId != nil { - data.Set("AnswerId", *params.AnswerId) - } - if params != nil && params.QuestionnaireSid != nil { - data.Set("QuestionnaireSid", *params.QuestionnaireSid) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsAssessments{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsAssessments{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListInsightsAssessments' type ListInsightsAssessmentsParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The id of the segment. - SegmentId *string `json:"SegmentId,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The id of the segment. + SegmentId *string `json:"SegmentId,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsAssessmentsParams) SetAuthorization(Authorization string) *ListInsightsAssessmentsParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsAssessmentsParams) SetAuthorization(Authorization string) (*ListInsightsAssessmentsParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsAssessmentsParams) SetSegmentId(SegmentId string) *ListInsightsAssessmentsParams { - params.SegmentId = &SegmentId - return params +func (params *ListInsightsAssessmentsParams) SetSegmentId(SegmentId string) (*ListInsightsAssessmentsParams){ + params.SegmentId = &SegmentId + return params } -func (params *ListInsightsAssessmentsParams) SetPageSize(PageSize int) *ListInsightsAssessmentsParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsAssessmentsParams) SetPageSize(PageSize int) (*ListInsightsAssessmentsParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsAssessmentsParams) SetLimit(Limit int) *ListInsightsAssessmentsParams { - params.Limit = &Limit - return params +func (params *ListInsightsAssessmentsParams) SetLimit(Limit int) (*ListInsightsAssessmentsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsAssessments records from the API. Request is executed immediately. func (c *ApiService) PageInsightsAssessments(params *ListInsightsAssessmentsParams, pageToken, pageNumber string) (*ListInsightsAssessmentsResponse, error) { - path := "/v1/Insights/QualityManagement/Assessments" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.SegmentId != nil { - data.Set("SegmentId", *params.SegmentId) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsAssessmentsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Insights/QualityManagement/Assessments" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.SegmentId != nil { + data.Set("SegmentId", *params.SegmentId) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsAssessmentsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists InsightsAssessments records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -254,6 +255,7 @@ func (c *ApiService) StreamInsightsAssessments(params *ListInsightsAssessmentsPa return recordChannel, errorChannel } + func (c *ApiService) streamInsightsAssessments(response *ListInsightsAssessmentsResponse, params *ListInsightsAssessmentsParams, recordChannel chan FlexV1InsightsAssessments, errorChannel chan error) { curRecord := 1 @@ -285,85 +287,86 @@ func (c *ApiService) streamInsightsAssessments(response *ListInsightsAssessments } func (c *ApiService) getNextListInsightsAssessmentsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsAssessmentsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsAssessmentsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateInsightsAssessments' type UpdateInsightsAssessmentsParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The offset of the conversation - Offset *float32 `json:"Offset,omitempty"` - // The answer text selected by user - AnswerText *string `json:"AnswerText,omitempty"` - // The id of the answer selected by user - AnswerId *string `json:"AnswerId,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The offset of the conversation + Offset *float32 `json:"Offset,omitempty"` + // The answer text selected by user + AnswerText *string `json:"AnswerText,omitempty"` + // The id of the answer selected by user + AnswerId *string `json:"AnswerId,omitempty"` } -func (params *UpdateInsightsAssessmentsParams) SetAuthorization(Authorization string) *UpdateInsightsAssessmentsParams { - params.Authorization = &Authorization - return params +func (params *UpdateInsightsAssessmentsParams) SetAuthorization(Authorization string) (*UpdateInsightsAssessmentsParams){ + params.Authorization = &Authorization + return params } -func (params *UpdateInsightsAssessmentsParams) SetOffset(Offset float32) *UpdateInsightsAssessmentsParams { - params.Offset = &Offset - return params +func (params *UpdateInsightsAssessmentsParams) SetOffset(Offset float32) (*UpdateInsightsAssessmentsParams){ + params.Offset = &Offset + return params } -func (params *UpdateInsightsAssessmentsParams) SetAnswerText(AnswerText string) *UpdateInsightsAssessmentsParams { - params.AnswerText = &AnswerText - return params +func (params *UpdateInsightsAssessmentsParams) SetAnswerText(AnswerText string) (*UpdateInsightsAssessmentsParams){ + params.AnswerText = &AnswerText + return params } -func (params *UpdateInsightsAssessmentsParams) SetAnswerId(AnswerId string) *UpdateInsightsAssessmentsParams { - params.AnswerId = &AnswerId - return params +func (params *UpdateInsightsAssessmentsParams) SetAnswerId(AnswerId string) (*UpdateInsightsAssessmentsParams){ + params.AnswerId = &AnswerId + return params } // Update a specific Assessment assessed earlier func (c *ApiService) UpdateInsightsAssessments(AssessmentSid string, params *UpdateInsightsAssessmentsParams) (*FlexV1InsightsAssessments, error) { - path := "/v1/Insights/QualityManagement/Assessments/{AssessmentSid}" - path = strings.Replace(path, "{"+"AssessmentSid"+"}", AssessmentSid, -1) + path := "/v1/Insights/QualityManagement/Assessments/{AssessmentSid}" + path = strings.Replace(path, "{"+"AssessmentSid"+"}", AssessmentSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Offset != nil { + data.Set("Offset", fmt.Sprint(*params.Offset)) + } + if params != nil && params.AnswerText != nil { + data.Set("AnswerText", *params.AnswerText) + } + if params != nil && params.AnswerId != nil { + data.Set("AnswerId", *params.AnswerId) + } - if params != nil && params.Offset != nil { - data.Set("Offset", fmt.Sprint(*params.Offset)) - } - if params != nil && params.AnswerText != nil { - data.Set("AnswerText", *params.AnswerText) - } - if params != nil && params.AnswerId != nil { - data.Set("AnswerId", *params.AnswerId) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &FlexV1InsightsAssessments{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsAssessments{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_quality_management_assessments_comments.go b/rest/flex/v1/insights_quality_management_assessments_comments.go index 7f2f45031..4c33d5d3d 100644 --- a/rest/flex/v1/insights_quality_management_assessments_comments.go +++ b/rest/flex/v1/insights_quality_management_assessments_comments.go @@ -19,173 +19,175 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInsightsAssessmentsComment' type CreateInsightsAssessmentsCommentParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The ID of the category - CategoryId *string `json:"CategoryId,omitempty"` - // The name of the category - CategoryName *string `json:"CategoryName,omitempty"` - // The Assessment comment. - Comment *string `json:"Comment,omitempty"` - // The id of the segment. - SegmentId *string `json:"SegmentId,omitempty"` - // The id of the agent. - AgentId *string `json:"AgentId,omitempty"` - // The offset - Offset *float32 `json:"Offset,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The ID of the category + CategoryId *string `json:"CategoryId,omitempty"` + // The name of the category + CategoryName *string `json:"CategoryName,omitempty"` + // The Assessment comment. + Comment *string `json:"Comment,omitempty"` + // The id of the segment. + SegmentId *string `json:"SegmentId,omitempty"` + // The id of the agent. + AgentId *string `json:"AgentId,omitempty"` + // The offset + Offset *float32 `json:"Offset,omitempty"` } -func (params *CreateInsightsAssessmentsCommentParams) SetAuthorization(Authorization string) *CreateInsightsAssessmentsCommentParams { - params.Authorization = &Authorization - return params +func (params *CreateInsightsAssessmentsCommentParams) SetAuthorization(Authorization string) (*CreateInsightsAssessmentsCommentParams){ + params.Authorization = &Authorization + return params } -func (params *CreateInsightsAssessmentsCommentParams) SetCategoryId(CategoryId string) *CreateInsightsAssessmentsCommentParams { - params.CategoryId = &CategoryId - return params +func (params *CreateInsightsAssessmentsCommentParams) SetCategoryId(CategoryId string) (*CreateInsightsAssessmentsCommentParams){ + params.CategoryId = &CategoryId + return params } -func (params *CreateInsightsAssessmentsCommentParams) SetCategoryName(CategoryName string) *CreateInsightsAssessmentsCommentParams { - params.CategoryName = &CategoryName - return params +func (params *CreateInsightsAssessmentsCommentParams) SetCategoryName(CategoryName string) (*CreateInsightsAssessmentsCommentParams){ + params.CategoryName = &CategoryName + return params } -func (params *CreateInsightsAssessmentsCommentParams) SetComment(Comment string) *CreateInsightsAssessmentsCommentParams { - params.Comment = &Comment - return params +func (params *CreateInsightsAssessmentsCommentParams) SetComment(Comment string) (*CreateInsightsAssessmentsCommentParams){ + params.Comment = &Comment + return params } -func (params *CreateInsightsAssessmentsCommentParams) SetSegmentId(SegmentId string) *CreateInsightsAssessmentsCommentParams { - params.SegmentId = &SegmentId - return params +func (params *CreateInsightsAssessmentsCommentParams) SetSegmentId(SegmentId string) (*CreateInsightsAssessmentsCommentParams){ + params.SegmentId = &SegmentId + return params } -func (params *CreateInsightsAssessmentsCommentParams) SetAgentId(AgentId string) *CreateInsightsAssessmentsCommentParams { - params.AgentId = &AgentId - return params +func (params *CreateInsightsAssessmentsCommentParams) SetAgentId(AgentId string) (*CreateInsightsAssessmentsCommentParams){ + params.AgentId = &AgentId + return params } -func (params *CreateInsightsAssessmentsCommentParams) SetOffset(Offset float32) *CreateInsightsAssessmentsCommentParams { - params.Offset = &Offset - return params +func (params *CreateInsightsAssessmentsCommentParams) SetOffset(Offset float32) (*CreateInsightsAssessmentsCommentParams){ + params.Offset = &Offset + return params } // To create a comment assessment for a conversation func (c *ApiService) CreateInsightsAssessmentsComment(params *CreateInsightsAssessmentsCommentParams) (*FlexV1InsightsAssessmentsComment, error) { - path := "/v1/Insights/QualityManagement/Assessments/Comments" + path := "/v1/Insights/QualityManagement/Assessments/Comments" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CategoryId != nil { + data.Set("CategoryId", *params.CategoryId) + } + if params != nil && params.CategoryName != nil { + data.Set("CategoryName", *params.CategoryName) + } + if params != nil && params.Comment != nil { + data.Set("Comment", *params.Comment) + } + if params != nil && params.SegmentId != nil { + data.Set("SegmentId", *params.SegmentId) + } + if params != nil && params.AgentId != nil { + data.Set("AgentId", *params.AgentId) + } + if params != nil && params.Offset != nil { + data.Set("Offset", fmt.Sprint(*params.Offset)) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CategoryId != nil { - data.Set("CategoryId", *params.CategoryId) - } - if params != nil && params.CategoryName != nil { - data.Set("CategoryName", *params.CategoryName) - } - if params != nil && params.Comment != nil { - data.Set("Comment", *params.Comment) - } - if params != nil && params.SegmentId != nil { - data.Set("SegmentId", *params.SegmentId) - } - if params != nil && params.AgentId != nil { - data.Set("AgentId", *params.AgentId) - } - if params != nil && params.Offset != nil { - data.Set("Offset", fmt.Sprint(*params.Offset)) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &FlexV1InsightsAssessmentsComment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &FlexV1InsightsAssessmentsComment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListInsightsAssessmentsComment' type ListInsightsAssessmentsCommentParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The id of the segment. - SegmentId *string `json:"SegmentId,omitempty"` - // The id of the agent. - AgentId *string `json:"AgentId,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The id of the segment. + SegmentId *string `json:"SegmentId,omitempty"` + // The id of the agent. + AgentId *string `json:"AgentId,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsAssessmentsCommentParams) SetAuthorization(Authorization string) *ListInsightsAssessmentsCommentParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsAssessmentsCommentParams) SetAuthorization(Authorization string) (*ListInsightsAssessmentsCommentParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsAssessmentsCommentParams) SetSegmentId(SegmentId string) *ListInsightsAssessmentsCommentParams { - params.SegmentId = &SegmentId - return params +func (params *ListInsightsAssessmentsCommentParams) SetSegmentId(SegmentId string) (*ListInsightsAssessmentsCommentParams){ + params.SegmentId = &SegmentId + return params } -func (params *ListInsightsAssessmentsCommentParams) SetAgentId(AgentId string) *ListInsightsAssessmentsCommentParams { - params.AgentId = &AgentId - return params +func (params *ListInsightsAssessmentsCommentParams) SetAgentId(AgentId string) (*ListInsightsAssessmentsCommentParams){ + params.AgentId = &AgentId + return params } -func (params *ListInsightsAssessmentsCommentParams) SetPageSize(PageSize int) *ListInsightsAssessmentsCommentParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsAssessmentsCommentParams) SetPageSize(PageSize int) (*ListInsightsAssessmentsCommentParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsAssessmentsCommentParams) SetLimit(Limit int) *ListInsightsAssessmentsCommentParams { - params.Limit = &Limit - return params +func (params *ListInsightsAssessmentsCommentParams) SetLimit(Limit int) (*ListInsightsAssessmentsCommentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsAssessmentsComment records from the API. Request is executed immediately. func (c *ApiService) PageInsightsAssessmentsComment(params *ListInsightsAssessmentsCommentParams, pageToken, pageNumber string) (*ListInsightsAssessmentsCommentResponse, error) { - path := "/v1/Insights/QualityManagement/Assessments/Comments" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.SegmentId != nil { - data.Set("SegmentId", *params.SegmentId) - } - if params != nil && params.AgentId != nil { - data.Set("AgentId", *params.AgentId) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsAssessmentsCommentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Insights/QualityManagement/Assessments/Comments" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.SegmentId != nil { + data.Set("SegmentId", *params.SegmentId) + } + if params != nil && params.AgentId != nil { + data.Set("AgentId", *params.AgentId) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsAssessmentsCommentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists InsightsAssessmentsComment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -226,6 +228,7 @@ func (c *ApiService) StreamInsightsAssessmentsComment(params *ListInsightsAssess return recordChannel, errorChannel } + func (c *ApiService) streamInsightsAssessmentsComment(response *ListInsightsAssessmentsCommentResponse, params *ListInsightsAssessmentsCommentParams, recordChannel chan FlexV1InsightsAssessmentsComment, errorChannel chan error) { curRecord := 1 @@ -257,19 +260,20 @@ func (c *ApiService) streamInsightsAssessmentsComment(response *ListInsightsAsse } func (c *ApiService) getNextListInsightsAssessmentsCommentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsAssessmentsCommentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsAssessmentsCommentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/flex/v1/insights_quality_management_categories.go b/rest/flex/v1/insights_quality_management_categories.go index e23a34633..b4c23c4c8 100644 --- a/rest/flex/v1/insights_quality_management_categories.go +++ b/rest/flex/v1/insights_quality_management_categories.go @@ -18,145 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInsightsQuestionnairesCategory' type CreateInsightsQuestionnairesCategoryParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The name of this category. - Name *string `json:"Name,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The name of this category. + Name *string `json:"Name,omitempty"` } -func (params *CreateInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) *CreateInsightsQuestionnairesCategoryParams { - params.Authorization = &Authorization - return params +func (params *CreateInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) (*CreateInsightsQuestionnairesCategoryParams){ + params.Authorization = &Authorization + return params } -func (params *CreateInsightsQuestionnairesCategoryParams) SetName(Name string) *CreateInsightsQuestionnairesCategoryParams { - params.Name = &Name - return params +func (params *CreateInsightsQuestionnairesCategoryParams) SetName(Name string) (*CreateInsightsQuestionnairesCategoryParams){ + params.Name = &Name + return params } // To create a category for Questions func (c *ApiService) CreateInsightsQuestionnairesCategory(params *CreateInsightsQuestionnairesCategoryParams) (*FlexV1InsightsQuestionnairesCategory, error) { - path := "/v1/Insights/QualityManagement/Categories" + path := "/v1/Insights/QualityManagement/Categories" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Name != nil { + data.Set("Name", *params.Name) + } - if params != nil && params.Name != nil { - data.Set("Name", *params.Name) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsQuestionnairesCategory{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsQuestionnairesCategory{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteInsightsQuestionnairesCategory' type DeleteInsightsQuestionnairesCategoryParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *DeleteInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) *DeleteInsightsQuestionnairesCategoryParams { - params.Authorization = &Authorization - return params +func (params *DeleteInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) (*DeleteInsightsQuestionnairesCategoryParams){ + params.Authorization = &Authorization + return params } -// -func (c *ApiService) DeleteInsightsQuestionnairesCategory(CategorySid string, params *DeleteInsightsQuestionnairesCategoryParams) error { - path := "/v1/Insights/QualityManagement/Categories/{CategorySid}" - path = strings.Replace(path, "{"+"CategorySid"+"}", CategorySid, -1) +// +func (c *ApiService) DeleteInsightsQuestionnairesCategory(CategorySid string, params *DeleteInsightsQuestionnairesCategoryParams) (error) { + path := "/v1/Insights/QualityManagement/Categories/{CategorySid}" + path = strings.Replace(path, "{"+"CategorySid"+"}", CategorySid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Optional parameters for the method 'ListInsightsQuestionnairesCategory' type ListInsightsQuestionnairesCategoryParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) *ListInsightsQuestionnairesCategoryParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) (*ListInsightsQuestionnairesCategoryParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsQuestionnairesCategoryParams) SetPageSize(PageSize int) *ListInsightsQuestionnairesCategoryParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsQuestionnairesCategoryParams) SetPageSize(PageSize int) (*ListInsightsQuestionnairesCategoryParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsQuestionnairesCategoryParams) SetLimit(Limit int) *ListInsightsQuestionnairesCategoryParams { - params.Limit = &Limit - return params +func (params *ListInsightsQuestionnairesCategoryParams) SetLimit(Limit int) (*ListInsightsQuestionnairesCategoryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsQuestionnairesCategory records from the API. Request is executed immediately. func (c *ApiService) PageInsightsQuestionnairesCategory(params *ListInsightsQuestionnairesCategoryParams, pageToken, pageNumber string) (*ListInsightsQuestionnairesCategoryResponse, error) { - path := "/v1/Insights/QualityManagement/Categories" + path := "/v1/Insights/QualityManagement/Categories" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListInsightsQuestionnairesCategoryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListInsightsQuestionnairesCategoryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists InsightsQuestionnairesCategory records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -197,6 +199,7 @@ func (c *ApiService) StreamInsightsQuestionnairesCategory(params *ListInsightsQu return recordChannel, errorChannel } + func (c *ApiService) streamInsightsQuestionnairesCategory(response *ListInsightsQuestionnairesCategoryResponse, params *ListInsightsQuestionnairesCategoryParams, recordChannel chan FlexV1InsightsQuestionnairesCategory, errorChannel chan error) { curRecord := 1 @@ -228,67 +231,68 @@ func (c *ApiService) streamInsightsQuestionnairesCategory(response *ListInsights } func (c *ApiService) getNextListInsightsQuestionnairesCategoryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsQuestionnairesCategoryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsQuestionnairesCategoryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateInsightsQuestionnairesCategory' type UpdateInsightsQuestionnairesCategoryParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The name of this category. - Name *string `json:"Name,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The name of this category. + Name *string `json:"Name,omitempty"` } -func (params *UpdateInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) *UpdateInsightsQuestionnairesCategoryParams { - params.Authorization = &Authorization - return params +func (params *UpdateInsightsQuestionnairesCategoryParams) SetAuthorization(Authorization string) (*UpdateInsightsQuestionnairesCategoryParams){ + params.Authorization = &Authorization + return params } -func (params *UpdateInsightsQuestionnairesCategoryParams) SetName(Name string) *UpdateInsightsQuestionnairesCategoryParams { - params.Name = &Name - return params +func (params *UpdateInsightsQuestionnairesCategoryParams) SetName(Name string) (*UpdateInsightsQuestionnairesCategoryParams){ + params.Name = &Name + return params } // To update the category for Questions func (c *ApiService) UpdateInsightsQuestionnairesCategory(CategorySid string, params *UpdateInsightsQuestionnairesCategoryParams) (*FlexV1InsightsQuestionnairesCategory, error) { - path := "/v1/Insights/QualityManagement/Categories/{CategorySid}" - path = strings.Replace(path, "{"+"CategorySid"+"}", CategorySid, -1) + path := "/v1/Insights/QualityManagement/Categories/{CategorySid}" + path = strings.Replace(path, "{"+"CategorySid"+"}", CategorySid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Name != nil { + data.Set("Name", *params.Name) + } - if params != nil && params.Name != nil { - data.Set("Name", *params.Name) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsQuestionnairesCategory{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsQuestionnairesCategory{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_quality_management_questionnaires.go b/rest/flex/v1/insights_quality_management_questionnaires.go index a912e3911..e1356db6b 100644 --- a/rest/flex/v1/insights_quality_management_questionnaires.go +++ b/rest/flex/v1/insights_quality_management_questionnaires.go @@ -18,221 +18,224 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInsightsQuestionnaires' type CreateInsightsQuestionnairesParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The name of this questionnaire - Name *string `json:"Name,omitempty"` - // The description of this questionnaire - Description *string `json:"Description,omitempty"` - // The flag to enable or disable questionnaire - Active *bool `json:"Active,omitempty"` - // The list of questions sids under a questionnaire - QuestionSids *[]string `json:"QuestionSids,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The name of this questionnaire + Name *string `json:"Name,omitempty"` + // The description of this questionnaire + Description *string `json:"Description,omitempty"` + // The flag to enable or disable questionnaire + Active *bool `json:"Active,omitempty"` + // The list of questions sids under a questionnaire + QuestionSids *[]string `json:"QuestionSids,omitempty"` } -func (params *CreateInsightsQuestionnairesParams) SetAuthorization(Authorization string) *CreateInsightsQuestionnairesParams { - params.Authorization = &Authorization - return params +func (params *CreateInsightsQuestionnairesParams) SetAuthorization(Authorization string) (*CreateInsightsQuestionnairesParams){ + params.Authorization = &Authorization + return params } -func (params *CreateInsightsQuestionnairesParams) SetName(Name string) *CreateInsightsQuestionnairesParams { - params.Name = &Name - return params +func (params *CreateInsightsQuestionnairesParams) SetName(Name string) (*CreateInsightsQuestionnairesParams){ + params.Name = &Name + return params } -func (params *CreateInsightsQuestionnairesParams) SetDescription(Description string) *CreateInsightsQuestionnairesParams { - params.Description = &Description - return params +func (params *CreateInsightsQuestionnairesParams) SetDescription(Description string) (*CreateInsightsQuestionnairesParams){ + params.Description = &Description + return params } -func (params *CreateInsightsQuestionnairesParams) SetActive(Active bool) *CreateInsightsQuestionnairesParams { - params.Active = &Active - return params +func (params *CreateInsightsQuestionnairesParams) SetActive(Active bool) (*CreateInsightsQuestionnairesParams){ + params.Active = &Active + return params } -func (params *CreateInsightsQuestionnairesParams) SetQuestionSids(QuestionSids []string) *CreateInsightsQuestionnairesParams { - params.QuestionSids = &QuestionSids - return params +func (params *CreateInsightsQuestionnairesParams) SetQuestionSids(QuestionSids []string) (*CreateInsightsQuestionnairesParams){ + params.QuestionSids = &QuestionSids + return params } // To create a Questionnaire func (c *ApiService) CreateInsightsQuestionnaires(params *CreateInsightsQuestionnairesParams) (*FlexV1InsightsQuestionnaires, error) { - path := "/v1/Insights/QualityManagement/Questionnaires" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Insights/QualityManagement/Questionnaires" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Name != nil { + data.Set("Name", *params.Name) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.Active != nil { + data.Set("Active", fmt.Sprint(*params.Active)) + } + if params != nil && params.QuestionSids != nil { + for _, item := range *params.QuestionSids { + data.Add("QuestionSids", item) + } + } - if params != nil && params.Name != nil { - data.Set("Name", *params.Name) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.Active != nil { - data.Set("Active", fmt.Sprint(*params.Active)) - } - if params != nil && params.QuestionSids != nil { - for _, item := range *params.QuestionSids { - data.Add("QuestionSids", item) - } - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsQuestionnaires{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsQuestionnaires{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteInsightsQuestionnaires' type DeleteInsightsQuestionnairesParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *DeleteInsightsQuestionnairesParams) SetAuthorization(Authorization string) *DeleteInsightsQuestionnairesParams { - params.Authorization = &Authorization - return params +func (params *DeleteInsightsQuestionnairesParams) SetAuthorization(Authorization string) (*DeleteInsightsQuestionnairesParams){ + params.Authorization = &Authorization + return params } // To delete the questionnaire -func (c *ApiService) DeleteInsightsQuestionnaires(QuestionnaireSid string, params *DeleteInsightsQuestionnairesParams) error { - path := "/v1/Insights/QualityManagement/Questionnaires/{QuestionnaireSid}" - path = strings.Replace(path, "{"+"QuestionnaireSid"+"}", QuestionnaireSid, -1) +func (c *ApiService) DeleteInsightsQuestionnaires(QuestionnaireSid string, params *DeleteInsightsQuestionnairesParams) (error) { + path := "/v1/Insights/QualityManagement/Questionnaires/{QuestionnaireSid}" + path = strings.Replace(path, "{"+"QuestionnaireSid"+"}", QuestionnaireSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } // Optional parameters for the method 'FetchInsightsQuestionnaires' type FetchInsightsQuestionnairesParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *FetchInsightsQuestionnairesParams) SetAuthorization(Authorization string) *FetchInsightsQuestionnairesParams { - params.Authorization = &Authorization - return params +func (params *FetchInsightsQuestionnairesParams) SetAuthorization(Authorization string) (*FetchInsightsQuestionnairesParams){ + params.Authorization = &Authorization + return params } // To get the Questionnaire Detail func (c *ApiService) FetchInsightsQuestionnaires(QuestionnaireSid string, params *FetchInsightsQuestionnairesParams) (*FlexV1InsightsQuestionnaires, error) { - path := "/v1/Insights/QualityManagement/Questionnaires/{QuestionnaireSid}" - path = strings.Replace(path, "{"+"QuestionnaireSid"+"}", QuestionnaireSid, -1) + path := "/v1/Insights/QualityManagement/Questionnaires/{QuestionnaireSid}" + path = strings.Replace(path, "{"+"QuestionnaireSid"+"}", QuestionnaireSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsQuestionnaires{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsQuestionnaires{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListInsightsQuestionnaires' type ListInsightsQuestionnairesParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // Flag indicating whether to include inactive questionnaires or not - IncludeInactive *bool `json:"IncludeInactive,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // Flag indicating whether to include inactive questionnaires or not + IncludeInactive *bool `json:"IncludeInactive,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsQuestionnairesParams) SetAuthorization(Authorization string) *ListInsightsQuestionnairesParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsQuestionnairesParams) SetAuthorization(Authorization string) (*ListInsightsQuestionnairesParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsQuestionnairesParams) SetIncludeInactive(IncludeInactive bool) *ListInsightsQuestionnairesParams { - params.IncludeInactive = &IncludeInactive - return params +func (params *ListInsightsQuestionnairesParams) SetIncludeInactive(IncludeInactive bool) (*ListInsightsQuestionnairesParams){ + params.IncludeInactive = &IncludeInactive + return params } -func (params *ListInsightsQuestionnairesParams) SetPageSize(PageSize int) *ListInsightsQuestionnairesParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsQuestionnairesParams) SetPageSize(PageSize int) (*ListInsightsQuestionnairesParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsQuestionnairesParams) SetLimit(Limit int) *ListInsightsQuestionnairesParams { - params.Limit = &Limit - return params +func (params *ListInsightsQuestionnairesParams) SetLimit(Limit int) (*ListInsightsQuestionnairesParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsQuestionnaires records from the API. Request is executed immediately. func (c *ApiService) PageInsightsQuestionnaires(params *ListInsightsQuestionnairesParams, pageToken, pageNumber string) (*ListInsightsQuestionnairesResponse, error) { - path := "/v1/Insights/QualityManagement/Questionnaires" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.IncludeInactive != nil { - data.Set("IncludeInactive", fmt.Sprint(*params.IncludeInactive)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsQuestionnairesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Insights/QualityManagement/Questionnaires" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.IncludeInactive != nil { + data.Set("IncludeInactive", fmt.Sprint(*params.IncludeInactive)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsQuestionnairesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists InsightsQuestionnaires records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -273,6 +276,7 @@ func (c *ApiService) StreamInsightsQuestionnaires(params *ListInsightsQuestionna return recordChannel, errorChannel } + func (c *ApiService) streamInsightsQuestionnaires(response *ListInsightsQuestionnairesResponse, params *ListInsightsQuestionnairesParams, recordChannel chan FlexV1InsightsQuestionnaires, errorChannel chan error) { curRecord := 1 @@ -304,96 +308,97 @@ func (c *ApiService) streamInsightsQuestionnaires(response *ListInsightsQuestion } func (c *ApiService) getNextListInsightsQuestionnairesResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsQuestionnairesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsQuestionnairesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateInsightsQuestionnaires' type UpdateInsightsQuestionnairesParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The flag to enable or disable questionnaire - Active *bool `json:"Active,omitempty"` - // The name of this questionnaire - Name *string `json:"Name,omitempty"` - // The description of this questionnaire - Description *string `json:"Description,omitempty"` - // The list of questions sids under a questionnaire - QuestionSids *[]string `json:"QuestionSids,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The flag to enable or disable questionnaire + Active *bool `json:"Active,omitempty"` + // The name of this questionnaire + Name *string `json:"Name,omitempty"` + // The description of this questionnaire + Description *string `json:"Description,omitempty"` + // The list of questions sids under a questionnaire + QuestionSids *[]string `json:"QuestionSids,omitempty"` } -func (params *UpdateInsightsQuestionnairesParams) SetAuthorization(Authorization string) *UpdateInsightsQuestionnairesParams { - params.Authorization = &Authorization - return params +func (params *UpdateInsightsQuestionnairesParams) SetAuthorization(Authorization string) (*UpdateInsightsQuestionnairesParams){ + params.Authorization = &Authorization + return params } -func (params *UpdateInsightsQuestionnairesParams) SetActive(Active bool) *UpdateInsightsQuestionnairesParams { - params.Active = &Active - return params +func (params *UpdateInsightsQuestionnairesParams) SetActive(Active bool) (*UpdateInsightsQuestionnairesParams){ + params.Active = &Active + return params } -func (params *UpdateInsightsQuestionnairesParams) SetName(Name string) *UpdateInsightsQuestionnairesParams { - params.Name = &Name - return params +func (params *UpdateInsightsQuestionnairesParams) SetName(Name string) (*UpdateInsightsQuestionnairesParams){ + params.Name = &Name + return params } -func (params *UpdateInsightsQuestionnairesParams) SetDescription(Description string) *UpdateInsightsQuestionnairesParams { - params.Description = &Description - return params +func (params *UpdateInsightsQuestionnairesParams) SetDescription(Description string) (*UpdateInsightsQuestionnairesParams){ + params.Description = &Description + return params } -func (params *UpdateInsightsQuestionnairesParams) SetQuestionSids(QuestionSids []string) *UpdateInsightsQuestionnairesParams { - params.QuestionSids = &QuestionSids - return params +func (params *UpdateInsightsQuestionnairesParams) SetQuestionSids(QuestionSids []string) (*UpdateInsightsQuestionnairesParams){ + params.QuestionSids = &QuestionSids + return params } // To update the questionnaire func (c *ApiService) UpdateInsightsQuestionnaires(QuestionnaireSid string, params *UpdateInsightsQuestionnairesParams) (*FlexV1InsightsQuestionnaires, error) { - path := "/v1/Insights/QualityManagement/Questionnaires/{QuestionnaireSid}" - path = strings.Replace(path, "{"+"QuestionnaireSid"+"}", QuestionnaireSid, -1) + path := "/v1/Insights/QualityManagement/Questionnaires/{QuestionnaireSid}" + path = strings.Replace(path, "{"+"QuestionnaireSid"+"}", QuestionnaireSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Active != nil { + data.Set("Active", fmt.Sprint(*params.Active)) + } + if params != nil && params.Name != nil { + data.Set("Name", *params.Name) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.QuestionSids != nil { + for _, item := range *params.QuestionSids { + data.Add("QuestionSids", item) + } + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Active != nil { - data.Set("Active", fmt.Sprint(*params.Active)) - } - if params != nil && params.Name != nil { - data.Set("Name", *params.Name) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.QuestionSids != nil { - for _, item := range *params.QuestionSids { - data.Add("QuestionSids", item) - } - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsQuestionnaires{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsQuestionnaires{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_quality_management_questions.go b/rest/flex/v1/insights_quality_management_questions.go index 604415a43..51fb8b345 100644 --- a/rest/flex/v1/insights_quality_management_questions.go +++ b/rest/flex/v1/insights_quality_management_questions.go @@ -18,192 +18,194 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInsightsQuestionnairesQuestion' type CreateInsightsQuestionnairesQuestionParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The SID of the category - CategorySid *string `json:"CategorySid,omitempty"` - // The question. - Question *string `json:"Question,omitempty"` - // The answer_set for the question. - AnswerSetId *string `json:"AnswerSetId,omitempty"` - // The flag to enable for disable NA for answer. - AllowNa *bool `json:"AllowNa,omitempty"` - // The description for the question. - Description *string `json:"Description,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The SID of the category + CategorySid *string `json:"CategorySid,omitempty"` + // The question. + Question *string `json:"Question,omitempty"` + // The answer_set for the question. + AnswerSetId *string `json:"AnswerSetId,omitempty"` + // The flag to enable for disable NA for answer. + AllowNa *bool `json:"AllowNa,omitempty"` + // The description for the question. + Description *string `json:"Description,omitempty"` } -func (params *CreateInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) *CreateInsightsQuestionnairesQuestionParams { - params.Authorization = &Authorization - return params +func (params *CreateInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) (*CreateInsightsQuestionnairesQuestionParams){ + params.Authorization = &Authorization + return params } -func (params *CreateInsightsQuestionnairesQuestionParams) SetCategorySid(CategorySid string) *CreateInsightsQuestionnairesQuestionParams { - params.CategorySid = &CategorySid - return params +func (params *CreateInsightsQuestionnairesQuestionParams) SetCategorySid(CategorySid string) (*CreateInsightsQuestionnairesQuestionParams){ + params.CategorySid = &CategorySid + return params } -func (params *CreateInsightsQuestionnairesQuestionParams) SetQuestion(Question string) *CreateInsightsQuestionnairesQuestionParams { - params.Question = &Question - return params +func (params *CreateInsightsQuestionnairesQuestionParams) SetQuestion(Question string) (*CreateInsightsQuestionnairesQuestionParams){ + params.Question = &Question + return params } -func (params *CreateInsightsQuestionnairesQuestionParams) SetAnswerSetId(AnswerSetId string) *CreateInsightsQuestionnairesQuestionParams { - params.AnswerSetId = &AnswerSetId - return params +func (params *CreateInsightsQuestionnairesQuestionParams) SetAnswerSetId(AnswerSetId string) (*CreateInsightsQuestionnairesQuestionParams){ + params.AnswerSetId = &AnswerSetId + return params } -func (params *CreateInsightsQuestionnairesQuestionParams) SetAllowNa(AllowNa bool) *CreateInsightsQuestionnairesQuestionParams { - params.AllowNa = &AllowNa - return params +func (params *CreateInsightsQuestionnairesQuestionParams) SetAllowNa(AllowNa bool) (*CreateInsightsQuestionnairesQuestionParams){ + params.AllowNa = &AllowNa + return params } -func (params *CreateInsightsQuestionnairesQuestionParams) SetDescription(Description string) *CreateInsightsQuestionnairesQuestionParams { - params.Description = &Description - return params +func (params *CreateInsightsQuestionnairesQuestionParams) SetDescription(Description string) (*CreateInsightsQuestionnairesQuestionParams){ + params.Description = &Description + return params } // To create a question for a Category func (c *ApiService) CreateInsightsQuestionnairesQuestion(params *CreateInsightsQuestionnairesQuestionParams) (*FlexV1InsightsQuestionnairesQuestion, error) { - path := "/v1/Insights/QualityManagement/Questions" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Insights/QualityManagement/Questions" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CategorySid != nil { + data.Set("CategorySid", *params.CategorySid) + } + if params != nil && params.Question != nil { + data.Set("Question", *params.Question) + } + if params != nil && params.AnswerSetId != nil { + data.Set("AnswerSetId", *params.AnswerSetId) + } + if params != nil && params.AllowNa != nil { + data.Set("AllowNa", fmt.Sprint(*params.AllowNa)) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } - if params != nil && params.CategorySid != nil { - data.Set("CategorySid", *params.CategorySid) - } - if params != nil && params.Question != nil { - data.Set("Question", *params.Question) - } - if params != nil && params.AnswerSetId != nil { - data.Set("AnswerSetId", *params.AnswerSetId) - } - if params != nil && params.AllowNa != nil { - data.Set("AllowNa", fmt.Sprint(*params.AllowNa)) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &FlexV1InsightsQuestionnairesQuestion{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &FlexV1InsightsQuestionnairesQuestion{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'DeleteInsightsQuestionnairesQuestion' type DeleteInsightsQuestionnairesQuestionParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *DeleteInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) *DeleteInsightsQuestionnairesQuestionParams { - params.Authorization = &Authorization - return params +func (params *DeleteInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) (*DeleteInsightsQuestionnairesQuestionParams){ + params.Authorization = &Authorization + return params } -// -func (c *ApiService) DeleteInsightsQuestionnairesQuestion(QuestionSid string, params *DeleteInsightsQuestionnairesQuestionParams) error { - path := "/v1/Insights/QualityManagement/Questions/{QuestionSid}" - path = strings.Replace(path, "{"+"QuestionSid"+"}", QuestionSid, -1) +// +func (c *ApiService) DeleteInsightsQuestionnairesQuestion(QuestionSid string, params *DeleteInsightsQuestionnairesQuestionParams) (error) { + path := "/v1/Insights/QualityManagement/Questions/{QuestionSid}" + path = strings.Replace(path, "{"+"QuestionSid"+"}", QuestionSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } // Optional parameters for the method 'ListInsightsQuestionnairesQuestion' type ListInsightsQuestionnairesQuestionParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The list of category SIDs - CategorySid *[]string `json:"CategorySid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The list of category SIDs + CategorySid *[]string `json:"CategorySid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) *ListInsightsQuestionnairesQuestionParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) (*ListInsightsQuestionnairesQuestionParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsQuestionnairesQuestionParams) SetCategorySid(CategorySid []string) *ListInsightsQuestionnairesQuestionParams { - params.CategorySid = &CategorySid - return params +func (params *ListInsightsQuestionnairesQuestionParams) SetCategorySid(CategorySid []string) (*ListInsightsQuestionnairesQuestionParams){ + params.CategorySid = &CategorySid + return params } -func (params *ListInsightsQuestionnairesQuestionParams) SetPageSize(PageSize int) *ListInsightsQuestionnairesQuestionParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsQuestionnairesQuestionParams) SetPageSize(PageSize int) (*ListInsightsQuestionnairesQuestionParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsQuestionnairesQuestionParams) SetLimit(Limit int) *ListInsightsQuestionnairesQuestionParams { - params.Limit = &Limit - return params +func (params *ListInsightsQuestionnairesQuestionParams) SetLimit(Limit int) (*ListInsightsQuestionnairesQuestionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsQuestionnairesQuestion records from the API. Request is executed immediately. func (c *ApiService) PageInsightsQuestionnairesQuestion(params *ListInsightsQuestionnairesQuestionParams, pageToken, pageNumber string) (*ListInsightsQuestionnairesQuestionResponse, error) { - path := "/v1/Insights/QualityManagement/Questions" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CategorySid != nil { - for _, item := range *params.CategorySid { - data.Add("CategorySid", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsQuestionnairesQuestionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Insights/QualityManagement/Questions" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CategorySid != nil { + for _, item := range *params.CategorySid { + data.Add("CategorySid", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsQuestionnairesQuestionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists InsightsQuestionnairesQuestion records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -244,6 +246,7 @@ func (c *ApiService) StreamInsightsQuestionnairesQuestion(params *ListInsightsQu return recordChannel, errorChannel } + func (c *ApiService) streamInsightsQuestionnairesQuestion(response *ListInsightsQuestionnairesQuestionResponse, params *ListInsightsQuestionnairesQuestionParams, recordChannel chan FlexV1InsightsQuestionnairesQuestion, errorChannel chan error) { curRecord := 1 @@ -275,103 +278,104 @@ func (c *ApiService) streamInsightsQuestionnairesQuestion(response *ListInsights } func (c *ApiService) getNextListInsightsQuestionnairesQuestionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsQuestionnairesQuestionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsQuestionnairesQuestionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateInsightsQuestionnairesQuestion' type UpdateInsightsQuestionnairesQuestionParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // The flag to enable for disable NA for answer. - AllowNa *bool `json:"AllowNa,omitempty"` - // The SID of the category - CategorySid *string `json:"CategorySid,omitempty"` - // The question. - Question *string `json:"Question,omitempty"` - // The description for the question. - Description *string `json:"Description,omitempty"` - // The answer_set for the question. - AnswerSetId *string `json:"AnswerSetId,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // The flag to enable for disable NA for answer. + AllowNa *bool `json:"AllowNa,omitempty"` + // The SID of the category + CategorySid *string `json:"CategorySid,omitempty"` + // The question. + Question *string `json:"Question,omitempty"` + // The description for the question. + Description *string `json:"Description,omitempty"` + // The answer_set for the question. + AnswerSetId *string `json:"AnswerSetId,omitempty"` } -func (params *UpdateInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) *UpdateInsightsQuestionnairesQuestionParams { - params.Authorization = &Authorization - return params +func (params *UpdateInsightsQuestionnairesQuestionParams) SetAuthorization(Authorization string) (*UpdateInsightsQuestionnairesQuestionParams){ + params.Authorization = &Authorization + return params } -func (params *UpdateInsightsQuestionnairesQuestionParams) SetAllowNa(AllowNa bool) *UpdateInsightsQuestionnairesQuestionParams { - params.AllowNa = &AllowNa - return params +func (params *UpdateInsightsQuestionnairesQuestionParams) SetAllowNa(AllowNa bool) (*UpdateInsightsQuestionnairesQuestionParams){ + params.AllowNa = &AllowNa + return params } -func (params *UpdateInsightsQuestionnairesQuestionParams) SetCategorySid(CategorySid string) *UpdateInsightsQuestionnairesQuestionParams { - params.CategorySid = &CategorySid - return params +func (params *UpdateInsightsQuestionnairesQuestionParams) SetCategorySid(CategorySid string) (*UpdateInsightsQuestionnairesQuestionParams){ + params.CategorySid = &CategorySid + return params } -func (params *UpdateInsightsQuestionnairesQuestionParams) SetQuestion(Question string) *UpdateInsightsQuestionnairesQuestionParams { - params.Question = &Question - return params +func (params *UpdateInsightsQuestionnairesQuestionParams) SetQuestion(Question string) (*UpdateInsightsQuestionnairesQuestionParams){ + params.Question = &Question + return params } -func (params *UpdateInsightsQuestionnairesQuestionParams) SetDescription(Description string) *UpdateInsightsQuestionnairesQuestionParams { - params.Description = &Description - return params +func (params *UpdateInsightsQuestionnairesQuestionParams) SetDescription(Description string) (*UpdateInsightsQuestionnairesQuestionParams){ + params.Description = &Description + return params } -func (params *UpdateInsightsQuestionnairesQuestionParams) SetAnswerSetId(AnswerSetId string) *UpdateInsightsQuestionnairesQuestionParams { - params.AnswerSetId = &AnswerSetId - return params +func (params *UpdateInsightsQuestionnairesQuestionParams) SetAnswerSetId(AnswerSetId string) (*UpdateInsightsQuestionnairesQuestionParams){ + params.AnswerSetId = &AnswerSetId + return params } // To update the question func (c *ApiService) UpdateInsightsQuestionnairesQuestion(QuestionSid string, params *UpdateInsightsQuestionnairesQuestionParams) (*FlexV1InsightsQuestionnairesQuestion, error) { - path := "/v1/Insights/QualityManagement/Questions/{QuestionSid}" - path = strings.Replace(path, "{"+"QuestionSid"+"}", QuestionSid, -1) + path := "/v1/Insights/QualityManagement/Questions/{QuestionSid}" + path = strings.Replace(path, "{"+"QuestionSid"+"}", QuestionSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AllowNa != nil { + data.Set("AllowNa", fmt.Sprint(*params.AllowNa)) + } + if params != nil && params.CategorySid != nil { + data.Set("CategorySid", *params.CategorySid) + } + if params != nil && params.Question != nil { + data.Set("Question", *params.Question) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.AnswerSetId != nil { + data.Set("AnswerSetId", *params.AnswerSetId) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AllowNa != nil { - data.Set("AllowNa", fmt.Sprint(*params.AllowNa)) - } - if params != nil && params.CategorySid != nil { - data.Set("CategorySid", *params.CategorySid) - } - if params != nil && params.Question != nil { - data.Set("Question", *params.Question) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.AnswerSetId != nil { - data.Set("AnswerSetId", *params.AnswerSetId) - } if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &FlexV1InsightsQuestionnairesQuestion{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsQuestionnairesQuestion{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_quality_management_settings_answer_sets.go b/rest/flex/v1/insights_quality_management_settings_answer_sets.go index 2cc956dfa..f7ce1c4b2 100644 --- a/rest/flex/v1/insights_quality_management_settings_answer_sets.go +++ b/rest/flex/v1/insights_quality_management_settings_answer_sets.go @@ -16,42 +16,47 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchInsightsSettingsAnswersets' type FetchInsightsSettingsAnswersetsParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *FetchInsightsSettingsAnswersetsParams) SetAuthorization(Authorization string) *FetchInsightsSettingsAnswersetsParams { - params.Authorization = &Authorization - return params +func (params *FetchInsightsSettingsAnswersetsParams) SetAuthorization(Authorization string) (*FetchInsightsSettingsAnswersetsParams){ + params.Authorization = &Authorization + return params } // To get the Answer Set Settings for an Account func (c *ApiService) FetchInsightsSettingsAnswersets(params *FetchInsightsSettingsAnswersetsParams) (*FlexV1InsightsSettingsAnswersets, error) { - path := "/v1/Insights/QualityManagement/Settings/AnswerSets" + path := "/v1/Insights/QualityManagement/Settings/AnswerSets" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsSettingsAnswersets{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsSettingsAnswersets{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_quality_management_settings_comment_tags.go b/rest/flex/v1/insights_quality_management_settings_comment_tags.go index 6f3bc9306..aaae8880e 100644 --- a/rest/flex/v1/insights_quality_management_settings_comment_tags.go +++ b/rest/flex/v1/insights_quality_management_settings_comment_tags.go @@ -16,42 +16,47 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchInsightsSettingsComment' type FetchInsightsSettingsCommentParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *FetchInsightsSettingsCommentParams) SetAuthorization(Authorization string) *FetchInsightsSettingsCommentParams { - params.Authorization = &Authorization - return params +func (params *FetchInsightsSettingsCommentParams) SetAuthorization(Authorization string) (*FetchInsightsSettingsCommentParams){ + params.Authorization = &Authorization + return params } // To get the Comment Settings for an Account func (c *ApiService) FetchInsightsSettingsComment(params *FetchInsightsSettingsCommentParams) (*FlexV1InsightsSettingsComment, error) { - path := "/v1/Insights/QualityManagement/Settings/CommentTags" + path := "/v1/Insights/QualityManagement/Settings/CommentTags" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsSettingsComment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsSettingsComment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_segments.go b/rest/flex/v1/insights_segments.go index bd0514767..736fa10dd 100644 --- a/rest/flex/v1/insights_segments.go +++ b/rest/flex/v1/insights_segments.go @@ -19,83 +19,85 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListInsightsSegments' type ListInsightsSegmentsParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` - // To unique id of the segment - SegmentId *string `json:"SegmentId,omitempty"` - // The list of reservation Ids - ReservationId *[]string `json:"ReservationId,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` + // To unique id of the segment + SegmentId *string `json:"SegmentId,omitempty"` + // The list of reservation Ids + ReservationId *[]string `json:"ReservationId,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInsightsSegmentsParams) SetAuthorization(Authorization string) *ListInsightsSegmentsParams { - params.Authorization = &Authorization - return params +func (params *ListInsightsSegmentsParams) SetAuthorization(Authorization string) (*ListInsightsSegmentsParams){ + params.Authorization = &Authorization + return params } -func (params *ListInsightsSegmentsParams) SetSegmentId(SegmentId string) *ListInsightsSegmentsParams { - params.SegmentId = &SegmentId - return params +func (params *ListInsightsSegmentsParams) SetSegmentId(SegmentId string) (*ListInsightsSegmentsParams){ + params.SegmentId = &SegmentId + return params } -func (params *ListInsightsSegmentsParams) SetReservationId(ReservationId []string) *ListInsightsSegmentsParams { - params.ReservationId = &ReservationId - return params +func (params *ListInsightsSegmentsParams) SetReservationId(ReservationId []string) (*ListInsightsSegmentsParams){ + params.ReservationId = &ReservationId + return params } -func (params *ListInsightsSegmentsParams) SetPageSize(PageSize int) *ListInsightsSegmentsParams { - params.PageSize = &PageSize - return params +func (params *ListInsightsSegmentsParams) SetPageSize(PageSize int) (*ListInsightsSegmentsParams){ + params.PageSize = &PageSize + return params } -func (params *ListInsightsSegmentsParams) SetLimit(Limit int) *ListInsightsSegmentsParams { - params.Limit = &Limit - return params +func (params *ListInsightsSegmentsParams) SetLimit(Limit int) (*ListInsightsSegmentsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InsightsSegments records from the API. Request is executed immediately. func (c *ApiService) PageInsightsSegments(params *ListInsightsSegmentsParams, pageToken, pageNumber string) (*ListInsightsSegmentsResponse, error) { - path := "/v1/Insights/Segments" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.SegmentId != nil { - data.Set("SegmentId", *params.SegmentId) - } - if params != nil && params.ReservationId != nil { - for _, item := range *params.ReservationId { - data.Add("ReservationId", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsSegmentsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Insights/Segments" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.SegmentId != nil { + data.Set("SegmentId", *params.SegmentId) + } + if params != nil && params.ReservationId != nil { + for _, item := range *params.ReservationId { + data.Add("ReservationId", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsSegmentsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists InsightsSegments records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -136,6 +138,7 @@ func (c *ApiService) StreamInsightsSegments(params *ListInsightsSegmentsParams) return recordChannel, errorChannel } + func (c *ApiService) streamInsightsSegments(response *ListInsightsSegmentsResponse, params *ListInsightsSegmentsParams, recordChannel chan FlexV1InsightsSegments, errorChannel chan error) { curRecord := 1 @@ -167,19 +170,20 @@ func (c *ApiService) streamInsightsSegments(response *ListInsightsSegmentsRespon } func (c *ApiService) getNextListInsightsSegmentsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInsightsSegmentsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInsightsSegmentsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/flex/v1/insights_session.go b/rest/flex/v1/insights_session.go index 341cb806e..ead079578 100644 --- a/rest/flex/v1/insights_session.go +++ b/rest/flex/v1/insights_session.go @@ -16,42 +16,47 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInsightsSession' type CreateInsightsSessionParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *CreateInsightsSessionParams) SetAuthorization(Authorization string) *CreateInsightsSessionParams { - params.Authorization = &Authorization - return params +func (params *CreateInsightsSessionParams) SetAuthorization(Authorization string) (*CreateInsightsSessionParams){ + params.Authorization = &Authorization + return params } // To obtain session details for fetching reports and dashboards func (c *ApiService) CreateInsightsSession(params *CreateInsightsSessionParams) (*FlexV1InsightsSession, error) { - path := "/v1/Insights/Session" + path := "/v1/Insights/Session" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsSession{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsSession{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/insights_user_roles.go b/rest/flex/v1/insights_user_roles.go index 7c13c21e7..f2077ea12 100644 --- a/rest/flex/v1/insights_user_roles.go +++ b/rest/flex/v1/insights_user_roles.go @@ -16,42 +16,47 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchInsightsUserRoles' type FetchInsightsUserRolesParams struct { - // The Authorization HTTP request header - Authorization *string `json:"Authorization,omitempty"` + // The Authorization HTTP request header + Authorization *string `json:"Authorization,omitempty"` } -func (params *FetchInsightsUserRolesParams) SetAuthorization(Authorization string) *FetchInsightsUserRolesParams { - params.Authorization = &Authorization - return params +func (params *FetchInsightsUserRolesParams) SetAuthorization(Authorization string) (*FetchInsightsUserRolesParams){ + params.Authorization = &Authorization + return params } // This is used by Flex UI and Quality Management to fetch the Flex Insights roles for the user func (c *ApiService) FetchInsightsUserRoles(params *FetchInsightsUserRolesParams) (*FlexV1InsightsUserRoles, error) { - path := "/v1/Insights/UserRoles" + path := "/v1/Insights/UserRoles" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.Authorization != nil { headers["Authorization"] = *params.Authorization } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1InsightsUserRoles{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1InsightsUserRoles{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/interactions.go b/rest/flex/v1/interactions.go index fb0d949a7..7ea0ddf09 100644 --- a/rest/flex/v1/interactions.go +++ b/rest/flex/v1/interactions.go @@ -16,96 +16,102 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInteraction' type CreateInteractionParams struct { - // The Interaction's channel. - Channel *interface{} `json:"Channel,omitempty"` - // The Interaction's routing logic. - Routing *interface{} `json:"Routing,omitempty"` - // The Interaction context sid is used for adding a context lookup sid - InteractionContextSid *string `json:"InteractionContextSid,omitempty"` + // The Interaction's channel. + Channel *interface{} `json:"Channel,omitempty"` + // The Interaction's routing logic. + Routing *interface{} `json:"Routing,omitempty"` + // The Interaction context sid is used for adding a context lookup sid + InteractionContextSid *string `json:"InteractionContextSid,omitempty"` } -func (params *CreateInteractionParams) SetChannel(Channel interface{}) *CreateInteractionParams { - params.Channel = &Channel - return params +func (params *CreateInteractionParams) SetChannel(Channel interface{}) (*CreateInteractionParams){ + params.Channel = &Channel + return params } -func (params *CreateInteractionParams) SetRouting(Routing interface{}) *CreateInteractionParams { - params.Routing = &Routing - return params +func (params *CreateInteractionParams) SetRouting(Routing interface{}) (*CreateInteractionParams){ + params.Routing = &Routing + return params } -func (params *CreateInteractionParams) SetInteractionContextSid(InteractionContextSid string) *CreateInteractionParams { - params.InteractionContextSid = &InteractionContextSid - return params +func (params *CreateInteractionParams) SetInteractionContextSid(InteractionContextSid string) (*CreateInteractionParams){ + params.InteractionContextSid = &InteractionContextSid + return params } // Create a new Interaction. func (c *ApiService) CreateInteraction(params *CreateInteractionParams) (*FlexV1Interaction, error) { - path := "/v1/Interactions" + path := "/v1/Interactions" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Channel != nil { + v, err := json.Marshal(params.Channel) - if params != nil && params.Channel != nil { - v, err := json.Marshal(params.Channel) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Channel", string(v)) + } + if params != nil && params.Routing != nil { + v, err := json.Marshal(params.Routing) - data.Set("Channel", string(v)) - } - if params != nil && params.Routing != nil { - v, err := json.Marshal(params.Routing) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Routing", string(v)) + } + if params != nil && params.InteractionContextSid != nil { + data.Set("InteractionContextSid", *params.InteractionContextSid) + } - data.Set("Routing", string(v)) - } - if params != nil && params.InteractionContextSid != nil { - data.Set("InteractionContextSid", *params.InteractionContextSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1Interaction{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1Interaction{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) FetchInteraction(Sid string) (*FlexV1Interaction, error) { - path := "/v1/Interactions/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchInteraction(Sid string, ) (*FlexV1Interaction, error) { + path := "/v1/Interactions/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1Interaction{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1Interaction{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/interactions_channels.go b/rest/flex/v1/interactions_channels.go index 594818e16..35ed0f89a 100644 --- a/rest/flex/v1/interactions_channels.go +++ b/rest/flex/v1/interactions_channels.go @@ -18,85 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a Channel for an Interaction. -func (c *ApiService) FetchInteractionChannel(InteractionSid string, Sid string) (*FlexV1InteractionChannel, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchInteractionChannel(InteractionSid string, Sid string, ) (*FlexV1InteractionChannel, error) { + path := "/v1/Interactions/{InteractionSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &FlexV1InteractionChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &FlexV1InteractionChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListInteractionChannel' type ListInteractionChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInteractionChannelParams) SetPageSize(PageSize int) *ListInteractionChannelParams { - params.PageSize = &PageSize - return params +func (params *ListInteractionChannelParams) SetPageSize(PageSize int) (*ListInteractionChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListInteractionChannelParams) SetLimit(Limit int) *ListInteractionChannelParams { - params.Limit = &Limit - return params +func (params *ListInteractionChannelParams) SetLimit(Limit int) (*ListInteractionChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InteractionChannel records from the API. Request is executed immediately. func (c *ApiService) PageInteractionChannel(InteractionSid string, params *ListInteractionChannelParams, pageToken, pageNumber string) (*ListInteractionChannelResponse, error) { - path := "/v1/Interactions/{InteractionSid}/Channels" + path := "/v1/Interactions/{InteractionSid}/Channels" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListInteractionChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListInteractionChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists InteractionChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -137,6 +139,7 @@ func (c *ApiService) StreamInteractionChannel(InteractionSid string, params *Lis return recordChannel, errorChannel } + func (c *ApiService) streamInteractionChannel(response *ListInteractionChannelResponse, params *ListInteractionChannelParams, recordChannel chan FlexV1InteractionChannel, errorChannel chan error) { curRecord := 1 @@ -168,73 +171,75 @@ func (c *ApiService) streamInteractionChannel(response *ListInteractionChannelRe } func (c *ApiService) getNextListInteractionChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInteractionChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInteractionChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateInteractionChannel' type UpdateInteractionChannelParams struct { - // - Status *string `json:"Status,omitempty"` - // It changes the state of associated tasks. Routing status is required, When the channel status is set to `inactive`. Allowed Value for routing status is `closed`. Otherwise Optional, if not specified, all tasks will be set to `wrapping`. - Routing *interface{} `json:"Routing,omitempty"` + // + Status *string `json:"Status,omitempty"` + // It changes the state of associated tasks. Routing status is required, When the channel status is set to `inactive`. Allowed Value for routing status is `closed`. Otherwise Optional, if not specified, all tasks will be set to `wrapping`. + Routing *interface{} `json:"Routing,omitempty"` } -func (params *UpdateInteractionChannelParams) SetStatus(Status string) *UpdateInteractionChannelParams { - params.Status = &Status - return params +func (params *UpdateInteractionChannelParams) SetStatus(Status string) (*UpdateInteractionChannelParams){ + params.Status = &Status + return params } -func (params *UpdateInteractionChannelParams) SetRouting(Routing interface{}) *UpdateInteractionChannelParams { - params.Routing = &Routing - return params +func (params *UpdateInteractionChannelParams) SetRouting(Routing interface{}) (*UpdateInteractionChannelParams){ + params.Routing = &Routing + return params } // Update an existing Interaction Channel. func (c *ApiService) UpdateInteractionChannel(InteractionSid string, Sid string, params *UpdateInteractionChannelParams) (*FlexV1InteractionChannel, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Interactions/{InteractionSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Routing != nil { - v, err := json.Marshal(params.Routing) + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Routing != nil { + v, err := json.Marshal(params.Routing) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Routing", string(v)) - } + data.Set("Routing", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &FlexV1InteractionChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &FlexV1InteractionChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/interactions_channels_invites.go b/rest/flex/v1/interactions_channels_invites.go index 9f831a849..052059f4d 100644 --- a/rest/flex/v1/interactions_channels_invites.go +++ b/rest/flex/v1/interactions_channels_invites.go @@ -18,107 +18,108 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInteractionChannelInvite' type CreateInteractionChannelInviteParams struct { - // The Interaction's routing logic. - Routing *interface{} `json:"Routing,omitempty"` + // The Interaction's routing logic. + Routing *interface{} `json:"Routing,omitempty"` } -func (params *CreateInteractionChannelInviteParams) SetRouting(Routing interface{}) *CreateInteractionChannelInviteParams { - params.Routing = &Routing - return params +func (params *CreateInteractionChannelInviteParams) SetRouting(Routing interface{}) (*CreateInteractionChannelInviteParams){ + params.Routing = &Routing + return params } // Invite an Agent or a TaskQueue to a Channel. func (c *ApiService) CreateInteractionChannelInvite(InteractionSid string, ChannelSid string, params *CreateInteractionChannelInviteParams) (*FlexV1InteractionChannelInvite, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Invites" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Invites" + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Routing != nil { - v, err := json.Marshal(params.Routing) + if params != nil && params.Routing != nil { + v, err := json.Marshal(params.Routing) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Routing", string(v)) - } + data.Set("Routing", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &FlexV1InteractionChannelInvite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &FlexV1InteractionChannelInvite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListInteractionChannelInvite' type ListInteractionChannelInviteParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInteractionChannelInviteParams) SetPageSize(PageSize int) *ListInteractionChannelInviteParams { - params.PageSize = &PageSize - return params +func (params *ListInteractionChannelInviteParams) SetPageSize(PageSize int) (*ListInteractionChannelInviteParams){ + params.PageSize = &PageSize + return params } -func (params *ListInteractionChannelInviteParams) SetLimit(Limit int) *ListInteractionChannelInviteParams { - params.Limit = &Limit - return params +func (params *ListInteractionChannelInviteParams) SetLimit(Limit int) (*ListInteractionChannelInviteParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InteractionChannelInvite records from the API. Request is executed immediately. func (c *ApiService) PageInteractionChannelInvite(InteractionSid string, ChannelSid string, params *ListInteractionChannelInviteParams, pageToken, pageNumber string) (*ListInteractionChannelInviteResponse, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Invites" + path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Invites" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListInteractionChannelInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListInteractionChannelInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists InteractionChannelInvite records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -159,6 +160,7 @@ func (c *ApiService) StreamInteractionChannelInvite(InteractionSid string, Chann return recordChannel, errorChannel } + func (c *ApiService) streamInteractionChannelInvite(response *ListInteractionChannelInviteResponse, params *ListInteractionChannelInviteParams, recordChannel chan FlexV1InteractionChannelInvite, errorChannel chan error) { curRecord := 1 @@ -190,19 +192,20 @@ func (c *ApiService) streamInteractionChannelInvite(response *ListInteractionCha } func (c *ApiService) getNextListInteractionChannelInviteResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInteractionChannelInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInteractionChannelInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/flex/v1/interactions_channels_participants.go b/rest/flex/v1/interactions_channels_participants.go index 3550249c1..c13dd2d52 100644 --- a/rest/flex/v1/interactions_channels_participants.go +++ b/rest/flex/v1/interactions_channels_participants.go @@ -18,116 +18,117 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInteractionChannelParticipant' type CreateInteractionChannelParticipantParams struct { - // - Type *string `json:"Type,omitempty"` - // JSON representing the Media Properties for the new Participant. - MediaProperties *interface{} `json:"MediaProperties,omitempty"` + // + Type *string `json:"Type,omitempty"` + // JSON representing the Media Properties for the new Participant. + MediaProperties *interface{} `json:"MediaProperties,omitempty"` } -func (params *CreateInteractionChannelParticipantParams) SetType(Type string) *CreateInteractionChannelParticipantParams { - params.Type = &Type - return params +func (params *CreateInteractionChannelParticipantParams) SetType(Type string) (*CreateInteractionChannelParticipantParams){ + params.Type = &Type + return params } -func (params *CreateInteractionChannelParticipantParams) SetMediaProperties(MediaProperties interface{}) *CreateInteractionChannelParticipantParams { - params.MediaProperties = &MediaProperties - return params +func (params *CreateInteractionChannelParticipantParams) SetMediaProperties(MediaProperties interface{}) (*CreateInteractionChannelParticipantParams){ + params.MediaProperties = &MediaProperties + return params } // Add a Participant to a Channel. func (c *ApiService) CreateInteractionChannelParticipant(InteractionSid string, ChannelSid string, params *CreateInteractionChannelParticipantParams) (*FlexV1InteractionChannelParticipant, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Participants" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Participants" + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.MediaProperties != nil { - v, err := json.Marshal(params.MediaProperties) + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.MediaProperties != nil { + v, err := json.Marshal(params.MediaProperties) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("MediaProperties", string(v)) - } + data.Set("MediaProperties", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &FlexV1InteractionChannelParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &FlexV1InteractionChannelParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListInteractionChannelParticipant' type ListInteractionChannelParticipantParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInteractionChannelParticipantParams) SetPageSize(PageSize int) *ListInteractionChannelParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListInteractionChannelParticipantParams) SetPageSize(PageSize int) (*ListInteractionChannelParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListInteractionChannelParticipantParams) SetLimit(Limit int) *ListInteractionChannelParticipantParams { - params.Limit = &Limit - return params +func (params *ListInteractionChannelParticipantParams) SetLimit(Limit int) (*ListInteractionChannelParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of InteractionChannelParticipant records from the API. Request is executed immediately. func (c *ApiService) PageInteractionChannelParticipant(InteractionSid string, ChannelSid string, params *ListInteractionChannelParticipantParams, pageToken, pageNumber string) (*ListInteractionChannelParticipantResponse, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Participants" + path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Participants" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListInteractionChannelParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListInteractionChannelParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists InteractionChannelParticipant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -168,6 +169,7 @@ func (c *ApiService) StreamInteractionChannelParticipant(InteractionSid string, return recordChannel, errorChannel } + func (c *ApiService) streamInteractionChannelParticipant(response *ListInteractionChannelParticipantResponse, params *ListInteractionChannelParticipantParams, recordChannel chan FlexV1InteractionChannelParticipant, errorChannel chan error) { curRecord := 1 @@ -199,59 +201,61 @@ func (c *ApiService) streamInteractionChannelParticipant(response *ListInteracti } func (c *ApiService) getNextListInteractionChannelParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInteractionChannelParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInteractionChannelParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateInteractionChannelParticipant' type UpdateInteractionChannelParticipantParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateInteractionChannelParticipantParams) SetStatus(Status string) *UpdateInteractionChannelParticipantParams { - params.Status = &Status - return params +func (params *UpdateInteractionChannelParticipantParams) SetStatus(Status string) (*UpdateInteractionChannelParticipantParams){ + params.Status = &Status + return params } // Update an existing Channel Participant. func (c *ApiService) UpdateInteractionChannelParticipant(InteractionSid string, ChannelSid string, Sid string, params *UpdateInteractionChannelParticipantParams) (*FlexV1InteractionChannelParticipant, error) { - path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Interactions/{InteractionSid}/Channels/{ChannelSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"InteractionSid"+"}", InteractionSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &FlexV1InteractionChannelParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &FlexV1InteractionChannelParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v1/model_flex_v1_channel.go b/rest/flex/v1/model_flex_v1_channel.go index ee64e838e..cbfe7014b 100644 --- a/rest/flex/v1/model_flex_v1_channel.go +++ b/rest/flex/v1/model_flex_v1_channel.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // FlexV1Channel struct for FlexV1Channel type FlexV1Channel struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flex Flow. + // The SID of the Flex Flow. FlexFlowSid *string `json:"flex_flow_sid,omitempty"` - // The unique string that we created to identify the Channel resource. + // The unique string that we created to identify the Channel resource. Sid *string `json:"sid,omitempty"` - // The SID of the chat user. + // The SID of the chat user. UserSid *string `json:"user_sid,omitempty"` - // The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` + // The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` TaskSid *string `json:"task_sid,omitempty"` - // The absolute URL of the Flex chat channel resource. + // The absolute URL of the Flex chat channel resource. Url *string `json:"url,omitempty"` - // The date and time in GMT when the Flex chat channel was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Flex chat channel was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Flex chat channel was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Flex chat channel was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_configuration.go b/rest/flex/v1/model_flex_v1_configuration.go index 8866e8eb7..9e5f46f6b 100644 --- a/rest/flex/v1/model_flex_v1_configuration.go +++ b/rest/flex/v1/model_flex_v1_configuration.go @@ -13,106 +13,106 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // FlexV1Configuration struct for FlexV1Configuration type FlexV1Configuration struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Configuration resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Configuration resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the Configuration resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Configuration resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Configuration resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Configuration resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // An object that contains application-specific data. + // An object that contains application-specific data. Attributes *interface{} `json:"attributes,omitempty"` - Status *string `json:"status,omitempty"` - // The SID of the TaskRouter Workspace. + Status *string `json:"status,omitempty"` + // The SID of the TaskRouter Workspace. TaskrouterWorkspaceSid *string `json:"taskrouter_workspace_sid,omitempty"` - // The SID of the TaskRouter target Workflow. + // The SID of the TaskRouter target Workflow. TaskrouterTargetWorkflowSid *string `json:"taskrouter_target_workflow_sid,omitempty"` - // The SID of the TaskRouter Target TaskQueue. + // The SID of the TaskRouter Target TaskQueue. TaskrouterTargetTaskqueueSid *string `json:"taskrouter_target_taskqueue_sid,omitempty"` - // The list of TaskRouter TaskQueues. + // The list of TaskRouter TaskQueues. TaskrouterTaskqueues *[]interface{} `json:"taskrouter_taskqueues,omitempty"` - // The Skill description for TaskRouter workers. + // The Skill description for TaskRouter workers. TaskrouterSkills *[]interface{} `json:"taskrouter_skills,omitempty"` - // The TaskRouter default channel capacities and availability for workers. + // The TaskRouter default channel capacities and availability for workers. TaskrouterWorkerChannels *interface{} `json:"taskrouter_worker_channels,omitempty"` - // The TaskRouter Worker attributes. + // The TaskRouter Worker attributes. TaskrouterWorkerAttributes *interface{} `json:"taskrouter_worker_attributes,omitempty"` - // The TaskRouter SID of the offline activity. + // The TaskRouter SID of the offline activity. TaskrouterOfflineActivitySid *string `json:"taskrouter_offline_activity_sid,omitempty"` - // The URL where the Flex instance is hosted. + // The URL where the Flex instance is hosted. RuntimeDomain *string `json:"runtime_domain,omitempty"` - // The SID of the Messaging service instance. + // The SID of the Messaging service instance. MessagingServiceInstanceSid *string `json:"messaging_service_instance_sid,omitempty"` - // The SID of the chat service this user belongs to. + // The SID of the chat service this user belongs to. ChatServiceInstanceSid *string `json:"chat_service_instance_sid,omitempty"` - // The SID of the Flex service instance. + // The SID of the Flex service instance. FlexServiceInstanceSid *string `json:"flex_service_instance_sid,omitempty"` - // The primary language of the Flex UI. + // The primary language of the Flex UI. UiLanguage *string `json:"ui_language,omitempty"` - // The object that describes Flex UI characteristics and settings. + // The object that describes Flex UI characteristics and settings. UiAttributes *interface{} `json:"ui_attributes,omitempty"` - // The object that defines the NPM packages and versions to be used in Hosted Flex. + // The object that defines the NPM packages and versions to be used in Hosted Flex. UiDependencies *interface{} `json:"ui_dependencies,omitempty"` - // The Pinned UI version. + // The Pinned UI version. UiVersion *string `json:"ui_version,omitempty"` - // The Flex Service version. + // The Flex Service version. ServiceVersion *string `json:"service_version,omitempty"` - // Whether call recording is enabled. + // Whether call recording is enabled. CallRecordingEnabled *bool `json:"call_recording_enabled,omitempty"` - // The call recording webhook URL. + // The call recording webhook URL. CallRecordingWebhookUrl *string `json:"call_recording_webhook_url,omitempty"` - // Whether CRM is present for Flex. + // Whether CRM is present for Flex. CrmEnabled *bool `json:"crm_enabled,omitempty"` - // The CRM type. + // The CRM type. CrmType *string `json:"crm_type,omitempty"` - // The CRM Callback URL. + // The CRM Callback URL. CrmCallbackUrl *string `json:"crm_callback_url,omitempty"` - // The CRM Fallback URL. + // The CRM Fallback URL. CrmFallbackUrl *string `json:"crm_fallback_url,omitempty"` - // An object that contains the CRM attributes. + // An object that contains the CRM attributes. CrmAttributes *interface{} `json:"crm_attributes,omitempty"` - // The list of public attributes, which are visible to unauthenticated clients. + // The list of public attributes, which are visible to unauthenticated clients. PublicAttributes *interface{} `json:"public_attributes,omitempty"` - // Whether the plugin service enabled. + // Whether the plugin service enabled. PluginServiceEnabled *bool `json:"plugin_service_enabled,omitempty"` - // The plugin service attributes. + // The plugin service attributes. PluginServiceAttributes *interface{} `json:"plugin_service_attributes,omitempty"` - // A list of objects that contain the configurations for the Integrations supported in this configuration. + // A list of objects that contain the configurations for the Integrations supported in this configuration. Integrations *[]interface{} `json:"integrations,omitempty"` - // The list of outbound call flows. + // The list of outbound call flows. OutboundCallFlows *interface{} `json:"outbound_call_flows,omitempty"` - // The list of serverless service SIDs. + // The list of serverless service SIDs. ServerlessServiceSids *[]string `json:"serverless_service_sids,omitempty"` - // Configurable parameters for Queues Statistics. + // Configurable parameters for Queues Statistics. QueueStatsConfiguration *interface{} `json:"queue_stats_configuration,omitempty"` - // Configurable parameters for Notifications. + // Configurable parameters for Notifications. Notifications *interface{} `json:"notifications,omitempty"` - // Configurable parameters for Markdown. + // Configurable parameters for Markdown. Markdown *interface{} `json:"markdown,omitempty"` - // The absolute URL of the Configuration resource. + // The absolute URL of the Configuration resource. Url *string `json:"url,omitempty"` - // Object with enabled/disabled flag with list of workspaces. + // Object with enabled/disabled flag with list of workspaces. FlexInsightsHr *interface{} `json:"flex_insights_hr,omitempty"` - // Setting this to true will redirect Flex UI to the URL set in flex_url + // Setting this to true will redirect Flex UI to the URL set in flex_url FlexInsightsDrilldown *bool `json:"flex_insights_drilldown,omitempty"` - // URL to redirect to in case drilldown is enabled. + // URL to redirect to in case drilldown is enabled. FlexUrl *string `json:"flex_url,omitempty"` - // Settings for different limits for Flex Conversations channels attachments. + // Settings for different limits for Flex Conversations channels attachments. ChannelConfigs *[]interface{} `json:"channel_configs,omitempty"` - // Configurable parameters for Debugger Integration. + // Configurable parameters for Debugger Integration. DebuggerIntegration *interface{} `json:"debugger_integration,omitempty"` - // Configurable parameters for Flex UI Status report. + // Configurable parameters for Flex UI Status report. FlexUiStatusReport *interface{} `json:"flex_ui_status_report,omitempty"` - // Agent conversation end methods. + // Agent conversation end methods. AgentConvEndMethods *interface{} `json:"agent_conv_end_methods,omitempty"` - // Citrix voice vdi configuration and settings. + // Citrix voice vdi configuration and settings. CitrixVoiceVdi *interface{} `json:"citrix_voice_vdi,omitempty"` - // Presence and presence ttl configuration - OfflineConfig *interface{} `json:"offline_config,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_flex_flow.go b/rest/flex/v1/model_flex_v1_flex_flow.go index d6cff9eee..2c3933d3b 100644 --- a/rest/flex/v1/model_flex_v1_flex_flow.go +++ b/rest/flex/v1/model_flex_v1_flex_flow.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // FlexV1FlexFlow struct for FlexV1FlexFlow type FlexV1FlexFlow struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Flow resource and owns this Workflow. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Flow resource and owns this Workflow. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that we created to identify the Flex Flow resource. + // The unique string that we created to identify the Flex Flow resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the chat service. + // The SID of the chat service. ChatServiceSid *string `json:"chat_service_sid,omitempty"` - ChannelType *string `json:"channel_type,omitempty"` - // The channel contact's Identity. + ChannelType *string `json:"channel_type,omitempty"` + // The channel contact's Identity. ContactIdentity *string `json:"contact_identity,omitempty"` - // Whether the Flex Flow is enabled. - Enabled *bool `json:"enabled,omitempty"` + // Whether the Flex Flow is enabled. + Enabled *bool `json:"enabled,omitempty"` IntegrationType *string `json:"integration_type,omitempty"` - // An object that contains specific parameters for the integration. + // An object that contains specific parameters for the integration. Integration *interface{} `json:"integration,omitempty"` - // 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`. + // 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`. LongLived *bool `json:"long_lived,omitempty"` - // 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`. + // 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`. JanitorEnabled *bool `json:"janitor_enabled,omitempty"` - // The absolute URL of the Flex Flow resource. + // The absolute URL of the Flex Flow resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_assessments.go b/rest/flex/v1/model_flex_v1_insights_assessments.go index d989b00b3..1696e63dd 100644 --- a/rest/flex/v1/model_flex_v1_insights_assessments.go +++ b/rest/flex/v1/model_flex_v1_insights_assessments.go @@ -13,59 +13,56 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // FlexV1InsightsAssessments struct for FlexV1InsightsAssessments type FlexV1InsightsAssessments struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the assessment + // The SID of the assessment AssessmentSid *string `json:"assessment_sid,omitempty"` - // Offset of the conversation + // Offset of the conversation Offset *float32 `json:"offset,omitempty"` - // The flag indicating if this assessment is part of report + // The flag indicating if this assessment is part of report Report *bool `json:"report,omitempty"` - // The weightage given to this comment + // The weightage given to this comment Weight *float32 `json:"weight,omitempty"` - // The id of the Agent + // The id of the Agent AgentId *string `json:"agent_id,omitempty"` - // Segment Id of conversation + // Segment Id of conversation SegmentId *string `json:"segment_id,omitempty"` - // The name of the user. + // The name of the user. UserName *string `json:"user_name,omitempty"` - // The email id of the user. + // The email id of the user. UserEmail *string `json:"user_email,omitempty"` - // The answer text selected by user + // The answer text selected by user AnswerText *string `json:"answer_text,omitempty"` - // The id of the answer selected by user + // The id of the answer selected by user AnswerId *string `json:"answer_id,omitempty"` - // Assessment Details associated with an assessment + // Assessment Details associated with an assessment Assessment *interface{} `json:"assessment,omitempty"` - Timestamp *float32 `json:"timestamp,omitempty"` - Url *string `json:"url,omitempty"` + Timestamp *float32 `json:"timestamp,omitempty"` + Url *string `json:"url,omitempty"` } func (response *FlexV1InsightsAssessments) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - AssessmentSid *string `json:"assessment_sid"` - Offset *interface{} `json:"offset"` - Report *bool `json:"report"` - Weight *interface{} `json:"weight"` - AgentId *string `json:"agent_id"` - SegmentId *string `json:"segment_id"` - UserName *string `json:"user_name"` - UserEmail *string `json:"user_email"` - AnswerText *string `json:"answer_text"` - AnswerId *string `json:"answer_id"` - Assessment *interface{} `json:"assessment"` - Timestamp *interface{} `json:"timestamp"` - Url *string `json:"url"` + AccountSid *string `json:"account_sid"` + AssessmentSid *string `json:"assessment_sid"` + Offset *interface{} `json:"offset"` + Report *bool `json:"report"` + Weight *interface{} `json:"weight"` + AgentId *string `json:"agent_id"` + SegmentId *string `json:"segment_id"` + UserName *string `json:"user_name"` + UserEmail *string `json:"user_email"` + AnswerText *string `json:"answer_text"` + AnswerId *string `json:"answer_id"` + Assessment *interface{} `json:"assessment"` + Timestamp *interface{} `json:"timestamp"` + Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -73,17 +70,17 @@ func (response *FlexV1InsightsAssessments) UnmarshalJSON(bytes []byte) (err erro } *response = FlexV1InsightsAssessments{ - AccountSid: raw.AccountSid, + AccountSid: raw.AccountSid, AssessmentSid: raw.AssessmentSid, - Report: raw.Report, - AgentId: raw.AgentId, - SegmentId: raw.SegmentId, - UserName: raw.UserName, - UserEmail: raw.UserEmail, - AnswerText: raw.AnswerText, - AnswerId: raw.AnswerId, - Assessment: raw.Assessment, - Url: raw.Url, + Report: raw.Report, + AgentId: raw.AgentId, + SegmentId: raw.SegmentId, + UserName: raw.UserName, + UserEmail: raw.UserEmail, + AnswerText: raw.AnswerText, + AnswerId: raw.AnswerId, + Assessment: raw.Assessment, + Url: raw.Url, } responseOffset, err := client.UnmarshalFloat32(raw.Offset) @@ -106,3 +103,4 @@ func (response *FlexV1InsightsAssessments) UnmarshalJSON(bytes []byte) (err erro return } + diff --git a/rest/flex/v1/model_flex_v1_insights_assessments_comment.go b/rest/flex/v1/model_flex_v1_insights_assessments_comment.go index c39488056..aede6820c 100644 --- a/rest/flex/v1/model_flex_v1_insights_assessments_comment.go +++ b/rest/flex/v1/model_flex_v1_insights_assessments_comment.go @@ -13,54 +13,51 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // FlexV1InsightsAssessmentsComment struct for FlexV1InsightsAssessmentsComment type FlexV1InsightsAssessmentsComment struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the assessment. + // The SID of the assessment. AssessmentSid *string `json:"assessment_sid,omitempty"` - // The comment added for assessment. + // The comment added for assessment. Comment *interface{} `json:"comment,omitempty"` - // The offset + // The offset Offset *float32 `json:"offset,omitempty"` - // The flag indicating if this assessment is part of report + // The flag indicating if this assessment is part of report Report *bool `json:"report,omitempty"` - // The weightage given to this comment + // The weightage given to this comment Weight *float32 `json:"weight,omitempty"` - // The id of the agent. + // The id of the agent. AgentId *string `json:"agent_id,omitempty"` - // The id of the segment. + // The id of the segment. SegmentId *string `json:"segment_id,omitempty"` - // The name of the user. + // The name of the user. UserName *string `json:"user_name,omitempty"` - // The email id of the user. + // The email id of the user. UserEmail *string `json:"user_email,omitempty"` - // The timestamp when the record is inserted + // The timestamp when the record is inserted Timestamp *float32 `json:"timestamp,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } func (response *FlexV1InsightsAssessmentsComment) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - AssessmentSid *string `json:"assessment_sid"` - Comment *interface{} `json:"comment"` - Offset *interface{} `json:"offset"` - Report *bool `json:"report"` - Weight *interface{} `json:"weight"` - AgentId *string `json:"agent_id"` - SegmentId *string `json:"segment_id"` - UserName *string `json:"user_name"` - UserEmail *string `json:"user_email"` - Timestamp *interface{} `json:"timestamp"` - Url *string `json:"url"` + AccountSid *string `json:"account_sid"` + AssessmentSid *string `json:"assessment_sid"` + Comment *interface{} `json:"comment"` + Offset *interface{} `json:"offset"` + Report *bool `json:"report"` + Weight *interface{} `json:"weight"` + AgentId *string `json:"agent_id"` + SegmentId *string `json:"segment_id"` + UserName *string `json:"user_name"` + UserEmail *string `json:"user_email"` + Timestamp *interface{} `json:"timestamp"` + Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -68,15 +65,15 @@ func (response *FlexV1InsightsAssessmentsComment) UnmarshalJSON(bytes []byte) (e } *response = FlexV1InsightsAssessmentsComment{ - AccountSid: raw.AccountSid, + AccountSid: raw.AccountSid, AssessmentSid: raw.AssessmentSid, - Comment: raw.Comment, - Report: raw.Report, - AgentId: raw.AgentId, - SegmentId: raw.SegmentId, - UserName: raw.UserName, - UserEmail: raw.UserEmail, - Url: raw.Url, + Comment: raw.Comment, + Report: raw.Report, + AgentId: raw.AgentId, + SegmentId: raw.SegmentId, + UserName: raw.UserName, + UserEmail: raw.UserEmail, + Url: raw.Url, } responseOffset, err := client.UnmarshalFloat32(raw.Offset) @@ -99,3 +96,4 @@ func (response *FlexV1InsightsAssessmentsComment) UnmarshalJSON(bytes []byte) (e return } + diff --git a/rest/flex/v1/model_flex_v1_insights_conversations.go b/rest/flex/v1/model_flex_v1_insights_conversations.go index 3ae9179ba..107f3822a 100644 --- a/rest/flex/v1/model_flex_v1_insights_conversations.go +++ b/rest/flex/v1/model_flex_v1_insights_conversations.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsConversations struct for FlexV1InsightsConversations type FlexV1InsightsConversations struct { - // The id of the account. + // The id of the account. AccountId *string `json:"account_id,omitempty"` - // The unique id of the conversation + // The unique id of the conversation ConversationId *string `json:"conversation_id,omitempty"` - // The count of segments for a conversation + // The count of segments for a conversation SegmentCount *int `json:"segment_count,omitempty"` - // The Segments of a conversation + // The Segments of a conversation Segments *[]interface{} `json:"segments,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_questionnaires.go b/rest/flex/v1/model_flex_v1_insights_questionnaires.go index 28f585164..39218ecec 100644 --- a/rest/flex/v1/model_flex_v1_insights_questionnaires.go +++ b/rest/flex/v1/model_flex_v1_insights_questionnaires.go @@ -13,20 +13,25 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsQuestionnaires struct for FlexV1InsightsQuestionnaires type FlexV1InsightsQuestionnaires struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // The sid of this questionnaire + // The sid of this questionnaire QuestionnaireSid *string `json:"questionnaire_sid,omitempty"` - // The name of this category. + // The name of this category. Name *string `json:"name,omitempty"` - // The description of this questionnaire + // The description of this questionnaire Description *string `json:"description,omitempty"` - // The flag to enable or disable questionnaire + // The flag to enable or disable questionnaire Active *bool `json:"active,omitempty"` - // The list of questions with category for a questionnaire + // The list of questions with category for a questionnaire Questions *[]interface{} `json:"questions,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_questionnaires_category.go b/rest/flex/v1/model_flex_v1_insights_questionnaires_category.go index 501b04ea1..9498098b0 100644 --- a/rest/flex/v1/model_flex_v1_insights_questionnaires_category.go +++ b/rest/flex/v1/model_flex_v1_insights_questionnaires_category.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsQuestionnairesCategory struct for FlexV1InsightsQuestionnairesCategory type FlexV1InsightsQuestionnairesCategory struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the category + // The SID of the category CategorySid *string `json:"category_sid,omitempty"` - // The name of this category. + // The name of this category. Name *string `json:"name,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_questionnaires_question.go b/rest/flex/v1/model_flex_v1_insights_questionnaires_question.go index 4cb718354..bf248cbaf 100644 --- a/rest/flex/v1/model_flex_v1_insights_questionnaires_question.go +++ b/rest/flex/v1/model_flex_v1_insights_questionnaires_question.go @@ -13,26 +13,31 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsQuestionnairesQuestion struct for FlexV1InsightsQuestionnairesQuestion type FlexV1InsightsQuestionnairesQuestion struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the question + // The SID of the question QuestionSid *string `json:"question_sid,omitempty"` - // The question. + // The question. Question *string `json:"question,omitempty"` - // The description for the question. + // The description for the question. Description *string `json:"description,omitempty"` - // The Category for the question. + // The Category for the question. Category *interface{} `json:"category,omitempty"` - // The answer_set for the question. + // The answer_set for the question. AnswerSetId *string `json:"answer_set_id,omitempty"` - // The flag to enable for disable NA for answer. + // The flag to enable for disable NA for answer. AllowNa *bool `json:"allow_na,omitempty"` - // Integer value that tells a particular question is used by how many questionnaires + // Integer value that tells a particular question is used by how many questionnaires Usage *int `json:"usage,omitempty"` - // Set of answers for the question + // Set of answers for the question AnswerSet *interface{} `json:"answer_set,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_segments.go b/rest/flex/v1/model_flex_v1_insights_segments.go index e5e213a1c..6da071e22 100644 --- a/rest/flex/v1/model_flex_v1_insights_segments.go +++ b/rest/flex/v1/model_flex_v1_insights_segments.go @@ -13,48 +13,53 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsSegments struct for FlexV1InsightsSegments type FlexV1InsightsSegments struct { - // To unique id of the segment + // To unique id of the segment SegmentId *string `json:"segment_id,omitempty"` - // The unique id for the conversation. - ExternalId *string `json:"external_id,omitempty"` - Queue *string `json:"queue,omitempty"` + // The unique id for the conversation. + ExternalId *string `json:"external_id,omitempty"` + Queue *string `json:"queue,omitempty"` ExternalContact *string `json:"external_contact,omitempty"` - // The uuid for the external_segment_link. + // The uuid for the external_segment_link. ExternalSegmentLinkId *string `json:"external_segment_link_id,omitempty"` - // The date of the conversation. + // The date of the conversation. Date *string `json:"date,omitempty"` - // The unique id for the account. + // The unique id for the account. AccountId *string `json:"account_id,omitempty"` - // The hyperlink to recording of the task event. + // The hyperlink to recording of the task event. ExternalSegmentLink *string `json:"external_segment_link,omitempty"` - // The unique id for the agent. + // The unique id for the agent. AgentId *string `json:"agent_id,omitempty"` - // The phone number of the agent. + // The phone number of the agent. AgentPhone *string `json:"agent_phone,omitempty"` - // The name of the agent. + // The name of the agent. AgentName *string `json:"agent_name,omitempty"` - // The team name to which agent belongs. + // The team name to which agent belongs. AgentTeamName *string `json:"agent_team_name,omitempty"` - // he team name to which agent belongs. + // he team name to which agent belongs. AgentTeamNameInHierarchy *string `json:"agent_team_name_in_hierarchy,omitempty"` - // The link to the agent conversation. + // The link to the agent conversation. AgentLink *string `json:"agent_link,omitempty"` - // The phone number of the customer. + // The phone number of the customer. CustomerPhone *string `json:"customer_phone,omitempty"` - // The name of the customer. + // The name of the customer. CustomerName *string `json:"customer_name,omitempty"` - // The link to the customer conversation. + // The link to the customer conversation. CustomerLink *string `json:"customer_link,omitempty"` - // The offset value for the recording. + // The offset value for the recording. SegmentRecordingOffset *string `json:"segment_recording_offset,omitempty"` - // The media identifiers of the conversation. + // The media identifiers of the conversation. Media *interface{} `json:"media,omitempty"` - // The type of the assessment. + // The type of the assessment. AssessmentType *interface{} `json:"assessment_type,omitempty"` - // The percentage scored on the Assessments. + // The percentage scored on the Assessments. AssessmentPercentage *interface{} `json:"assessment_percentage,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_session.go b/rest/flex/v1/model_flex_v1_insights_session.go index 812122177..e8756e557 100644 --- a/rest/flex/v1/model_flex_v1_insights_session.go +++ b/rest/flex/v1/model_flex_v1_insights_session.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsSession struct for FlexV1InsightsSession type FlexV1InsightsSession struct { - // Unique ID to identify the user's workspace + // Unique ID to identify the user's workspace WorkspaceId *string `json:"workspace_id,omitempty"` - // The session expiry date and time, given in ISO 8601 format. + // The session expiry date and time, given in ISO 8601 format. SessionExpiry *string `json:"session_expiry,omitempty"` - // The unique ID for the session + // The unique ID for the session SessionId *string `json:"session_id,omitempty"` - // The base URL to fetch reports and dashboards + // The base URL to fetch reports and dashboards BaseUrl *string `json:"base_url,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_settings_answersets.go b/rest/flex/v1/model_flex_v1_insights_settings_answersets.go index bd4dca803..f06403224 100644 --- a/rest/flex/v1/model_flex_v1_insights_settings_answersets.go +++ b/rest/flex/v1/model_flex_v1_insights_settings_answersets.go @@ -13,16 +13,21 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsSettingsAnswersets struct for FlexV1InsightsSettingsAnswersets type FlexV1InsightsSettingsAnswersets struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. AccountSid *string `json:"account_sid,omitempty"` - // The lis of answer sets + // The lis of answer sets AnswerSets *interface{} `json:"answer_sets,omitempty"` - // The list of answer set categories + // The list of answer set categories AnswerSetCategories *interface{} `json:"answer_set_categories,omitempty"` - // The details for not applicable answer set + // The details for not applicable answer set NotApplicable *interface{} `json:"not_applicable,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_settings_comment.go b/rest/flex/v1/model_flex_v1_insights_settings_comment.go index fc6567cc0..1f95d3d98 100644 --- a/rest/flex/v1/model_flex_v1_insights_settings_comment.go +++ b/rest/flex/v1/model_flex_v1_insights_settings_comment.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsSettingsComment struct for FlexV1InsightsSettingsComment type FlexV1InsightsSettingsComment struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - AccountSid *string `json:"account_sid,omitempty"` - Comments *interface{} `json:"comments,omitempty"` - Url *string `json:"url,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + AccountSid *string `json:"account_sid,omitempty"` + Comments *interface{} `json:"comments,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_insights_user_roles.go b/rest/flex/v1/model_flex_v1_insights_user_roles.go index 384230511..4393544a1 100644 --- a/rest/flex/v1/model_flex_v1_insights_user_roles.go +++ b/rest/flex/v1/model_flex_v1_insights_user_roles.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InsightsUserRoles struct for FlexV1InsightsUserRoles type FlexV1InsightsUserRoles struct { - // Flex Insights roles for the user + // Flex Insights roles for the user Roles *[]string `json:"roles,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_interaction.go b/rest/flex/v1/model_flex_v1_interaction.go index 252a92d76..e9a56602b 100644 --- a/rest/flex/v1/model_flex_v1_interaction.go +++ b/rest/flex/v1/model_flex_v1_interaction.go @@ -13,16 +13,21 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1Interaction struct for FlexV1Interaction type FlexV1Interaction struct { - // The unique string created by Twilio to identify an Interaction resource, prefixed with KD. + // The unique string created by Twilio to identify an Interaction resource, prefixed with KD. Sid *string `json:"sid,omitempty"` - // A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples. + // A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples. Channel *interface{} `json:"channel,omitempty"` - // A JSON Object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). - Routing *interface{} `json:"routing,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` - InteractionContextSid *string `json:"interaction_context_sid,omitempty"` + // A JSON Object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). + Routing *interface{} `json:"routing,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` + InteractionContextSid *string `json:"interaction_context_sid,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_interaction_channel.go b/rest/flex/v1/model_flex_v1_interaction_channel.go index 860adfdd3..25fa80d1a 100644 --- a/rest/flex/v1/model_flex_v1_interaction_channel.go +++ b/rest/flex/v1/model_flex_v1_interaction_channel.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InteractionChannel struct for FlexV1InteractionChannel type FlexV1InteractionChannel struct { - // The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO. + // The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO. Sid *string `json:"sid,omitempty"` - // The unique string created by Twilio to identify an Interaction resource, prefixed with KD. + // The unique string created by Twilio to identify an Interaction resource, prefixed with KD. InteractionSid *string `json:"interaction_sid,omitempty"` - Type *string `json:"type,omitempty"` - Status *string `json:"status,omitempty"` - // The Twilio error code for a failed channel. + Type *string `json:"type,omitempty"` + Status *string `json:"status,omitempty"` + // The Twilio error code for a failed channel. ErrorCode *int `json:"error_code,omitempty"` - // The error message for a failed channel. - ErrorMessage *string `json:"error_message,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + // The error message for a failed channel. + ErrorMessage *string `json:"error_message,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_interaction_channel_invite.go b/rest/flex/v1/model_flex_v1_interaction_channel_invite.go index aea75f649..26564ba84 100644 --- a/rest/flex/v1/model_flex_v1_interaction_channel_invite.go +++ b/rest/flex/v1/model_flex_v1_interaction_channel_invite.go @@ -13,16 +13,21 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InteractionChannelInvite struct for FlexV1InteractionChannelInvite type FlexV1InteractionChannelInvite struct { - // The unique string created by Twilio to identify an Interaction Channel Invite resource. + // The unique string created by Twilio to identify an Interaction Channel Invite resource. Sid *string `json:"sid,omitempty"` - // The Interaction SID for this Channel. + // The Interaction SID for this Channel. InteractionSid *string `json:"interaction_sid,omitempty"` - // The Channel SID for this Invite. + // The Channel SID for this Invite. ChannelSid *string `json:"channel_sid,omitempty"` - // A JSON object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). + // A JSON object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). Routing *interface{} `json:"routing,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_interaction_channel_participant.go b/rest/flex/v1/model_flex_v1_interaction_channel_participant.go index ad76187d4..2dd7b687a 100644 --- a/rest/flex/v1/model_flex_v1_interaction_channel_participant.go +++ b/rest/flex/v1/model_flex_v1_interaction_channel_participant.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV1InteractionChannelParticipant struct for FlexV1InteractionChannelParticipant type FlexV1InteractionChannelParticipant struct { - // The unique string created by Twilio to identify an Interaction Channel Participant resource. - Sid *string `json:"sid,omitempty"` + // The unique string created by Twilio to identify an Interaction Channel Participant resource. + Sid *string `json:"sid,omitempty"` Type *string `json:"type,omitempty"` - // The Interaction Sid for this channel. + // The Interaction Sid for this channel. InteractionSid *string `json:"interaction_sid,omitempty"` - // The Channel Sid for this Participant. + // The Channel Sid for this Participant. ChannelSid *string `json:"channel_sid,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_flex_v1_web_channel.go b/rest/flex/v1/model_flex_v1_web_channel.go index bcab072e9..7d464181d 100644 --- a/rest/flex/v1/model_flex_v1_web_channel.go +++ b/rest/flex/v1/model_flex_v1_web_channel.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // FlexV1WebChannel struct for FlexV1WebChannel type FlexV1WebChannel struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WebChannel resource and owns this Workflow. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WebChannel resource and owns this Workflow. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flex Flow. + // The SID of the Flex Flow. FlexFlowSid *string `json:"flex_flow_sid,omitempty"` - // The unique string that we created to identify the WebChannel resource. + // The unique string that we created to identify the WebChannel resource. Sid *string `json:"sid,omitempty"` - // The absolute URL of the WebChannel resource. + // The absolute URL of the WebChannel resource. Url *string `json:"url,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/flex/v1/model_list_channel_response.go b/rest/flex/v1/model_list_channel_response.go index eacaba6c1..a013cb578 100644 --- a/rest/flex/v1/model_list_channel_response.go +++ b/rest/flex/v1/model_list_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponse struct for ListChannelResponse type ListChannelResponse struct { - FlexChatChannels []FlexV1Channel `json:"flex_chat_channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + FlexChatChannels []FlexV1Channel `json:"flex_chat_channels,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_channel_response_meta.go b/rest/flex/v1/model_list_channel_response_meta.go index 1be9de7f3..b8ae5fd73 100644 --- a/rest/flex/v1/model_list_channel_response_meta.go +++ b/rest/flex/v1/model_list_channel_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponseMeta struct for ListChannelResponseMeta type ListChannelResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/flex/v1/model_list_flex_flow_response.go b/rest/flex/v1/model_list_flex_flow_response.go index d2a5afb21..ec15bb603 100644 --- a/rest/flex/v1/model_list_flex_flow_response.go +++ b/rest/flex/v1/model_list_flex_flow_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFlexFlowResponse struct for ListFlexFlowResponse type ListFlexFlowResponse struct { - FlexFlows []FlexV1FlexFlow `json:"flex_flows,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + FlexFlows []FlexV1FlexFlow `json:"flex_flows,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_assessments_comment_response.go b/rest/flex/v1/model_list_insights_assessments_comment_response.go index 4160876f0..12360f109 100644 --- a/rest/flex/v1/model_list_insights_assessments_comment_response.go +++ b/rest/flex/v1/model_list_insights_assessments_comment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsAssessmentsCommentResponse struct for ListInsightsAssessmentsCommentResponse type ListInsightsAssessmentsCommentResponse struct { Comments []FlexV1InsightsAssessmentsComment `json:"comments,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_assessments_response.go b/rest/flex/v1/model_list_insights_assessments_response.go index f3ad45d10..7b5f37089 100644 --- a/rest/flex/v1/model_list_insights_assessments_response.go +++ b/rest/flex/v1/model_list_insights_assessments_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsAssessmentsResponse struct for ListInsightsAssessmentsResponse type ListInsightsAssessmentsResponse struct { Assessments []FlexV1InsightsAssessments `json:"assessments,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_conversations_response.go b/rest/flex/v1/model_list_insights_conversations_response.go index 61798620e..31491323c 100644 --- a/rest/flex/v1/model_list_insights_conversations_response.go +++ b/rest/flex/v1/model_list_insights_conversations_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsConversationsResponse struct for ListInsightsConversationsResponse type ListInsightsConversationsResponse struct { Conversations []FlexV1InsightsConversations `json:"conversations,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_questionnaires_category_response.go b/rest/flex/v1/model_list_insights_questionnaires_category_response.go index e0aabb3cb..88325c7b6 100644 --- a/rest/flex/v1/model_list_insights_questionnaires_category_response.go +++ b/rest/flex/v1/model_list_insights_questionnaires_category_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsQuestionnairesCategoryResponse struct for ListInsightsQuestionnairesCategoryResponse type ListInsightsQuestionnairesCategoryResponse struct { Categories []FlexV1InsightsQuestionnairesCategory `json:"categories,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_questionnaires_question_response.go b/rest/flex/v1/model_list_insights_questionnaires_question_response.go index 51186c76c..abd368bc8 100644 --- a/rest/flex/v1/model_list_insights_questionnaires_question_response.go +++ b/rest/flex/v1/model_list_insights_questionnaires_question_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsQuestionnairesQuestionResponse struct for ListInsightsQuestionnairesQuestionResponse type ListInsightsQuestionnairesQuestionResponse struct { Questions []FlexV1InsightsQuestionnairesQuestion `json:"questions,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_questionnaires_response.go b/rest/flex/v1/model_list_insights_questionnaires_response.go index f73a0f767..9fee47550 100644 --- a/rest/flex/v1/model_list_insights_questionnaires_response.go +++ b/rest/flex/v1/model_list_insights_questionnaires_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsQuestionnairesResponse struct for ListInsightsQuestionnairesResponse type ListInsightsQuestionnairesResponse struct { Questionnaires []FlexV1InsightsQuestionnaires `json:"questionnaires,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_insights_segments_response.go b/rest/flex/v1/model_list_insights_segments_response.go index 9589b6e9c..2bf0b6ae5 100644 --- a/rest/flex/v1/model_list_insights_segments_response.go +++ b/rest/flex/v1/model_list_insights_segments_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInsightsSegmentsResponse struct for ListInsightsSegmentsResponse type ListInsightsSegmentsResponse struct { Segments []FlexV1InsightsSegments `json:"segments,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_interaction_channel_invite_response.go b/rest/flex/v1/model_list_interaction_channel_invite_response.go index 5555715a0..e4d016e80 100644 --- a/rest/flex/v1/model_list_interaction_channel_invite_response.go +++ b/rest/flex/v1/model_list_interaction_channel_invite_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInteractionChannelInviteResponse struct for ListInteractionChannelInviteResponse type ListInteractionChannelInviteResponse struct { Invites []FlexV1InteractionChannelInvite `json:"invites,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_interaction_channel_participant_response.go b/rest/flex/v1/model_list_interaction_channel_participant_response.go index eac6fb6b7..f2bd7864d 100644 --- a/rest/flex/v1/model_list_interaction_channel_participant_response.go +++ b/rest/flex/v1/model_list_interaction_channel_participant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInteractionChannelParticipantResponse struct for ListInteractionChannelParticipantResponse type ListInteractionChannelParticipantResponse struct { Participants []FlexV1InteractionChannelParticipant `json:"participants,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_interaction_channel_response.go b/rest/flex/v1/model_list_interaction_channel_response.go index 9bc7260f1..fe90f355d 100644 --- a/rest/flex/v1/model_list_interaction_channel_response.go +++ b/rest/flex/v1/model_list_interaction_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInteractionChannelResponse struct for ListInteractionChannelResponse type ListInteractionChannelResponse struct { Channels []FlexV1InteractionChannel `json:"channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/model_list_web_channel_response.go b/rest/flex/v1/model_list_web_channel_response.go index c16f52721..0b3ca9613 100644 --- a/rest/flex/v1/model_list_web_channel_response.go +++ b/rest/flex/v1/model_list_web_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWebChannelResponse struct for ListWebChannelResponse type ListWebChannelResponse struct { - FlexChatChannels []FlexV1WebChannel `json:"flex_chat_channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + FlexChatChannels []FlexV1WebChannel `json:"flex_chat_channels,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/flex/v1/web_channels.go b/rest/flex/v1/web_channels.go index 589a70e06..446da7fe6 100644 --- a/rest/flex/v1/web_channels.go +++ b/rest/flex/v1/web_channels.go @@ -18,182 +18,188 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWebChannel' type CreateWebChannelParams struct { - // The SID of the Flex Flow. - FlexFlowSid *string `json:"FlexFlowSid,omitempty"` - // The chat identity. - Identity *string `json:"Identity,omitempty"` - // The chat participant's friendly name. - CustomerFriendlyName *string `json:"CustomerFriendlyName,omitempty"` - // The chat channel's friendly name. - ChatFriendlyName *string `json:"ChatFriendlyName,omitempty"` - // The chat channel's unique name. - ChatUniqueName *string `json:"ChatUniqueName,omitempty"` - // The pre-engagement data. - PreEngagementData *string `json:"PreEngagementData,omitempty"` + // The SID of the Flex Flow. + FlexFlowSid *string `json:"FlexFlowSid,omitempty"` + // The chat identity. + Identity *string `json:"Identity,omitempty"` + // The chat participant's friendly name. + CustomerFriendlyName *string `json:"CustomerFriendlyName,omitempty"` + // The chat channel's friendly name. + ChatFriendlyName *string `json:"ChatFriendlyName,omitempty"` + // The chat channel's unique name. + ChatUniqueName *string `json:"ChatUniqueName,omitempty"` + // The pre-engagement data. + PreEngagementData *string `json:"PreEngagementData,omitempty"` } -func (params *CreateWebChannelParams) SetFlexFlowSid(FlexFlowSid string) *CreateWebChannelParams { - params.FlexFlowSid = &FlexFlowSid - return params +func (params *CreateWebChannelParams) SetFlexFlowSid(FlexFlowSid string) (*CreateWebChannelParams){ + params.FlexFlowSid = &FlexFlowSid + return params } -func (params *CreateWebChannelParams) SetIdentity(Identity string) *CreateWebChannelParams { - params.Identity = &Identity - return params +func (params *CreateWebChannelParams) SetIdentity(Identity string) (*CreateWebChannelParams){ + params.Identity = &Identity + return params } -func (params *CreateWebChannelParams) SetCustomerFriendlyName(CustomerFriendlyName string) *CreateWebChannelParams { - params.CustomerFriendlyName = &CustomerFriendlyName - return params +func (params *CreateWebChannelParams) SetCustomerFriendlyName(CustomerFriendlyName string) (*CreateWebChannelParams){ + params.CustomerFriendlyName = &CustomerFriendlyName + return params } -func (params *CreateWebChannelParams) SetChatFriendlyName(ChatFriendlyName string) *CreateWebChannelParams { - params.ChatFriendlyName = &ChatFriendlyName - return params +func (params *CreateWebChannelParams) SetChatFriendlyName(ChatFriendlyName string) (*CreateWebChannelParams){ + params.ChatFriendlyName = &ChatFriendlyName + return params } -func (params *CreateWebChannelParams) SetChatUniqueName(ChatUniqueName string) *CreateWebChannelParams { - params.ChatUniqueName = &ChatUniqueName - return params +func (params *CreateWebChannelParams) SetChatUniqueName(ChatUniqueName string) (*CreateWebChannelParams){ + params.ChatUniqueName = &ChatUniqueName + return params } -func (params *CreateWebChannelParams) SetPreEngagementData(PreEngagementData string) *CreateWebChannelParams { - params.PreEngagementData = &PreEngagementData - return params +func (params *CreateWebChannelParams) SetPreEngagementData(PreEngagementData string) (*CreateWebChannelParams){ + params.PreEngagementData = &PreEngagementData + return params } -// +// func (c *ApiService) CreateWebChannel(params *CreateWebChannelParams) (*FlexV1WebChannel, error) { - path := "/v1/WebChannels" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FlexFlowSid != nil { - data.Set("FlexFlowSid", *params.FlexFlowSid) - } - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.CustomerFriendlyName != nil { - data.Set("CustomerFriendlyName", *params.CustomerFriendlyName) - } - if params != nil && params.ChatFriendlyName != nil { - data.Set("ChatFriendlyName", *params.ChatFriendlyName) - } - if params != nil && params.ChatUniqueName != nil { - data.Set("ChatUniqueName", *params.ChatUniqueName) - } - if params != nil && params.PreEngagementData != nil { - data.Set("PreEngagementData", *params.PreEngagementData) - } + path := "/v1/WebChannels" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FlexFlowSid != nil { + data.Set("FlexFlowSid", *params.FlexFlowSid) + } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.CustomerFriendlyName != nil { + data.Set("CustomerFriendlyName", *params.CustomerFriendlyName) + } + if params != nil && params.ChatFriendlyName != nil { + data.Set("ChatFriendlyName", *params.ChatFriendlyName) + } + if params != nil && params.ChatUniqueName != nil { + data.Set("ChatUniqueName", *params.ChatUniqueName) + } + if params != nil && params.PreEngagementData != nil { + data.Set("PreEngagementData", *params.PreEngagementData) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FlexV1WebChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteWebChannel(Sid string, ) (error) { + path := "/v1/WebChannels/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &FlexV1WebChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteWebChannel(Sid string) error { - path := "/v1/WebChannels/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchWebChannel(Sid string, ) (*FlexV1WebChannel, error) { + path := "/v1/WebChannels/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchWebChannel(Sid string) (*FlexV1WebChannel, error) { - path := "/v1/WebChannels/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV1WebChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV1WebChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListWebChannel' type ListWebChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWebChannelParams) SetPageSize(PageSize int) *ListWebChannelParams { - params.PageSize = &PageSize - return params +func (params *ListWebChannelParams) SetPageSize(PageSize int) (*ListWebChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListWebChannelParams) SetLimit(Limit int) *ListWebChannelParams { - params.Limit = &Limit - return params +func (params *ListWebChannelParams) SetLimit(Limit int) (*ListWebChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of WebChannel records from the API. Request is executed immediately. func (c *ApiService) PageWebChannel(params *ListWebChannelParams, pageToken, pageNumber string) (*ListWebChannelResponse, error) { - path := "/v1/WebChannels" + path := "/v1/WebChannels" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWebChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListWebChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists WebChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -234,6 +240,7 @@ func (c *ApiService) StreamWebChannel(params *ListWebChannelParams) (chan FlexV1 return recordChannel, errorChannel } + func (c *ApiService) streamWebChannel(response *ListWebChannelResponse, params *ListWebChannelParams, recordChannel chan FlexV1WebChannel, errorChannel chan error) { curRecord := 1 @@ -265,66 +272,68 @@ func (c *ApiService) streamWebChannel(response *ListWebChannelResponse, params * } func (c *ApiService) getNextListWebChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWebChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWebChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWebChannel' type UpdateWebChannelParams struct { - // - ChatStatus *string `json:"ChatStatus,omitempty"` - // The post-engagement data. - PostEngagementData *string `json:"PostEngagementData,omitempty"` + // + ChatStatus *string `json:"ChatStatus,omitempty"` + // The post-engagement data. + PostEngagementData *string `json:"PostEngagementData,omitempty"` } -func (params *UpdateWebChannelParams) SetChatStatus(ChatStatus string) *UpdateWebChannelParams { - params.ChatStatus = &ChatStatus - return params +func (params *UpdateWebChannelParams) SetChatStatus(ChatStatus string) (*UpdateWebChannelParams){ + params.ChatStatus = &ChatStatus + return params } -func (params *UpdateWebChannelParams) SetPostEngagementData(PostEngagementData string) *UpdateWebChannelParams { - params.PostEngagementData = &PostEngagementData - return params +func (params *UpdateWebChannelParams) SetPostEngagementData(PostEngagementData string) (*UpdateWebChannelParams){ + params.PostEngagementData = &PostEngagementData + return params } -// +// func (c *ApiService) UpdateWebChannel(Sid string, params *UpdateWebChannelParams) (*FlexV1WebChannel, error) { - path := "/v1/WebChannels/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/WebChannels/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ChatStatus != nil { - data.Set("ChatStatus", *params.ChatStatus) - } - if params != nil && params.PostEngagementData != nil { - data.Set("PostEngagementData", *params.PostEngagementData) - } + if params != nil && params.ChatStatus != nil { + data.Set("ChatStatus", *params.ChatStatus) + } + if params != nil && params.PostEngagementData != nil { + data.Set("PostEngagementData", *params.PostEngagementData) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &FlexV1WebChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &FlexV1WebChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/flex/v2/README.md b/rest/flex/v2/README.md index e64eff167..0499c7fe7 100644 --- a/rest/flex/v2/README.md +++ b/rest/flex/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/flex/v2/api_service.go b/rest/flex/v2/api_service.go index f6d8c27bc..8e6c04cd7 100644 --- a/rest/flex/v2/api_service.go +++ b/rest/flex/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://flex-api.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/flex/v2/model_flex_v2_web_channel.go b/rest/flex/v2/model_flex_v2_web_channel.go index 40783e6c5..cba47e1d0 100644 --- a/rest/flex/v2/model_flex_v2_web_channel.go +++ b/rest/flex/v2/model_flex_v2_web_channel.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FlexV2WebChannel struct for FlexV2WebChannel type FlexV2WebChannel struct { - // The unique string representing the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) created. + // The unique string representing the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) created. ConversationSid *string `json:"conversation_sid,omitempty"` - // The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see [User Identity & Access Tokens](https://www.twilio.com/docs/conversations/identity). + // The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see [User Identity & Access Tokens](https://www.twilio.com/docs/conversations/identity). Identity *string `json:"identity,omitempty"` } + + diff --git a/rest/flex/v2/web_chats.go b/rest/flex/v2/web_chats.go index e54716669..41c44f7a4 100644 --- a/rest/flex/v2/web_chats.go +++ b/rest/flex/v2/web_chats.go @@ -16,69 +16,74 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWebChannel' type CreateWebChannelParams struct { - // The SID of the Conversations Address. See [Address Configuration Resource](https://www.twilio.com/docs/conversations/api/address-configuration-resource) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration. - AddressSid *string `json:"AddressSid,omitempty"` - // The Conversation's friendly name. See the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) for an example. - ChatFriendlyName *string `json:"ChatFriendlyName,omitempty"` - // The Conversation participant's friendly name. See the [Conversation Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) for an example. - CustomerFriendlyName *string `json:"CustomerFriendlyName,omitempty"` - // The pre-engagement data. - PreEngagementData *string `json:"PreEngagementData,omitempty"` + // The SID of the Conversations Address. See [Address Configuration Resource](https://www.twilio.com/docs/conversations/api/address-configuration-resource) for configuration details. When a conversation is created on the Flex backend, the callback URL will be set to the corresponding Studio Flow SID or webhook URL in your address configuration. + AddressSid *string `json:"AddressSid,omitempty"` + // The Conversation's friendly name. See the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) for an example. + ChatFriendlyName *string `json:"ChatFriendlyName,omitempty"` + // The Conversation participant's friendly name. See the [Conversation Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) for an example. + CustomerFriendlyName *string `json:"CustomerFriendlyName,omitempty"` + // The pre-engagement data. + PreEngagementData *string `json:"PreEngagementData,omitempty"` } -func (params *CreateWebChannelParams) SetAddressSid(AddressSid string) *CreateWebChannelParams { - params.AddressSid = &AddressSid - return params +func (params *CreateWebChannelParams) SetAddressSid(AddressSid string) (*CreateWebChannelParams){ + params.AddressSid = &AddressSid + return params } -func (params *CreateWebChannelParams) SetChatFriendlyName(ChatFriendlyName string) *CreateWebChannelParams { - params.ChatFriendlyName = &ChatFriendlyName - return params +func (params *CreateWebChannelParams) SetChatFriendlyName(ChatFriendlyName string) (*CreateWebChannelParams){ + params.ChatFriendlyName = &ChatFriendlyName + return params } -func (params *CreateWebChannelParams) SetCustomerFriendlyName(CustomerFriendlyName string) *CreateWebChannelParams { - params.CustomerFriendlyName = &CustomerFriendlyName - return params +func (params *CreateWebChannelParams) SetCustomerFriendlyName(CustomerFriendlyName string) (*CreateWebChannelParams){ + params.CustomerFriendlyName = &CustomerFriendlyName + return params } -func (params *CreateWebChannelParams) SetPreEngagementData(PreEngagementData string) *CreateWebChannelParams { - params.PreEngagementData = &PreEngagementData - return params +func (params *CreateWebChannelParams) SetPreEngagementData(PreEngagementData string) (*CreateWebChannelParams){ + params.PreEngagementData = &PreEngagementData + return params } -// +// func (c *ApiService) CreateWebChannel(params *CreateWebChannelParams) (*FlexV2WebChannel, error) { - path := "/v2/WebChats" + path := "/v2/WebChats" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.ChatFriendlyName != nil { + data.Set("ChatFriendlyName", *params.ChatFriendlyName) + } + if params != nil && params.CustomerFriendlyName != nil { + data.Set("CustomerFriendlyName", *params.CustomerFriendlyName) + } + if params != nil && params.PreEngagementData != nil { + data.Set("PreEngagementData", *params.PreEngagementData) + } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.ChatFriendlyName != nil { - data.Set("ChatFriendlyName", *params.ChatFriendlyName) - } - if params != nil && params.CustomerFriendlyName != nil { - data.Set("CustomerFriendlyName", *params.CustomerFriendlyName) - } - if params != nil && params.PreEngagementData != nil { - data.Set("PreEngagementData", *params.PreEngagementData) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FlexV2WebChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FlexV2WebChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/frontline/v1/README.md b/rest/frontline/v1/README.md index 6d614c7f1..923bf9a0f 100644 --- a/rest/frontline/v1/README.md +++ b/rest/frontline/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/frontline/v1/api_service.go b/rest/frontline/v1/api_service.go index d4259bea7..e402605e6 100644 --- a/rest/frontline/v1/api_service.go +++ b/rest/frontline/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://frontline-api.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/frontline/v1/model_frontline_v1_user.go b/rest/frontline/v1/model_frontline_v1_user.go index 497838f36..29b6d9347 100644 --- a/rest/frontline/v1/model_frontline_v1_user.go +++ b/rest/frontline/v1/model_frontline_v1_user.go @@ -13,20 +13,25 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // FrontlineV1User struct for FrontlineV1User type FrontlineV1User struct { - // The unique string that we created to identify the User resource. + // The unique string that we created to identify the User resource. Sid *string `json:"sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User. This value is often a username or an email address, and is case-sensitive. + // The application-defined string that uniquely identifies the resource's User. This value is often a username or an email address, and is case-sensitive. Identity *string `json:"identity,omitempty"` - // The string that you assigned to describe the User. + // The string that you assigned to describe the User. FriendlyName *string `json:"friendly_name,omitempty"` - // The avatar URL which will be shown in Frontline application. + // The avatar URL which will be shown in Frontline application. Avatar *string `json:"avatar,omitempty"` - State *string `json:"state,omitempty"` - // Whether the User is available for new conversations. Defaults to `false` for new users. + State *string `json:"state,omitempty"` + // Whether the User is available for new conversations. Defaults to `false` for new users. IsAvailable *bool `json:"is_available,omitempty"` - // An absolute API resource URL for this user. + // An absolute API resource URL for this user. Url *string `json:"url,omitempty"` } + + diff --git a/rest/frontline/v1/users.go b/rest/frontline/v1/users.go index b6994cab2..4c5dc7d9c 100644 --- a/rest/frontline/v1/users.go +++ b/rest/frontline/v1/users.go @@ -18,93 +18,98 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch a frontline user -func (c *ApiService) FetchUser(Sid string) (*FrontlineV1User, error) { - path := "/v1/Users/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchUser(Sid string, ) (*FrontlineV1User, error) { + path := "/v1/Users/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &FrontlineV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &FrontlineV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateUser' type UpdateUserParams struct { - // The string that you assigned to describe the User. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The avatar URL which will be shown in Frontline application. - Avatar *string `json:"Avatar,omitempty"` - // - State *string `json:"State,omitempty"` - // Whether the User is available for new conversations. Set to `false` to prevent User from receiving new inbound conversations if you are using [Pool Routing](https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing). - IsAvailable *bool `json:"IsAvailable,omitempty"` + // The string that you assigned to describe the User. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The avatar URL which will be shown in Frontline application. + Avatar *string `json:"Avatar,omitempty"` + // + State *string `json:"State,omitempty"` + // Whether the User is available for new conversations. Set to `false` to prevent User from receiving new inbound conversations if you are using [Pool Routing](https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing). + IsAvailable *bool `json:"IsAvailable,omitempty"` } -func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) *UpdateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) (*UpdateUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateUserParams) SetAvatar(Avatar string) *UpdateUserParams { - params.Avatar = &Avatar - return params +func (params *UpdateUserParams) SetAvatar(Avatar string) (*UpdateUserParams){ + params.Avatar = &Avatar + return params } -func (params *UpdateUserParams) SetState(State string) *UpdateUserParams { - params.State = &State - return params +func (params *UpdateUserParams) SetState(State string) (*UpdateUserParams){ + params.State = &State + return params } -func (params *UpdateUserParams) SetIsAvailable(IsAvailable bool) *UpdateUserParams { - params.IsAvailable = &IsAvailable - return params +func (params *UpdateUserParams) SetIsAvailable(IsAvailable bool) (*UpdateUserParams){ + params.IsAvailable = &IsAvailable + return params } // Update an existing frontline user func (c *ApiService) UpdateUser(Sid string, params *UpdateUserParams) (*FrontlineV1User, error) { - path := "/v1/Users/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Avatar != nil { - data.Set("Avatar", *params.Avatar) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.IsAvailable != nil { - data.Set("IsAvailable", fmt.Sprint(*params.IsAvailable)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &FrontlineV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Users/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Avatar != nil { + data.Set("Avatar", *params.Avatar) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.IsAvailable != nil { + data.Set("IsAvailable", fmt.Sprint(*params.IsAvailable)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &FrontlineV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/insights/v1/README.md b/rest/insights/v1/README.md index 49cc10043..652d3a7a9 100644 --- a/rest/insights/v1/README.md +++ b/rest/insights/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/insights/v1/api_service.go b/rest/insights/v1/api_service.go index 42a4a9fda..3e289255a 100644 --- a/rest/insights/v1/api_service.go +++ b/rest/insights/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://insights.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/insights/v1/conferences.go b/rest/insights/v1/conferences.go index 9572448bf..039888464 100644 --- a/rest/insights/v1/conferences.go +++ b/rest/insights/v1/conferences.go @@ -18,172 +18,175 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Get a specific Conference Summary. -func (c *ApiService) FetchConference(ConferenceSid string) (*InsightsV1Conference, error) { - path := "/v1/Conferences/{ConferenceSid}" - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) +func (c *ApiService) FetchConference(ConferenceSid string, ) (*InsightsV1Conference, error) { + path := "/v1/Conferences/{ConferenceSid}" + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &InsightsV1Conference{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &InsightsV1Conference{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConference' type ListConferenceParams struct { - // The SID of the conference. - ConferenceSid *string `json:"ConferenceSid,omitempty"` - // Custom label for the conference resource, up to 64 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Conference status. - Status *string `json:"Status,omitempty"` - // Conferences created after the provided timestamp specified in ISO 8601 format - CreatedAfter *string `json:"CreatedAfter,omitempty"` - // Conferences created before the provided timestamp specified in ISO 8601 format. - CreatedBefore *string `json:"CreatedBefore,omitempty"` - // Twilio region where the conference media was mixed. - MixerRegion *string `json:"MixerRegion,omitempty"` - // Tags applied by Twilio for common potential configuration, quality, or performance issues. - Tags *string `json:"Tags,omitempty"` - // Account SID for the subaccount whose resources you wish to retrieve. - Subaccount *string `json:"Subaccount,omitempty"` - // Potential configuration, behavior, or performance issues detected during the conference. - DetectedIssues *string `json:"DetectedIssues,omitempty"` - // Conference end reason; e.g. last participant left, modified by API, etc. - EndReason *string `json:"EndReason,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the conference. + ConferenceSid *string `json:"ConferenceSid,omitempty"` + // Custom label for the conference resource, up to 64 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Conference status. + Status *string `json:"Status,omitempty"` + // Conferences created after the provided timestamp specified in ISO 8601 format + CreatedAfter *string `json:"CreatedAfter,omitempty"` + // Conferences created before the provided timestamp specified in ISO 8601 format. + CreatedBefore *string `json:"CreatedBefore,omitempty"` + // Twilio region where the conference media was mixed. + MixerRegion *string `json:"MixerRegion,omitempty"` + // Tags applied by Twilio for common potential configuration, quality, or performance issues. + Tags *string `json:"Tags,omitempty"` + // Account SID for the subaccount whose resources you wish to retrieve. + Subaccount *string `json:"Subaccount,omitempty"` + // Potential configuration, behavior, or performance issues detected during the conference. + DetectedIssues *string `json:"DetectedIssues,omitempty"` + // Conference end reason; e.g. last participant left, modified by API, etc. + EndReason *string `json:"EndReason,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConferenceParams) SetConferenceSid(ConferenceSid string) *ListConferenceParams { - params.ConferenceSid = &ConferenceSid - return params +func (params *ListConferenceParams) SetConferenceSid(ConferenceSid string) (*ListConferenceParams){ + params.ConferenceSid = &ConferenceSid + return params } -func (params *ListConferenceParams) SetFriendlyName(FriendlyName string) *ListConferenceParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListConferenceParams) SetFriendlyName(FriendlyName string) (*ListConferenceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListConferenceParams) SetStatus(Status string) *ListConferenceParams { - params.Status = &Status - return params +func (params *ListConferenceParams) SetStatus(Status string) (*ListConferenceParams){ + params.Status = &Status + return params } -func (params *ListConferenceParams) SetCreatedAfter(CreatedAfter string) *ListConferenceParams { - params.CreatedAfter = &CreatedAfter - return params +func (params *ListConferenceParams) SetCreatedAfter(CreatedAfter string) (*ListConferenceParams){ + params.CreatedAfter = &CreatedAfter + return params } -func (params *ListConferenceParams) SetCreatedBefore(CreatedBefore string) *ListConferenceParams { - params.CreatedBefore = &CreatedBefore - return params +func (params *ListConferenceParams) SetCreatedBefore(CreatedBefore string) (*ListConferenceParams){ + params.CreatedBefore = &CreatedBefore + return params } -func (params *ListConferenceParams) SetMixerRegion(MixerRegion string) *ListConferenceParams { - params.MixerRegion = &MixerRegion - return params +func (params *ListConferenceParams) SetMixerRegion(MixerRegion string) (*ListConferenceParams){ + params.MixerRegion = &MixerRegion + return params } -func (params *ListConferenceParams) SetTags(Tags string) *ListConferenceParams { - params.Tags = &Tags - return params +func (params *ListConferenceParams) SetTags(Tags string) (*ListConferenceParams){ + params.Tags = &Tags + return params } -func (params *ListConferenceParams) SetSubaccount(Subaccount string) *ListConferenceParams { - params.Subaccount = &Subaccount - return params +func (params *ListConferenceParams) SetSubaccount(Subaccount string) (*ListConferenceParams){ + params.Subaccount = &Subaccount + return params } -func (params *ListConferenceParams) SetDetectedIssues(DetectedIssues string) *ListConferenceParams { - params.DetectedIssues = &DetectedIssues - return params +func (params *ListConferenceParams) SetDetectedIssues(DetectedIssues string) (*ListConferenceParams){ + params.DetectedIssues = &DetectedIssues + return params } -func (params *ListConferenceParams) SetEndReason(EndReason string) *ListConferenceParams { - params.EndReason = &EndReason - return params +func (params *ListConferenceParams) SetEndReason(EndReason string) (*ListConferenceParams){ + params.EndReason = &EndReason + return params } -func (params *ListConferenceParams) SetPageSize(PageSize int) *ListConferenceParams { - params.PageSize = &PageSize - return params +func (params *ListConferenceParams) SetPageSize(PageSize int) (*ListConferenceParams){ + params.PageSize = &PageSize + return params } -func (params *ListConferenceParams) SetLimit(Limit int) *ListConferenceParams { - params.Limit = &Limit - return params +func (params *ListConferenceParams) SetLimit(Limit int) (*ListConferenceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Conference records from the API. Request is executed immediately. func (c *ApiService) PageConference(params *ListConferenceParams, pageToken, pageNumber string) (*ListConferenceResponse, error) { - path := "/v1/Conferences" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ConferenceSid != nil { - data.Set("ConferenceSid", *params.ConferenceSid) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.CreatedAfter != nil { - data.Set("CreatedAfter", *params.CreatedAfter) - } - if params != nil && params.CreatedBefore != nil { - data.Set("CreatedBefore", *params.CreatedBefore) - } - if params != nil && params.MixerRegion != nil { - data.Set("MixerRegion", *params.MixerRegion) - } - if params != nil && params.Tags != nil { - data.Set("Tags", *params.Tags) - } - if params != nil && params.Subaccount != nil { - data.Set("Subaccount", *params.Subaccount) - } - if params != nil && params.DetectedIssues != nil { - data.Set("DetectedIssues", *params.DetectedIssues) - } - if params != nil && params.EndReason != nil { - data.Set("EndReason", *params.EndReason) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Conferences" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ConferenceSid != nil { + data.Set("ConferenceSid", *params.ConferenceSid) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.CreatedAfter != nil { + data.Set("CreatedAfter", *params.CreatedAfter) + } + if params != nil && params.CreatedBefore != nil { + data.Set("CreatedBefore", *params.CreatedBefore) + } + if params != nil && params.MixerRegion != nil { + data.Set("MixerRegion", *params.MixerRegion) + } + if params != nil && params.Tags != nil { + data.Set("Tags", *params.Tags) + } + if params != nil && params.Subaccount != nil { + data.Set("Subaccount", *params.Subaccount) + } + if params != nil && params.DetectedIssues != nil { + data.Set("DetectedIssues", *params.DetectedIssues) + } + if params != nil && params.EndReason != nil { + data.Set("EndReason", *params.EndReason) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConferenceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Conference records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -224,6 +227,7 @@ func (c *ApiService) StreamConference(params *ListConferenceParams) (chan Insigh return recordChannel, errorChannel } + func (c *ApiService) streamConference(response *ListConferenceResponse, params *ListConferenceParams, recordChannel chan InsightsV1Conference, errorChannel chan error) { curRecord := 1 @@ -255,19 +259,20 @@ func (c *ApiService) streamConference(response *ListConferenceResponse, params * } func (c *ApiService) getNextListConferenceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConferenceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/conferences_participants.go b/rest/insights/v1/conferences_participants.go index c007560af..643d21e59 100644 --- a/rest/insights/v1/conferences_participants.go +++ b/rest/insights/v1/conferences_participants.go @@ -18,136 +18,137 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchConferenceParticipant' type FetchConferenceParticipantParams struct { - // Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. - Events *string `json:"Events,omitempty"` - // Object. Contains participant call quality metrics. - Metrics *string `json:"Metrics,omitempty"` + // Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. + Events *string `json:"Events,omitempty"` + // Object. Contains participant call quality metrics. + Metrics *string `json:"Metrics,omitempty"` } -func (params *FetchConferenceParticipantParams) SetEvents(Events string) *FetchConferenceParticipantParams { - params.Events = &Events - return params +func (params *FetchConferenceParticipantParams) SetEvents(Events string) (*FetchConferenceParticipantParams){ + params.Events = &Events + return params } -func (params *FetchConferenceParticipantParams) SetMetrics(Metrics string) *FetchConferenceParticipantParams { - params.Metrics = &Metrics - return params +func (params *FetchConferenceParticipantParams) SetMetrics(Metrics string) (*FetchConferenceParticipantParams){ + params.Metrics = &Metrics + return params } // Get a specific Conference Participant Summary for a Conference. func (c *ApiService) FetchConferenceParticipant(ConferenceSid string, ParticipantSid string, params *FetchConferenceParticipantParams) (*InsightsV1ConferenceParticipant, error) { - path := "/v1/Conferences/{ConferenceSid}/Participants/{ParticipantSid}" - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path := "/v1/Conferences/{ConferenceSid}/Participants/{ParticipantSid}" + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Events != nil { - data.Set("Events", *params.Events) - } - if params != nil && params.Metrics != nil { - data.Set("Metrics", *params.Metrics) - } + if params != nil && params.Events != nil { + data.Set("Events", *params.Events) + } + if params != nil && params.Metrics != nil { + data.Set("Metrics", *params.Metrics) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &InsightsV1ConferenceParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &InsightsV1ConferenceParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConferenceParticipant' type ListConferenceParticipantParams struct { - // The unique SID identifier of the Participant. - ParticipantSid *string `json:"ParticipantSid,omitempty"` - // User-specified label for a participant. - Label *string `json:"Label,omitempty"` - // Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. - Events *string `json:"Events,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique SID identifier of the Participant. + ParticipantSid *string `json:"ParticipantSid,omitempty"` + // User-specified label for a participant. + Label *string `json:"Label,omitempty"` + // Conference events generated by application or participant activity; e.g. `hold`, `mute`, etc. + Events *string `json:"Events,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConferenceParticipantParams) SetParticipantSid(ParticipantSid string) *ListConferenceParticipantParams { - params.ParticipantSid = &ParticipantSid - return params +func (params *ListConferenceParticipantParams) SetParticipantSid(ParticipantSid string) (*ListConferenceParticipantParams){ + params.ParticipantSid = &ParticipantSid + return params } -func (params *ListConferenceParticipantParams) SetLabel(Label string) *ListConferenceParticipantParams { - params.Label = &Label - return params +func (params *ListConferenceParticipantParams) SetLabel(Label string) (*ListConferenceParticipantParams){ + params.Label = &Label + return params } -func (params *ListConferenceParticipantParams) SetEvents(Events string) *ListConferenceParticipantParams { - params.Events = &Events - return params +func (params *ListConferenceParticipantParams) SetEvents(Events string) (*ListConferenceParticipantParams){ + params.Events = &Events + return params } -func (params *ListConferenceParticipantParams) SetPageSize(PageSize int) *ListConferenceParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListConferenceParticipantParams) SetPageSize(PageSize int) (*ListConferenceParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListConferenceParticipantParams) SetLimit(Limit int) *ListConferenceParticipantParams { - params.Limit = &Limit - return params +func (params *ListConferenceParticipantParams) SetLimit(Limit int) (*ListConferenceParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConferenceParticipant records from the API. Request is executed immediately. func (c *ApiService) PageConferenceParticipant(ConferenceSid string, params *ListConferenceParticipantParams, pageToken, pageNumber string) (*ListConferenceParticipantResponse, error) { - path := "/v1/Conferences/{ConferenceSid}/Participants" - - path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ParticipantSid != nil { - data.Set("ParticipantSid", *params.ParticipantSid) - } - if params != nil && params.Label != nil { - data.Set("Label", *params.Label) - } - if params != nil && params.Events != nil { - data.Set("Events", *params.Events) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Conferences/{ConferenceSid}/Participants" + + path = strings.Replace(path, "{"+"ConferenceSid"+"}", ConferenceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ParticipantSid != nil { + data.Set("ParticipantSid", *params.ParticipantSid) + } + if params != nil && params.Label != nil { + data.Set("Label", *params.Label) + } + if params != nil && params.Events != nil { + data.Set("Events", *params.Events) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConferenceParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists ConferenceParticipant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -188,6 +189,7 @@ func (c *ApiService) StreamConferenceParticipant(ConferenceSid string, params *L return recordChannel, errorChannel } + func (c *ApiService) streamConferenceParticipant(response *ListConferenceParticipantResponse, params *ListConferenceParticipantParams, recordChannel chan InsightsV1ConferenceParticipant, errorChannel chan error) { curRecord := 1 @@ -219,19 +221,20 @@ func (c *ApiService) streamConferenceParticipant(response *ListConferencePartici } func (c *ApiService) getNextListConferenceParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConferenceParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConferenceParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/docs/ListCallSummariesResponseMeta.md b/rest/insights/v1/docs/ListCallSummariesResponseMeta.md index 1f578fc6b..604e70eb6 100644 --- a/rest/insights/v1/docs/ListCallSummariesResponseMeta.md +++ b/rest/insights/v1/docs/ListCallSummariesResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/insights/v1/model_insights_v1_account_settings.go b/rest/insights/v1/model_insights_v1_account_settings.go index f52e38332..88dd41069 100644 --- a/rest/insights/v1/model_insights_v1_account_settings.go +++ b/rest/insights/v1/model_insights_v1_account_settings.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // InsightsV1AccountSettings struct for InsightsV1AccountSettings type InsightsV1AccountSettings struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // A boolean flag indicating whether Advanced Features for Voice Insights are enabled. + // A boolean flag indicating whether Advanced Features for Voice Insights are enabled. AdvancedFeatures *bool `json:"advanced_features,omitempty"` - // A boolean flag indicating whether Voice Trace is enabled. + // A boolean flag indicating whether Voice Trace is enabled. VoiceTrace *bool `json:"voice_trace,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_annotation.go b/rest/insights/v1/model_insights_v1_annotation.go index f70da2c6f..8faf0279e 100644 --- a/rest/insights/v1/model_insights_v1_annotation.go +++ b/rest/insights/v1/model_insights_v1_annotation.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // InsightsV1Annotation struct for InsightsV1Annotation type InsightsV1Annotation struct { - // The unique SID identifier of the Call. + // The unique SID identifier of the Call. CallSid *string `json:"call_sid,omitempty"` - // The unique SID identifier of the Account. - AccountSid *string `json:"account_sid,omitempty"` - AnsweredBy *string `json:"answered_by,omitempty"` + // The unique SID identifier of the Account. + AccountSid *string `json:"account_sid,omitempty"` + AnsweredBy *string `json:"answered_by,omitempty"` ConnectivityIssue *string `json:"connectivity_issue,omitempty"` - // Specifies if the call had any subjective quality issues. Possible values are one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, or `static_noise`. + // Specifies if the call had any subjective quality issues. Possible values are one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, or `static_noise`. QualityIssues *[]string `json:"quality_issues,omitempty"` - // Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call. + // Specifies if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call. Spam *bool `json:"spam,omitempty"` - // Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + // Specifies the Call Score, if available. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. CallScore *int `json:"call_score,omitempty"` - // Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments. + // Specifies any comments pertaining to the call. Twilio does not treat this field as PII, so no PII should be included in comments. Comment *string `json:"comment,omitempty"` - // Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. + // Incident or support ticket associated with this call. The `incident` property is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. Incident *string `json:"incident,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_call.go b/rest/insights/v1/model_insights_v1_call.go index a0c104856..9ed661e11 100644 --- a/rest/insights/v1/model_insights_v1_call.go +++ b/rest/insights/v1/model_insights_v1_call.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // InsightsV1Call struct for InsightsV1Call type InsightsV1Call struct { - Sid *string `json:"sid,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_call_summaries.go b/rest/insights/v1/model_insights_v1_call_summaries.go index 7bc810242..ed236f58f 100644 --- a/rest/insights/v1/model_insights_v1_call_summaries.go +++ b/rest/insights/v1/model_insights_v1_call_summaries.go @@ -13,52 +13,54 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // InsightsV1CallSummaries struct for InsightsV1CallSummaries type InsightsV1CallSummaries struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Call. - CallSid *string `json:"call_sid,omitempty"` - AnsweredBy *string `json:"answered_by,omitempty"` - CallType *string `json:"call_type,omitempty"` - CallState *string `json:"call_state,omitempty"` + // The unique SID identifier of the Call. + CallSid *string `json:"call_sid,omitempty"` + AnsweredBy *string `json:"answered_by,omitempty"` + CallType *string `json:"call_type,omitempty"` + CallState *string `json:"call_state,omitempty"` ProcessingState *string `json:"processing_state,omitempty"` - // The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS + // The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS CreatedTime *time.Time `json:"created_time,omitempty"` - // The time at which the Call was started, given in ISO 8601 format. + // The time at which the Call was started, given in ISO 8601 format. StartTime *time.Time `json:"start_time,omitempty"` - // The time at which the Call was ended, given in ISO 8601 format. + // The time at which the Call was ended, given in ISO 8601 format. EndTime *time.Time `json:"end_time,omitempty"` - // Duration between when the call was initiated and the call was ended + // Duration between when the call was initiated and the call was ended Duration *int `json:"duration,omitempty"` - // Duration between when the call was answered and when it ended + // Duration between when the call was answered and when it ended ConnectDuration *int `json:"connect_duration,omitempty"` - // The calling party. + // The calling party. From *interface{} `json:"from,omitempty"` - // The called party. + // The called party. To *interface{} `json:"to,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a PSTN call. + // Contains metrics and properties for the Twilio media gateway of a PSTN call. CarrierEdge *interface{} `json:"carrier_edge,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a Client call. + // Contains metrics and properties for the Twilio media gateway of a Client call. ClientEdge *interface{} `json:"client_edge,omitempty"` - // Contains metrics and properties for the SDK sensor library for Client calls. + // Contains metrics and properties for the SDK sensor library for Client calls. SdkEdge *interface{} `json:"sdk_edge,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. + // Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. SipEdge *interface{} `json:"sip_edge,omitempty"` - // Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality. + // Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality. Tags *[]string `json:"tags,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // Attributes capturing call-flow-specific details. + // Attributes capturing call-flow-specific details. Attributes *interface{} `json:"attributes,omitempty"` - // Contains edge-agnostic call-level details. + // Contains edge-agnostic call-level details. Properties *interface{} `json:"properties,omitempty"` - // Contains trusted communications details including Branded Call and verified caller ID. - Trust *interface{} `json:"trust,omitempty"` + // Contains trusted communications details including Branded Call and verified caller ID. + Trust *interface{} `json:"trust,omitempty"` Annotation *interface{} `json:"annotation,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_conference.go b/rest/insights/v1/model_insights_v1_conference.go index bd2dad1b4..596d19c08 100644 --- a/rest/insights/v1/model_insights_v1_conference.go +++ b/rest/insights/v1/model_insights_v1_conference.go @@ -13,52 +13,54 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // InsightsV1Conference struct for InsightsV1Conference type InsightsV1Conference struct { - // The unique SID identifier of the Conference. + // The unique SID identifier of the Conference. ConferenceSid *string `json:"conference_sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // Custom label for the conference resource, up to 64 characters. + // Custom label for the conference resource, up to 64 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // Conference creation date and time in ISO 8601 format. + // Conference creation date and time in ISO 8601 format. CreateTime *time.Time `json:"create_time,omitempty"` - // Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true. + // Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true. StartTime *time.Time `json:"start_time,omitempty"` - // Conference end date and time in ISO 8601 format. + // Conference end date and time in ISO 8601 format. EndTime *time.Time `json:"end_time,omitempty"` - // Conference duration in seconds. + // Conference duration in seconds. DurationSeconds *int `json:"duration_seconds,omitempty"` - // Duration of the between conference start event and conference end event in seconds. - ConnectDurationSeconds *int `json:"connect_duration_seconds,omitempty"` - Status *string `json:"status,omitempty"` - // Maximum number of concurrent participants as specified by the configuration. + // Duration of the between conference start event and conference end event in seconds. + ConnectDurationSeconds *int `json:"connect_duration_seconds,omitempty"` + Status *string `json:"status,omitempty"` + // Maximum number of concurrent participants as specified by the configuration. MaxParticipants *int `json:"max_participants,omitempty"` - // Actual maximum number of concurrent participants in the conference. + // Actual maximum number of concurrent participants in the conference. MaxConcurrentParticipants *int `json:"max_concurrent_participants,omitempty"` - // Unique conference participants based on caller ID. - UniqueParticipants *int `json:"unique_participants,omitempty"` - EndReason *string `json:"end_reason,omitempty"` - // Call SID of the participant whose actions ended the conference. - EndedBy *string `json:"ended_by,omitempty"` - MixerRegion *string `json:"mixer_region,omitempty"` + // Unique conference participants based on caller ID. + UniqueParticipants *int `json:"unique_participants,omitempty"` + EndReason *string `json:"end_reason,omitempty"` + // Call SID of the participant whose actions ended the conference. + EndedBy *string `json:"ended_by,omitempty"` + MixerRegion *string `json:"mixer_region,omitempty"` MixerRegionRequested *string `json:"mixer_region_requested,omitempty"` - // Boolean. Indicates whether recording was enabled at the conference mixer. + // Boolean. Indicates whether recording was enabled at the conference mixer. RecordingEnabled *bool `json:"recording_enabled,omitempty"` - // Potential issues detected by Twilio during the conference. + // Potential issues detected by Twilio during the conference. DetectedIssues *interface{} `json:"detected_issues,omitempty"` - // Tags for detected conference conditions and participant behaviors which may be of interest. + // Tags for detected conference conditions and participant behaviors which may be of interest. Tags *[]string `json:"tags,omitempty"` - // Object. Contains details about conference tags including severity. - TagInfo *interface{} `json:"tag_info,omitempty"` - ProcessingState *string `json:"processing_state,omitempty"` - // The URL of this resource. + // Object. Contains details about conference tags including severity. + TagInfo *interface{} `json:"tag_info,omitempty"` + ProcessingState *string `json:"processing_state,omitempty"` + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this Conference. + // Contains a dictionary of URL links to nested resources of this Conference. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_conference_participant.go b/rest/insights/v1/model_insights_v1_conference_participant.go index 029b5831c..723d56259 100644 --- a/rest/insights/v1/model_insights_v1_conference_participant.go +++ b/rest/insights/v1/model_insights_v1_conference_participant.go @@ -13,58 +13,60 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // InsightsV1ConferenceParticipant struct for InsightsV1ConferenceParticipant type InsightsV1ConferenceParticipant struct { - // SID for this participant. + // SID for this participant. ParticipantSid *string `json:"participant_sid,omitempty"` - // The user-specified label of this participant. + // The user-specified label of this participant. Label *string `json:"label,omitempty"` - // The unique SID identifier of the Conference. + // The unique SID identifier of the Conference. ConferenceSid *string `json:"conference_sid,omitempty"` - // Unique SID identifier of the call that generated the Participant resource. + // Unique SID identifier of the call that generated the Participant resource. CallSid *string `json:"call_sid,omitempty"` - // The unique SID identifier of the Account. - AccountSid *string `json:"account_sid,omitempty"` + // The unique SID identifier of the Account. + AccountSid *string `json:"account_sid,omitempty"` CallDirection *string `json:"call_direction,omitempty"` - // Caller ID of the calling party. + // Caller ID of the calling party. From *string `json:"from,omitempty"` - // Called party. - To *string `json:"to,omitempty"` + // Called party. + To *string `json:"to,omitempty"` CallStatus *string `json:"call_status,omitempty"` - // ISO alpha-2 country code of the participant based on caller ID or called number. + // ISO alpha-2 country code of the participant based on caller ID or called number. CountryCode *string `json:"country_code,omitempty"` - // Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true. + // Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true. IsModerator *bool `json:"is_moderator,omitempty"` - // ISO 8601 timestamp of participant join event. + // ISO 8601 timestamp of participant join event. JoinTime *time.Time `json:"join_time,omitempty"` - // ISO 8601 timestamp of participant leave event. + // ISO 8601 timestamp of participant leave event. LeaveTime *time.Time `json:"leave_time,omitempty"` - // Participant durations in seconds. + // Participant durations in seconds. DurationSeconds *int `json:"duration_seconds,omitempty"` - // Add Participant API only. Estimated time in queue at call creation. + // Add Participant API only. Estimated time in queue at call creation. OutboundQueueLength *int `json:"outbound_queue_length,omitempty"` - // Add Participant API only. Actual time in queue in seconds. - OutboundTimeInQueue *int `json:"outbound_time_in_queue,omitempty"` - JitterBufferSize *string `json:"jitter_buffer_size,omitempty"` - // Boolean. Indicated whether participant was a coach. + // Add Participant API only. Actual time in queue in seconds. + OutboundTimeInQueue *int `json:"outbound_time_in_queue,omitempty"` + JitterBufferSize *string `json:"jitter_buffer_size,omitempty"` + // Boolean. Indicated whether participant was a coach. IsCoach *bool `json:"is_coach,omitempty"` - // Call SIDs coached by this participant. + // Call SIDs coached by this participant. CoachedParticipants *[]string `json:"coached_participants,omitempty"` - ParticipantRegion *string `json:"participant_region,omitempty"` - ConferenceRegion *string `json:"conference_region,omitempty"` - CallType *string `json:"call_type,omitempty"` - ProcessingState *string `json:"processing_state,omitempty"` - // Participant properties and metadata. + ParticipantRegion *string `json:"participant_region,omitempty"` + ConferenceRegion *string `json:"conference_region,omitempty"` + CallType *string `json:"call_type,omitempty"` + ProcessingState *string `json:"processing_state,omitempty"` + // Participant properties and metadata. Properties *interface{} `json:"properties,omitempty"` - // Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant. + // Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant. Events *interface{} `json:"events,omitempty"` - // Object. Contains participant call quality metrics. + // Object. Contains participant call quality metrics. Metrics *interface{} `json:"metrics,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_event.go b/rest/insights/v1/model_insights_v1_event.go index 99aea16ae..27a578639 100644 --- a/rest/insights/v1/model_insights_v1_event.go +++ b/rest/insights/v1/model_insights_v1_event.go @@ -13,27 +13,32 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // InsightsV1Event struct for InsightsV1Event type InsightsV1Event struct { - // Event time. + // Event time. Timestamp *string `json:"timestamp,omitempty"` - // The unique SID identifier of the Call. + // The unique SID identifier of the Call. CallSid *string `json:"call_sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - Edge *string `json:"edge,omitempty"` - // Event group. + Edge *string `json:"edge,omitempty"` + // Event group. Group *string `json:"group,omitempty"` Level *string `json:"level,omitempty"` - // Event name. + // Event name. Name *string `json:"name,omitempty"` - // Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio's carrier media gateways. + // Represents the connection between Twilio and our immediate carrier partners. The events here describe the call lifecycle as reported by Twilio's carrier media gateways. CarrierEdge *interface{} `json:"carrier_edge,omitempty"` - // Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio's public media gateways. + // Represents the Twilio media gateway for SIP interface and SIP trunking calls. The events here describe the call lifecycle as reported by Twilio's public media gateways. SipEdge *interface{} `json:"sip_edge,omitempty"` - // Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions. + // Represents the Voice SDK running locally in the browser or in the Android/iOS application. The events here are emitted by the Voice SDK in response to certain call progress events, network changes, or call quality conditions. SdkEdge *interface{} `json:"sdk_edge,omitempty"` - // Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio's Voice SDK media gateways. + // Represents the Twilio media gateway for Client calls. The events here describe the call lifecycle as reported by Twilio's Voice SDK media gateways. ClientEdge *interface{} `json:"client_edge,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_metric.go b/rest/insights/v1/model_insights_v1_metric.go index 37c2af0ab..c6cb00f89 100644 --- a/rest/insights/v1/model_insights_v1_metric.go +++ b/rest/insights/v1/model_insights_v1_metric.go @@ -13,23 +13,28 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // InsightsV1Metric struct for InsightsV1Metric type InsightsV1Metric struct { - // Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds. + // Timestamp of metric sample. Samples are taken every 10 seconds and contain the metrics for the previous 10 seconds. Timestamp *string `json:"timestamp,omitempty"` - // The unique SID identifier of the Call. + // The unique SID identifier of the Call. CallSid *string `json:"call_sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - Edge *string `json:"edge,omitempty"` - Direction *string `json:"direction,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a PSTN call. + Edge *string `json:"edge,omitempty"` + Direction *string `json:"direction,omitempty"` + // Contains metrics and properties for the Twilio media gateway of a PSTN call. CarrierEdge *interface{} `json:"carrier_edge,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. + // Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. SipEdge *interface{} `json:"sip_edge,omitempty"` - // Contains metrics and properties for the SDK sensor library for Client calls. + // Contains metrics and properties for the SDK sensor library for Client calls. SdkEdge *interface{} `json:"sdk_edge,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a Client call. + // Contains metrics and properties for the Twilio media gateway of a Client call. ClientEdge *interface{} `json:"client_edge,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_summary.go b/rest/insights/v1/model_insights_v1_summary.go index f8c55e526..70073a12c 100644 --- a/rest/insights/v1/model_insights_v1_summary.go +++ b/rest/insights/v1/model_insights_v1_summary.go @@ -13,53 +13,55 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // InsightsV1Summary struct for InsightsV1Summary type InsightsV1Summary struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Call. - CallSid *string `json:"call_sid,omitempty"` - CallType *string `json:"call_type,omitempty"` - CallState *string `json:"call_state,omitempty"` - AnsweredBy *string `json:"answered_by,omitempty"` + // The unique SID identifier of the Call. + CallSid *string `json:"call_sid,omitempty"` + CallType *string `json:"call_type,omitempty"` + CallState *string `json:"call_state,omitempty"` + AnsweredBy *string `json:"answered_by,omitempty"` ProcessingState *string `json:"processing_state,omitempty"` - // The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS + // The time at which the Call was created, given in ISO 8601 format. Can be different from `start_time` in the event of queueing due to CPS CreatedTime *time.Time `json:"created_time,omitempty"` - // The time at which the Call was started, given in ISO 8601 format. + // The time at which the Call was started, given in ISO 8601 format. StartTime *time.Time `json:"start_time,omitempty"` - // The time at which the Call was ended, given in ISO 8601 format. + // The time at which the Call was ended, given in ISO 8601 format. EndTime *time.Time `json:"end_time,omitempty"` - // Duration between when the call was initiated and the call was ended + // Duration between when the call was initiated and the call was ended Duration *int `json:"duration,omitempty"` - // Duration between when the call was answered and when it ended + // Duration between when the call was answered and when it ended ConnectDuration *int `json:"connect_duration,omitempty"` - // The calling party. + // The calling party. From *interface{} `json:"from,omitempty"` - // The called party. + // The called party. To *interface{} `json:"to,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a PSTN call. + // Contains metrics and properties for the Twilio media gateway of a PSTN call. CarrierEdge *interface{} `json:"carrier_edge,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a Client call. + // Contains metrics and properties for the Twilio media gateway of a Client call. ClientEdge *interface{} `json:"client_edge,omitempty"` - // Contains metrics and properties for the SDK sensor library for Client calls. + // Contains metrics and properties for the SDK sensor library for Client calls. SdkEdge *interface{} `json:"sdk_edge,omitempty"` - // Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. + // Contains metrics and properties for the Twilio media gateway of a SIP Interface or Trunking call. SipEdge *interface{} `json:"sip_edge,omitempty"` - // Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality. + // Tags applied to calls by Voice Insights analysis indicating a condition that could result in subjective degradation of the call quality. Tags *[]string `json:"tags,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // Attributes capturing call-flow-specific details. + // Attributes capturing call-flow-specific details. Attributes *interface{} `json:"attributes,omitempty"` - // Contains edge-agnostic call-level details. + // Contains edge-agnostic call-level details. Properties *interface{} `json:"properties,omitempty"` - // Contains trusted communications details including Branded Call and verified caller ID. + // Contains trusted communications details including Branded Call and verified caller ID. Trust *interface{} `json:"trust,omitempty"` - // Programmatically labeled annotations for the Call. Developers can update the Call Summary records with Annotation during or after a Call. Annotations can be updated as long as the Call Summary record is addressable via the API. + // Programmatically labeled annotations for the Call. Developers can update the Call Summary records with Annotation during or after a Call. Annotations can be updated as long as the Call Summary record is addressable via the API. Annotation *interface{} `json:"annotation,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_video_participant_summary.go b/rest/insights/v1/model_insights_v1_video_participant_summary.go index cea5eb1b7..7a4bd49f1 100644 --- a/rest/insights/v1/model_insights_v1_video_participant_summary.go +++ b/rest/insights/v1/model_insights_v1_video_participant_summary.go @@ -13,42 +13,44 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // InsightsV1VideoParticipantSummary struct for InsightsV1VideoParticipantSummary type InsightsV1VideoParticipantSummary struct { - // Unique identifier for the participant. + // Unique identifier for the participant. ParticipantSid *string `json:"participant_sid,omitempty"` - // The application-defined string that uniquely identifies the participant within a Room. + // The application-defined string that uniquely identifies the participant within a Room. ParticipantIdentity *string `json:"participant_identity,omitempty"` - // When the participant joined the room. + // When the participant joined the room. JoinTime *time.Time `json:"join_time,omitempty"` - // When the participant left the room. + // When the participant left the room. LeaveTime *time.Time `json:"leave_time,omitempty"` - // Amount of time in seconds the participant was in the room. + // Amount of time in seconds the participant was in the room. DurationSec *int64 `json:"duration_sec,omitempty"` - // Account SID associated with the room. + // Account SID associated with the room. AccountSid *string `json:"account_sid,omitempty"` - // Unique identifier for the room. + // Unique identifier for the room. RoomSid *string `json:"room_sid,omitempty"` - Status *string `json:"status,omitempty"` - // Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`. + Status *string `json:"status,omitempty"` + // Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`. Codecs *[]string `json:"codecs,omitempty"` - // Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#end_reason). + // Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#end_reason). EndReason *string `json:"end_reason,omitempty"` - // Errors encountered by the participant. + // Errors encountered by the participant. ErrorCode *int `json:"error_code,omitempty"` - // Twilio error code dictionary link. + // Twilio error code dictionary link. ErrorCodeUrl *string `json:"error_code_url,omitempty"` - MediaRegion *string `json:"media_region,omitempty"` - // Object containing information about the participant's data from the room. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#properties) for more information. - Properties *interface{} `json:"properties,omitempty"` - EdgeLocation *string `json:"edge_location,omitempty"` - // Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#publisher_info) for more information. + MediaRegion *string `json:"media_region,omitempty"` + // Object containing information about the participant's data from the room. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#properties) for more information. + Properties *interface{} `json:"properties,omitempty"` + EdgeLocation *string `json:"edge_location,omitempty"` + // Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/troubleshooting/video-log-analyzer-api#publisher_info) for more information. PublisherInfo *interface{} `json:"publisher_info,omitempty"` - // URL of the participant resource. + // URL of the participant resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/insights/v1/model_insights_v1_video_room_summary.go b/rest/insights/v1/model_insights_v1_video_room_summary.go index 70510a2b1..0ba0a39c8 100644 --- a/rest/insights/v1/model_insights_v1_video_room_summary.go +++ b/rest/insights/v1/model_insights_v1_video_room_summary.go @@ -13,56 +13,58 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // InsightsV1VideoRoomSummary struct for InsightsV1VideoRoomSummary type InsightsV1VideoRoomSummary struct { - // Account SID associated with this room. + // Account SID associated with this room. AccountSid *string `json:"account_sid,omitempty"` - // Unique identifier for the room. + // Unique identifier for the room. RoomSid *string `json:"room_sid,omitempty"` - // Room friendly name. + // Room friendly name. RoomName *string `json:"room_name,omitempty"` - // Creation time of the room. + // Creation time of the room. CreateTime *time.Time `json:"create_time,omitempty"` - // End time for the room. - EndTime *time.Time `json:"end_time,omitempty"` - RoomType *string `json:"room_type,omitempty"` - RoomStatus *string `json:"room_status,omitempty"` - // Webhook provided for status callbacks. + // End time for the room. + EndTime *time.Time `json:"end_time,omitempty"` + RoomType *string `json:"room_type,omitempty"` + RoomStatus *string `json:"room_status,omitempty"` + // Webhook provided for status callbacks. StatusCallback *string `json:"status_callback,omitempty"` - // HTTP method provided for status callback URL. + // HTTP method provided for status callback URL. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - CreatedMethod *string `json:"created_method,omitempty"` - EndReason *string `json:"end_reason,omitempty"` - // Max number of total participants allowed by the application settings. + CreatedMethod *string `json:"created_method,omitempty"` + EndReason *string `json:"end_reason,omitempty"` + // Max number of total participants allowed by the application settings. MaxParticipants *int `json:"max_participants,omitempty"` - // Number of participants. May include duplicate identities for participants who left and rejoined. + // Number of participants. May include duplicate identities for participants who left and rejoined. UniqueParticipants *int `json:"unique_participants,omitempty"` - // Unique number of participant identities. + // Unique number of participant identities. UniqueParticipantIdentities *int `json:"unique_participant_identities,omitempty"` - // Actual number of concurrent participants. + // Actual number of concurrent participants. ConcurrentParticipants *int `json:"concurrent_participants,omitempty"` - // Maximum number of participants allowed in the room at the same time allowed by the application settings. + // Maximum number of participants allowed in the room at the same time allowed by the application settings. MaxConcurrentParticipants *int `json:"max_concurrent_participants,omitempty"` - // Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. - Codecs *[]string `json:"codecs,omitempty"` - MediaRegion *string `json:"media_region,omitempty"` - // Total room duration from create time to end time. + // Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. + Codecs *[]string `json:"codecs,omitempty"` + MediaRegion *string `json:"media_region,omitempty"` + // Total room duration from create time to end time. DurationSec *int64 `json:"duration_sec,omitempty"` - // Combined amount of participant time in the room. + // Combined amount of participant time in the room. TotalParticipantDurationSec *int64 `json:"total_participant_duration_sec,omitempty"` - // Combined amount of recorded seconds for participants in the room. - TotalRecordingDurationSec *int64 `json:"total_recording_duration_sec,omitempty"` - ProcessingState *string `json:"processing_state,omitempty"` - // Boolean indicating if recording is enabled for the room. - RecordingEnabled *bool `json:"recording_enabled,omitempty"` - EdgeLocation *string `json:"edge_location,omitempty"` - // URL for the room resource. + // Combined amount of recorded seconds for participants in the room. + TotalRecordingDurationSec *int64 `json:"total_recording_duration_sec,omitempty"` + ProcessingState *string `json:"processing_state,omitempty"` + // Boolean indicating if recording is enabled for the room. + RecordingEnabled *bool `json:"recording_enabled,omitempty"` + EdgeLocation *string `json:"edge_location,omitempty"` + // URL for the room resource. Url *string `json:"url,omitempty"` - // Room subresources. + // Room subresources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/insights/v1/model_list_call_summaries_response.go b/rest/insights/v1/model_list_call_summaries_response.go index 4063c3353..acda66351 100644 --- a/rest/insights/v1/model_list_call_summaries_response.go +++ b/rest/insights/v1/model_list_call_summaries_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCallSummariesResponse struct for ListCallSummariesResponse type ListCallSummariesResponse struct { - CallSummaries []InsightsV1CallSummaries `json:"call_summaries,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + CallSummaries []InsightsV1CallSummaries `json:"call_summaries,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/model_list_call_summaries_response_meta.go b/rest/insights/v1/model_list_call_summaries_response_meta.go index d3445fb5c..9d8f0e678 100644 --- a/rest/insights/v1/model_list_call_summaries_response_meta.go +++ b/rest/insights/v1/model_list_call_summaries_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCallSummariesResponseMeta struct for ListCallSummariesResponseMeta type ListCallSummariesResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/insights/v1/model_list_conference_participant_response.go b/rest/insights/v1/model_list_conference_participant_response.go index e50dd4db2..59967b331 100644 --- a/rest/insights/v1/model_list_conference_participant_response.go +++ b/rest/insights/v1/model_list_conference_participant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConferenceParticipantResponse struct for ListConferenceParticipantResponse type ListConferenceParticipantResponse struct { Participants []InsightsV1ConferenceParticipant `json:"participants,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/model_list_conference_response.go b/rest/insights/v1/model_list_conference_response.go index d242a440d..740cc4889 100644 --- a/rest/insights/v1/model_list_conference_response.go +++ b/rest/insights/v1/model_list_conference_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConferenceResponse struct for ListConferenceResponse type ListConferenceResponse struct { - Conferences []InsightsV1Conference `json:"conferences,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + Conferences []InsightsV1Conference `json:"conferences,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/model_list_event_response.go b/rest/insights/v1/model_list_event_response.go index 9beff8ac9..96087eba7 100644 --- a/rest/insights/v1/model_list_event_response.go +++ b/rest/insights/v1/model_list_event_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEventResponse struct for ListEventResponse type ListEventResponse struct { - Events []InsightsV1Event `json:"events,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + Events []InsightsV1Event `json:"events,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/model_list_metric_response.go b/rest/insights/v1/model_list_metric_response.go index 812751564..3c4cfd098 100644 --- a/rest/insights/v1/model_list_metric_response.go +++ b/rest/insights/v1/model_list_metric_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMetricResponse struct for ListMetricResponse type ListMetricResponse struct { - Metrics []InsightsV1Metric `json:"metrics,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + Metrics []InsightsV1Metric `json:"metrics,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/model_list_video_participant_summary_response.go b/rest/insights/v1/model_list_video_participant_summary_response.go index 6c94f66ad..7819127b3 100644 --- a/rest/insights/v1/model_list_video_participant_summary_response.go +++ b/rest/insights/v1/model_list_video_participant_summary_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVideoParticipantSummaryResponse struct for ListVideoParticipantSummaryResponse type ListVideoParticipantSummaryResponse struct { Participants []InsightsV1VideoParticipantSummary `json:"participants,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/model_list_video_room_summary_response.go b/rest/insights/v1/model_list_video_room_summary_response.go index 3778a106f..9a9abe82c 100644 --- a/rest/insights/v1/model_list_video_room_summary_response.go +++ b/rest/insights/v1/model_list_video_room_summary_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVideoRoomSummaryResponse struct for ListVideoRoomSummaryResponse type ListVideoRoomSummaryResponse struct { - Rooms []InsightsV1VideoRoomSummary `json:"rooms,omitempty"` - Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` + Rooms []InsightsV1VideoRoomSummary `json:"rooms,omitempty"` + Meta ListCallSummariesResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/insights/v1/video_rooms.go b/rest/insights/v1/video_rooms.go index 632bb3a94..ff1efadac 100644 --- a/rest/insights/v1/video_rooms.go +++ b/rest/insights/v1/video_rooms.go @@ -18,132 +18,134 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Get Video Log Analyzer data for a Room. -func (c *ApiService) FetchVideoRoomSummary(RoomSid string) (*InsightsV1VideoRoomSummary, error) { - path := "/v1/Video/Rooms/{RoomSid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) +func (c *ApiService) FetchVideoRoomSummary(RoomSid string, ) (*InsightsV1VideoRoomSummary, error) { + path := "/v1/Video/Rooms/{RoomSid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &InsightsV1VideoRoomSummary{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &InsightsV1VideoRoomSummary{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListVideoRoomSummary' type ListVideoRoomSummaryParams struct { - // Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. - RoomType *[]string `json:"RoomType,omitempty"` - // Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. - Codec *[]string `json:"Codec,omitempty"` - // Room friendly name. - RoomName *string `json:"RoomName,omitempty"` - // Only read rooms that started on or after this ISO 8601 timestamp. - CreatedAfter *time.Time `json:"CreatedAfter,omitempty"` - // Only read rooms that started before this ISO 8601 timestamp. - CreatedBefore *time.Time `json:"CreatedBefore,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. + RoomType *[]string `json:"RoomType,omitempty"` + // Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. + Codec *[]string `json:"Codec,omitempty"` + // Room friendly name. + RoomName *string `json:"RoomName,omitempty"` + // Only read rooms that started on or after this ISO 8601 timestamp. + CreatedAfter *time.Time `json:"CreatedAfter,omitempty"` + // Only read rooms that started before this ISO 8601 timestamp. + CreatedBefore *time.Time `json:"CreatedBefore,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVideoRoomSummaryParams) SetRoomType(RoomType []string) *ListVideoRoomSummaryParams { - params.RoomType = &RoomType - return params +func (params *ListVideoRoomSummaryParams) SetRoomType(RoomType []string) (*ListVideoRoomSummaryParams){ + params.RoomType = &RoomType + return params } -func (params *ListVideoRoomSummaryParams) SetCodec(Codec []string) *ListVideoRoomSummaryParams { - params.Codec = &Codec - return params +func (params *ListVideoRoomSummaryParams) SetCodec(Codec []string) (*ListVideoRoomSummaryParams){ + params.Codec = &Codec + return params } -func (params *ListVideoRoomSummaryParams) SetRoomName(RoomName string) *ListVideoRoomSummaryParams { - params.RoomName = &RoomName - return params +func (params *ListVideoRoomSummaryParams) SetRoomName(RoomName string) (*ListVideoRoomSummaryParams){ + params.RoomName = &RoomName + return params } -func (params *ListVideoRoomSummaryParams) SetCreatedAfter(CreatedAfter time.Time) *ListVideoRoomSummaryParams { - params.CreatedAfter = &CreatedAfter - return params +func (params *ListVideoRoomSummaryParams) SetCreatedAfter(CreatedAfter time.Time) (*ListVideoRoomSummaryParams){ + params.CreatedAfter = &CreatedAfter + return params } -func (params *ListVideoRoomSummaryParams) SetCreatedBefore(CreatedBefore time.Time) *ListVideoRoomSummaryParams { - params.CreatedBefore = &CreatedBefore - return params +func (params *ListVideoRoomSummaryParams) SetCreatedBefore(CreatedBefore time.Time) (*ListVideoRoomSummaryParams){ + params.CreatedBefore = &CreatedBefore + return params } -func (params *ListVideoRoomSummaryParams) SetPageSize(PageSize int) *ListVideoRoomSummaryParams { - params.PageSize = &PageSize - return params +func (params *ListVideoRoomSummaryParams) SetPageSize(PageSize int) (*ListVideoRoomSummaryParams){ + params.PageSize = &PageSize + return params } -func (params *ListVideoRoomSummaryParams) SetLimit(Limit int) *ListVideoRoomSummaryParams { - params.Limit = &Limit - return params +func (params *ListVideoRoomSummaryParams) SetLimit(Limit int) (*ListVideoRoomSummaryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of VideoRoomSummary records from the API. Request is executed immediately. func (c *ApiService) PageVideoRoomSummary(params *ListVideoRoomSummaryParams, pageToken, pageNumber string) (*ListVideoRoomSummaryResponse, error) { - path := "/v1/Video/Rooms" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.RoomType != nil { - for _, item := range *params.RoomType { - data.Add("RoomType", item) - } - } - if params != nil && params.Codec != nil { - for _, item := range *params.Codec { - data.Add("Codec", item) - } - } - if params != nil && params.RoomName != nil { - data.Set("RoomName", *params.RoomName) - } - if params != nil && params.CreatedAfter != nil { - data.Set("CreatedAfter", fmt.Sprint((*params.CreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.CreatedBefore != nil { - data.Set("CreatedBefore", fmt.Sprint((*params.CreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVideoRoomSummaryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Video/Rooms" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RoomType != nil { + for _, item := range *params.RoomType { + data.Add("RoomType", item) + } + } + if params != nil && params.Codec != nil { + for _, item := range *params.Codec { + data.Add("Codec", item) + } + } + if params != nil && params.RoomName != nil { + data.Set("RoomName", *params.RoomName) + } + if params != nil && params.CreatedAfter != nil { + data.Set("CreatedAfter", fmt.Sprint((*params.CreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.CreatedBefore != nil { + data.Set("CreatedBefore", fmt.Sprint((*params.CreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVideoRoomSummaryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists VideoRoomSummary records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -184,6 +186,7 @@ func (c *ApiService) StreamVideoRoomSummary(params *ListVideoRoomSummaryParams) return recordChannel, errorChannel } + func (c *ApiService) streamVideoRoomSummary(response *ListVideoRoomSummaryResponse, params *ListVideoRoomSummaryParams, recordChannel chan InsightsV1VideoRoomSummary, errorChannel chan error) { curRecord := 1 @@ -215,19 +218,20 @@ func (c *ApiService) streamVideoRoomSummary(response *ListVideoRoomSummaryRespon } func (c *ApiService) getNextListVideoRoomSummaryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVideoRoomSummaryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVideoRoomSummaryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/video_rooms_participants.go b/rest/insights/v1/video_rooms_participants.go index 9606f4ca6..ad230b4d2 100644 --- a/rest/insights/v1/video_rooms_participants.go +++ b/rest/insights/v1/video_rooms_participants.go @@ -18,85 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Get Video Log Analyzer data for a Room Participant. -func (c *ApiService) FetchVideoParticipantSummary(RoomSid string, ParticipantSid string) (*InsightsV1VideoParticipantSummary, error) { - path := "/v1/Video/Rooms/{RoomSid}/Participants/{ParticipantSid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) +func (c *ApiService) FetchVideoParticipantSummary(RoomSid string, ParticipantSid string, ) (*InsightsV1VideoParticipantSummary, error) { + path := "/v1/Video/Rooms/{RoomSid}/Participants/{ParticipantSid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &InsightsV1VideoParticipantSummary{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &InsightsV1VideoParticipantSummary{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListVideoParticipantSummary' type ListVideoParticipantSummaryParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVideoParticipantSummaryParams) SetPageSize(PageSize int) *ListVideoParticipantSummaryParams { - params.PageSize = &PageSize - return params +func (params *ListVideoParticipantSummaryParams) SetPageSize(PageSize int) (*ListVideoParticipantSummaryParams){ + params.PageSize = &PageSize + return params } -func (params *ListVideoParticipantSummaryParams) SetLimit(Limit int) *ListVideoParticipantSummaryParams { - params.Limit = &Limit - return params +func (params *ListVideoParticipantSummaryParams) SetLimit(Limit int) (*ListVideoParticipantSummaryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of VideoParticipantSummary records from the API. Request is executed immediately. func (c *ApiService) PageVideoParticipantSummary(RoomSid string, params *ListVideoParticipantSummaryParams, pageToken, pageNumber string) (*ListVideoParticipantSummaryResponse, error) { - path := "/v1/Video/Rooms/{RoomSid}/Participants" + path := "/v1/Video/Rooms/{RoomSid}/Participants" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListVideoParticipantSummaryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListVideoParticipantSummaryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists VideoParticipantSummary records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -137,6 +139,7 @@ func (c *ApiService) StreamVideoParticipantSummary(RoomSid string, params *ListV return recordChannel, errorChannel } + func (c *ApiService) streamVideoParticipantSummary(response *ListVideoParticipantSummaryResponse, params *ListVideoParticipantSummaryParams, recordChannel chan InsightsV1VideoParticipantSummary, errorChannel chan error) { curRecord := 1 @@ -168,19 +171,20 @@ func (c *ApiService) streamVideoParticipantSummary(response *ListVideoParticipan } func (c *ApiService) getNextListVideoParticipantSummaryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVideoParticipantSummaryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVideoParticipantSummaryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/voice.go b/rest/insights/v1/voice.go index e78674854..5a1f960f4 100644 --- a/rest/insights/v1/voice.go +++ b/rest/insights/v1/voice.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchCall(Sid string) (*InsightsV1Call, error) { - path := "/v1/Voice/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchCall(Sid string, ) (*InsightsV1Call, error) { + path := "/v1/Voice/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &InsightsV1Call{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &InsightsV1Call{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/insights/v1/voice_annotation.go b/rest/insights/v1/voice_annotation.go index ac6b88f5e..d7ae1f050 100644 --- a/rest/insights/v1/voice_annotation.go +++ b/rest/insights/v1/voice_annotation.go @@ -18,120 +18,125 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Get the Annotation for a specific Call. -func (c *ApiService) FetchAnnotation(CallSid string) (*InsightsV1Annotation, error) { - path := "/v1/Voice/{CallSid}/Annotation" - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) +func (c *ApiService) FetchAnnotation(CallSid string, ) (*InsightsV1Annotation, error) { + path := "/v1/Voice/{CallSid}/Annotation" + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &InsightsV1Annotation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &InsightsV1Annotation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateAnnotation' type UpdateAnnotationParams struct { - // - AnsweredBy *string `json:"AnsweredBy,omitempty"` - // - ConnectivityIssue *string `json:"ConnectivityIssue,omitempty"` - // Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call. - QualityIssues *string `json:"QualityIssues,omitempty"` - // A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call. - Spam *bool `json:"Spam,omitempty"` - // Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. - CallScore *int `json:"CallScore,omitempty"` - // Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`. - Comment *string `json:"Comment,omitempty"` - // Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. - Incident *string `json:"Incident,omitempty"` + // + AnsweredBy *string `json:"AnsweredBy,omitempty"` + // + ConnectivityIssue *string `json:"ConnectivityIssue,omitempty"` + // Specify if the call had any subjective quality issues. Possible values, one or more of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. Use comma separated values to indicate multiple quality issues for the same call. + QualityIssues *string `json:"QualityIssues,omitempty"` + // A boolean flag to indicate if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Use `true` if the call was a spam call. + Spam *bool `json:"Spam,omitempty"` + // Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + CallScore *int `json:"CallScore,omitempty"` + // Specify any comments pertaining to the call. `comment` has a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in the `comment`. + Comment *string `json:"Comment,omitempty"` + // Associate this call with an incident or support ticket. The `incident` parameter is of type string with a maximum character limit of 100. Twilio does not treat this field as PII, so no PII should be included in `incident`. + Incident *string `json:"Incident,omitempty"` } -func (params *UpdateAnnotationParams) SetAnsweredBy(AnsweredBy string) *UpdateAnnotationParams { - params.AnsweredBy = &AnsweredBy - return params +func (params *UpdateAnnotationParams) SetAnsweredBy(AnsweredBy string) (*UpdateAnnotationParams){ + params.AnsweredBy = &AnsweredBy + return params } -func (params *UpdateAnnotationParams) SetConnectivityIssue(ConnectivityIssue string) *UpdateAnnotationParams { - params.ConnectivityIssue = &ConnectivityIssue - return params +func (params *UpdateAnnotationParams) SetConnectivityIssue(ConnectivityIssue string) (*UpdateAnnotationParams){ + params.ConnectivityIssue = &ConnectivityIssue + return params } -func (params *UpdateAnnotationParams) SetQualityIssues(QualityIssues string) *UpdateAnnotationParams { - params.QualityIssues = &QualityIssues - return params +func (params *UpdateAnnotationParams) SetQualityIssues(QualityIssues string) (*UpdateAnnotationParams){ + params.QualityIssues = &QualityIssues + return params } -func (params *UpdateAnnotationParams) SetSpam(Spam bool) *UpdateAnnotationParams { - params.Spam = &Spam - return params +func (params *UpdateAnnotationParams) SetSpam(Spam bool) (*UpdateAnnotationParams){ + params.Spam = &Spam + return params } -func (params *UpdateAnnotationParams) SetCallScore(CallScore int) *UpdateAnnotationParams { - params.CallScore = &CallScore - return params +func (params *UpdateAnnotationParams) SetCallScore(CallScore int) (*UpdateAnnotationParams){ + params.CallScore = &CallScore + return params } -func (params *UpdateAnnotationParams) SetComment(Comment string) *UpdateAnnotationParams { - params.Comment = &Comment - return params +func (params *UpdateAnnotationParams) SetComment(Comment string) (*UpdateAnnotationParams){ + params.Comment = &Comment + return params } -func (params *UpdateAnnotationParams) SetIncident(Incident string) *UpdateAnnotationParams { - params.Incident = &Incident - return params +func (params *UpdateAnnotationParams) SetIncident(Incident string) (*UpdateAnnotationParams){ + params.Incident = &Incident + return params } // Update an Annotation for a specific Call. func (c *ApiService) UpdateAnnotation(CallSid string, params *UpdateAnnotationParams) (*InsightsV1Annotation, error) { - path := "/v1/Voice/{CallSid}/Annotation" - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AnsweredBy != nil { - data.Set("AnsweredBy", *params.AnsweredBy) - } - if params != nil && params.ConnectivityIssue != nil { - data.Set("ConnectivityIssue", *params.ConnectivityIssue) - } - if params != nil && params.QualityIssues != nil { - data.Set("QualityIssues", *params.QualityIssues) - } - if params != nil && params.Spam != nil { - data.Set("Spam", fmt.Sprint(*params.Spam)) - } - if params != nil && params.CallScore != nil { - data.Set("CallScore", fmt.Sprint(*params.CallScore)) - } - if params != nil && params.Comment != nil { - data.Set("Comment", *params.Comment) - } - if params != nil && params.Incident != nil { - data.Set("Incident", *params.Incident) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &InsightsV1Annotation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Voice/{CallSid}/Annotation" + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AnsweredBy != nil { + data.Set("AnsweredBy", *params.AnsweredBy) + } + if params != nil && params.ConnectivityIssue != nil { + data.Set("ConnectivityIssue", *params.ConnectivityIssue) + } + if params != nil && params.QualityIssues != nil { + data.Set("QualityIssues", *params.QualityIssues) + } + if params != nil && params.Spam != nil { + data.Set("Spam", fmt.Sprint(*params.Spam)) + } + if params != nil && params.CallScore != nil { + data.Set("CallScore", fmt.Sprint(*params.CallScore)) + } + if params != nil && params.Comment != nil { + data.Set("Comment", *params.Comment) + } + if params != nil && params.Incident != nil { + data.Set("Incident", *params.Incident) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &InsightsV1Annotation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/insights/v1/voice_events.go b/rest/insights/v1/voice_events.go index bdf7f2047..c1aca48e2 100644 --- a/rest/insights/v1/voice_events.go +++ b/rest/insights/v1/voice_events.go @@ -18,70 +18,70 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListEvent' type ListEventParams struct { - // The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. - Edge *string `json:"Edge,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Edge of this Event. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. + Edge *string `json:"Edge,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEventParams) SetEdge(Edge string) *ListEventParams { - params.Edge = &Edge - return params +func (params *ListEventParams) SetEdge(Edge string) (*ListEventParams){ + params.Edge = &Edge + return params } -func (params *ListEventParams) SetPageSize(PageSize int) *ListEventParams { - params.PageSize = &PageSize - return params +func (params *ListEventParams) SetPageSize(PageSize int) (*ListEventParams){ + params.PageSize = &PageSize + return params } -func (params *ListEventParams) SetLimit(Limit int) *ListEventParams { - params.Limit = &Limit - return params +func (params *ListEventParams) SetLimit(Limit int) (*ListEventParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Event records from the API. Request is executed immediately. func (c *ApiService) PageEvent(CallSid string, params *ListEventParams, pageToken, pageNumber string) (*ListEventResponse, error) { - path := "/v1/Voice/{CallSid}/Events" + path := "/v1/Voice/{CallSid}/Events" - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Edge != nil { - data.Set("Edge", *params.Edge) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Edge != nil { + data.Set("Edge", *params.Edge) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Event records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -122,6 +122,7 @@ func (c *ApiService) StreamEvent(CallSid string, params *ListEventParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamEvent(response *ListEventResponse, params *ListEventParams, recordChannel chan InsightsV1Event, errorChannel chan error) { curRecord := 1 @@ -153,19 +154,20 @@ func (c *ApiService) streamEvent(response *ListEventResponse, params *ListEventP } func (c *ApiService) getNextListEventResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/voice_metrics.go b/rest/insights/v1/voice_metrics.go index d90683c0e..f89fce873 100644 --- a/rest/insights/v1/voice_metrics.go +++ b/rest/insights/v1/voice_metrics.go @@ -18,79 +18,79 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListMetric' type ListMetricParams struct { - // The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. - Edge *string `json:"Edge,omitempty"` - // The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. - Direction *string `json:"Direction,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`. + Edge *string `json:"Edge,omitempty"` + // The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`. + Direction *string `json:"Direction,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMetricParams) SetEdge(Edge string) *ListMetricParams { - params.Edge = &Edge - return params +func (params *ListMetricParams) SetEdge(Edge string) (*ListMetricParams){ + params.Edge = &Edge + return params } -func (params *ListMetricParams) SetDirection(Direction string) *ListMetricParams { - params.Direction = &Direction - return params +func (params *ListMetricParams) SetDirection(Direction string) (*ListMetricParams){ + params.Direction = &Direction + return params } -func (params *ListMetricParams) SetPageSize(PageSize int) *ListMetricParams { - params.PageSize = &PageSize - return params +func (params *ListMetricParams) SetPageSize(PageSize int) (*ListMetricParams){ + params.PageSize = &PageSize + return params } -func (params *ListMetricParams) SetLimit(Limit int) *ListMetricParams { - params.Limit = &Limit - return params +func (params *ListMetricParams) SetLimit(Limit int) (*ListMetricParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Metric records from the API. Request is executed immediately. func (c *ApiService) PageMetric(CallSid string, params *ListMetricParams, pageToken, pageNumber string) (*ListMetricResponse, error) { - path := "/v1/Voice/{CallSid}/Metrics" - - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Edge != nil { - data.Set("Edge", *params.Edge) - } - if params != nil && params.Direction != nil { - data.Set("Direction", *params.Direction) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMetricResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Voice/{CallSid}/Metrics" + + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Edge != nil { + data.Set("Edge", *params.Edge) + } + if params != nil && params.Direction != nil { + data.Set("Direction", *params.Direction) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMetricResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Metric records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -131,6 +131,7 @@ func (c *ApiService) StreamMetric(CallSid string, params *ListMetricParams) (cha return recordChannel, errorChannel } + func (c *ApiService) streamMetric(response *ListMetricResponse, params *ListMetricParams, recordChannel chan InsightsV1Metric, errorChannel chan error) { curRecord := 1 @@ -162,19 +163,20 @@ func (c *ApiService) streamMetric(response *ListMetricResponse, params *ListMetr } func (c *ApiService) getNextListMetricResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMetricResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMetricResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/voice_settings.go b/rest/insights/v1/voice_settings.go index 7376eff22..d126fcd63 100644 --- a/rest/insights/v1/voice_settings.go +++ b/rest/insights/v1/voice_settings.go @@ -18,96 +18,101 @@ import ( "encoding/json" "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchAccountSettings' type FetchAccountSettingsParams struct { - // The unique SID identifier of the Subaccount. - SubaccountSid *string `json:"SubaccountSid,omitempty"` + // The unique SID identifier of the Subaccount. + SubaccountSid *string `json:"SubaccountSid,omitempty"` } -func (params *FetchAccountSettingsParams) SetSubaccountSid(SubaccountSid string) *FetchAccountSettingsParams { - params.SubaccountSid = &SubaccountSid - return params +func (params *FetchAccountSettingsParams) SetSubaccountSid(SubaccountSid string) (*FetchAccountSettingsParams){ + params.SubaccountSid = &SubaccountSid + return params } // Get the Voice Insights Settings. func (c *ApiService) FetchAccountSettings(params *FetchAccountSettingsParams) (*InsightsV1AccountSettings, error) { - path := "/v1/Voice/Settings" + path := "/v1/Voice/Settings" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.SubaccountSid != nil { + data.Set("SubaccountSid", *params.SubaccountSid) + } - if params != nil && params.SubaccountSid != nil { - data.Set("SubaccountSid", *params.SubaccountSid) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &InsightsV1AccountSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &InsightsV1AccountSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateAccountSettings' type UpdateAccountSettingsParams struct { - // A boolean flag to enable Advanced Features for Voice Insights. - AdvancedFeatures *bool `json:"AdvancedFeatures,omitempty"` - // A boolean flag to enable Voice Trace. - VoiceTrace *bool `json:"VoiceTrace,omitempty"` - // The unique SID identifier of the Subaccount. - SubaccountSid *string `json:"SubaccountSid,omitempty"` + // A boolean flag to enable Advanced Features for Voice Insights. + AdvancedFeatures *bool `json:"AdvancedFeatures,omitempty"` + // A boolean flag to enable Voice Trace. + VoiceTrace *bool `json:"VoiceTrace,omitempty"` + // The unique SID identifier of the Subaccount. + SubaccountSid *string `json:"SubaccountSid,omitempty"` } -func (params *UpdateAccountSettingsParams) SetAdvancedFeatures(AdvancedFeatures bool) *UpdateAccountSettingsParams { - params.AdvancedFeatures = &AdvancedFeatures - return params +func (params *UpdateAccountSettingsParams) SetAdvancedFeatures(AdvancedFeatures bool) (*UpdateAccountSettingsParams){ + params.AdvancedFeatures = &AdvancedFeatures + return params } -func (params *UpdateAccountSettingsParams) SetVoiceTrace(VoiceTrace bool) *UpdateAccountSettingsParams { - params.VoiceTrace = &VoiceTrace - return params +func (params *UpdateAccountSettingsParams) SetVoiceTrace(VoiceTrace bool) (*UpdateAccountSettingsParams){ + params.VoiceTrace = &VoiceTrace + return params } -func (params *UpdateAccountSettingsParams) SetSubaccountSid(SubaccountSid string) *UpdateAccountSettingsParams { - params.SubaccountSid = &SubaccountSid - return params +func (params *UpdateAccountSettingsParams) SetSubaccountSid(SubaccountSid string) (*UpdateAccountSettingsParams){ + params.SubaccountSid = &SubaccountSid + return params } // Update a specific Voice Insights Setting. func (c *ApiService) UpdateAccountSettings(params *UpdateAccountSettingsParams) (*InsightsV1AccountSettings, error) { - path := "/v1/Voice/Settings" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AdvancedFeatures != nil { - data.Set("AdvancedFeatures", fmt.Sprint(*params.AdvancedFeatures)) - } - if params != nil && params.VoiceTrace != nil { - data.Set("VoiceTrace", fmt.Sprint(*params.VoiceTrace)) - } - if params != nil && params.SubaccountSid != nil { - data.Set("SubaccountSid", *params.SubaccountSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &InsightsV1AccountSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Voice/Settings" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AdvancedFeatures != nil { + data.Set("AdvancedFeatures", fmt.Sprint(*params.AdvancedFeatures)) + } + if params != nil && params.VoiceTrace != nil { + data.Set("VoiceTrace", fmt.Sprint(*params.VoiceTrace)) + } + if params != nil && params.SubaccountSid != nil { + data.Set("SubaccountSid", *params.SubaccountSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &InsightsV1AccountSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/insights/v1/voice_summaries.go b/rest/insights/v1/voice_summaries.go index 1eb0fd7f9..977c1575b 100644 --- a/rest/insights/v1/voice_summaries.go +++ b/rest/insights/v1/voice_summaries.go @@ -19,273 +19,275 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListCallSummaries' type ListCallSummariesParams struct { - // A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. - From *string `json:"From,omitempty"` - // A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. - To *string `json:"To,omitempty"` - // An origination carrier. - FromCarrier *string `json:"FromCarrier,omitempty"` - // A destination carrier. - ToCarrier *string `json:"ToCarrier,omitempty"` - // A source country code based on phone number in From. - FromCountryCode *string `json:"FromCountryCode,omitempty"` - // A destination country code. Based on phone number in To. - ToCountryCode *string `json:"ToCountryCode,omitempty"` - // A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. - Branded *bool `json:"Branded,omitempty"` - // A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. - VerifiedCaller *bool `json:"VerifiedCaller,omitempty"` - // A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). - HasTag *bool `json:"HasTag,omitempty"` - // A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. - StartTime *string `json:"StartTime,omitempty"` - // An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. - EndTime *string `json:"EndTime,omitempty"` - // A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. - CallType *string `json:"CallType,omitempty"` - // A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. - CallState *string `json:"CallState,omitempty"` - // A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. - Direction *string `json:"Direction,omitempty"` - // A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. - ProcessingState *string `json:"ProcessingState,omitempty"` - // A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. - SortBy *string `json:"SortBy,omitempty"` - // A unique SID identifier of a Subaccount. - Subaccount *string `json:"Subaccount,omitempty"` - // A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. - AbnormalSession *bool `json:"AbnormalSession,omitempty"` - // An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. - AnsweredBy *string `json:"AnsweredBy,omitempty"` - // Either machine or human. - AnsweredByAnnotation *string `json:"AnsweredByAnnotation,omitempty"` - // A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. - ConnectivityIssueAnnotation *string `json:"ConnectivityIssueAnnotation,omitempty"` - // A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. - QualityIssueAnnotation *string `json:"QualityIssueAnnotation,omitempty"` - // A boolean flag indicating spam calls. - SpamAnnotation *bool `json:"SpamAnnotation,omitempty"` - // A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. - CallScoreAnnotation *string `json:"CallScoreAnnotation,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListCallSummariesParams) SetFrom(From string) *ListCallSummariesParams { - params.From = &From - return params -} -func (params *ListCallSummariesParams) SetTo(To string) *ListCallSummariesParams { - params.To = &To - return params -} -func (params *ListCallSummariesParams) SetFromCarrier(FromCarrier string) *ListCallSummariesParams { - params.FromCarrier = &FromCarrier - return params -} -func (params *ListCallSummariesParams) SetToCarrier(ToCarrier string) *ListCallSummariesParams { - params.ToCarrier = &ToCarrier - return params -} -func (params *ListCallSummariesParams) SetFromCountryCode(FromCountryCode string) *ListCallSummariesParams { - params.FromCountryCode = &FromCountryCode - return params -} -func (params *ListCallSummariesParams) SetToCountryCode(ToCountryCode string) *ListCallSummariesParams { - params.ToCountryCode = &ToCountryCode - return params -} -func (params *ListCallSummariesParams) SetBranded(Branded bool) *ListCallSummariesParams { - params.Branded = &Branded - return params -} -func (params *ListCallSummariesParams) SetVerifiedCaller(VerifiedCaller bool) *ListCallSummariesParams { - params.VerifiedCaller = &VerifiedCaller - return params -} -func (params *ListCallSummariesParams) SetHasTag(HasTag bool) *ListCallSummariesParams { - params.HasTag = &HasTag - return params -} -func (params *ListCallSummariesParams) SetStartTime(StartTime string) *ListCallSummariesParams { - params.StartTime = &StartTime - return params -} -func (params *ListCallSummariesParams) SetEndTime(EndTime string) *ListCallSummariesParams { - params.EndTime = &EndTime - return params -} -func (params *ListCallSummariesParams) SetCallType(CallType string) *ListCallSummariesParams { - params.CallType = &CallType - return params -} -func (params *ListCallSummariesParams) SetCallState(CallState string) *ListCallSummariesParams { - params.CallState = &CallState - return params -} -func (params *ListCallSummariesParams) SetDirection(Direction string) *ListCallSummariesParams { - params.Direction = &Direction - return params -} -func (params *ListCallSummariesParams) SetProcessingState(ProcessingState string) *ListCallSummariesParams { - params.ProcessingState = &ProcessingState - return params -} -func (params *ListCallSummariesParams) SetSortBy(SortBy string) *ListCallSummariesParams { - params.SortBy = &SortBy - return params -} -func (params *ListCallSummariesParams) SetSubaccount(Subaccount string) *ListCallSummariesParams { - params.Subaccount = &Subaccount - return params -} -func (params *ListCallSummariesParams) SetAbnormalSession(AbnormalSession bool) *ListCallSummariesParams { - params.AbnormalSession = &AbnormalSession - return params -} -func (params *ListCallSummariesParams) SetAnsweredBy(AnsweredBy string) *ListCallSummariesParams { - params.AnsweredBy = &AnsweredBy - return params -} -func (params *ListCallSummariesParams) SetAnsweredByAnnotation(AnsweredByAnnotation string) *ListCallSummariesParams { - params.AnsweredByAnnotation = &AnsweredByAnnotation - return params -} -func (params *ListCallSummariesParams) SetConnectivityIssueAnnotation(ConnectivityIssueAnnotation string) *ListCallSummariesParams { - params.ConnectivityIssueAnnotation = &ConnectivityIssueAnnotation - return params -} -func (params *ListCallSummariesParams) SetQualityIssueAnnotation(QualityIssueAnnotation string) *ListCallSummariesParams { - params.QualityIssueAnnotation = &QualityIssueAnnotation - return params + // A calling party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. + From *string `json:"From,omitempty"` + // A called party. Could be an E.164 number, a SIP URI, or a Twilio Client registered name. + To *string `json:"To,omitempty"` + // An origination carrier. + FromCarrier *string `json:"FromCarrier,omitempty"` + // A destination carrier. + ToCarrier *string `json:"ToCarrier,omitempty"` + // A source country code based on phone number in From. + FromCountryCode *string `json:"FromCountryCode,omitempty"` + // A destination country code. Based on phone number in To. + ToCountryCode *string `json:"ToCountryCode,omitempty"` + // A boolean flag indicating whether or not the calls were branded using Twilio Branded Calls. + Branded *bool `json:"Branded,omitempty"` + // A boolean flag indicating whether or not the caller was verified using SHAKEN/STIR. + VerifiedCaller *bool `json:"VerifiedCaller,omitempty"` + // A boolean flag indicating the presence of one or more [Voice Insights Call Tags](https://www.twilio.com/docs/voice/voice-insights/api/call/details-call-tags). + HasTag *bool `json:"HasTag,omitempty"` + // A Start time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 4h. + StartTime *string `json:"StartTime,omitempty"` + // An End Time of the calls. xm (x minutes), xh (x hours), xd (x days), 1w, 30m, 3d, 4w or datetime-ISO. Defaults to 0m. + EndTime *string `json:"EndTime,omitempty"` + // A Call Type of the calls. One of `carrier`, `sip`, `trunking` or `client`. + CallType *string `json:"CallType,omitempty"` + // A Call State of the calls. One of `ringing`, `completed`, `busy`, `fail`, `noanswer`, `canceled`, `answered`, `undialed`. + CallState *string `json:"CallState,omitempty"` + // A Direction of the calls. One of `outbound_api`, `outbound_dial`, `inbound`, `trunking_originating`, `trunking_terminating`. + Direction *string `json:"Direction,omitempty"` + // A Processing State of the Call Summaries. One of `completed`, `partial` or `all`. + ProcessingState *string `json:"ProcessingState,omitempty"` + // A Sort By criterion for the returned list of Call Summaries. One of `start_time` or `end_time`. + SortBy *string `json:"SortBy,omitempty"` + // A unique SID identifier of a Subaccount. + Subaccount *string `json:"Subaccount,omitempty"` + // A boolean flag indicating an abnormal session where the last SIP response was not 200 OK. + AbnormalSession *bool `json:"AbnormalSession,omitempty"` + // An Answered By value for the calls based on `Answering Machine Detection (AMD)`. One of `unknown`, `machine_start`, `machine_end_beep`, `machine_end_silence`, `machine_end_other`, `human` or `fax`. + AnsweredBy *string `json:"AnsweredBy,omitempty"` + // Either machine or human. + AnsweredByAnnotation *string `json:"AnsweredByAnnotation,omitempty"` + // A Connectivity Issue with the calls. One of `no_connectivity_issue`, `invalid_number`, `caller_id`, `dropped_call`, or `number_reachability`. + ConnectivityIssueAnnotation *string `json:"ConnectivityIssueAnnotation,omitempty"` + // A subjective Quality Issue with the calls. One of `no_quality_issue`, `low_volume`, `choppy_robotic`, `echo`, `dtmf`, `latency`, `owa`, `static_noise`. + QualityIssueAnnotation *string `json:"QualityIssueAnnotation,omitempty"` + // A boolean flag indicating spam calls. + SpamAnnotation *bool `json:"SpamAnnotation,omitempty"` + // A Call Score of the calls. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for the rated call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + CallScoreAnnotation *string `json:"CallScoreAnnotation,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListCallSummariesParams) SetFrom(From string) (*ListCallSummariesParams){ + params.From = &From + return params +} +func (params *ListCallSummariesParams) SetTo(To string) (*ListCallSummariesParams){ + params.To = &To + return params +} +func (params *ListCallSummariesParams) SetFromCarrier(FromCarrier string) (*ListCallSummariesParams){ + params.FromCarrier = &FromCarrier + return params +} +func (params *ListCallSummariesParams) SetToCarrier(ToCarrier string) (*ListCallSummariesParams){ + params.ToCarrier = &ToCarrier + return params +} +func (params *ListCallSummariesParams) SetFromCountryCode(FromCountryCode string) (*ListCallSummariesParams){ + params.FromCountryCode = &FromCountryCode + return params +} +func (params *ListCallSummariesParams) SetToCountryCode(ToCountryCode string) (*ListCallSummariesParams){ + params.ToCountryCode = &ToCountryCode + return params +} +func (params *ListCallSummariesParams) SetBranded(Branded bool) (*ListCallSummariesParams){ + params.Branded = &Branded + return params +} +func (params *ListCallSummariesParams) SetVerifiedCaller(VerifiedCaller bool) (*ListCallSummariesParams){ + params.VerifiedCaller = &VerifiedCaller + return params +} +func (params *ListCallSummariesParams) SetHasTag(HasTag bool) (*ListCallSummariesParams){ + params.HasTag = &HasTag + return params +} +func (params *ListCallSummariesParams) SetStartTime(StartTime string) (*ListCallSummariesParams){ + params.StartTime = &StartTime + return params +} +func (params *ListCallSummariesParams) SetEndTime(EndTime string) (*ListCallSummariesParams){ + params.EndTime = &EndTime + return params +} +func (params *ListCallSummariesParams) SetCallType(CallType string) (*ListCallSummariesParams){ + params.CallType = &CallType + return params +} +func (params *ListCallSummariesParams) SetCallState(CallState string) (*ListCallSummariesParams){ + params.CallState = &CallState + return params +} +func (params *ListCallSummariesParams) SetDirection(Direction string) (*ListCallSummariesParams){ + params.Direction = &Direction + return params } -func (params *ListCallSummariesParams) SetSpamAnnotation(SpamAnnotation bool) *ListCallSummariesParams { - params.SpamAnnotation = &SpamAnnotation - return params +func (params *ListCallSummariesParams) SetProcessingState(ProcessingState string) (*ListCallSummariesParams){ + params.ProcessingState = &ProcessingState + return params } -func (params *ListCallSummariesParams) SetCallScoreAnnotation(CallScoreAnnotation string) *ListCallSummariesParams { - params.CallScoreAnnotation = &CallScoreAnnotation - return params +func (params *ListCallSummariesParams) SetSortBy(SortBy string) (*ListCallSummariesParams){ + params.SortBy = &SortBy + return params } -func (params *ListCallSummariesParams) SetPageSize(PageSize int) *ListCallSummariesParams { - params.PageSize = &PageSize - return params +func (params *ListCallSummariesParams) SetSubaccount(Subaccount string) (*ListCallSummariesParams){ + params.Subaccount = &Subaccount + return params } -func (params *ListCallSummariesParams) SetLimit(Limit int) *ListCallSummariesParams { - params.Limit = &Limit - return params +func (params *ListCallSummariesParams) SetAbnormalSession(AbnormalSession bool) (*ListCallSummariesParams){ + params.AbnormalSession = &AbnormalSession + return params +} +func (params *ListCallSummariesParams) SetAnsweredBy(AnsweredBy string) (*ListCallSummariesParams){ + params.AnsweredBy = &AnsweredBy + return params +} +func (params *ListCallSummariesParams) SetAnsweredByAnnotation(AnsweredByAnnotation string) (*ListCallSummariesParams){ + params.AnsweredByAnnotation = &AnsweredByAnnotation + return params +} +func (params *ListCallSummariesParams) SetConnectivityIssueAnnotation(ConnectivityIssueAnnotation string) (*ListCallSummariesParams){ + params.ConnectivityIssueAnnotation = &ConnectivityIssueAnnotation + return params +} +func (params *ListCallSummariesParams) SetQualityIssueAnnotation(QualityIssueAnnotation string) (*ListCallSummariesParams){ + params.QualityIssueAnnotation = &QualityIssueAnnotation + return params +} +func (params *ListCallSummariesParams) SetSpamAnnotation(SpamAnnotation bool) (*ListCallSummariesParams){ + params.SpamAnnotation = &SpamAnnotation + return params +} +func (params *ListCallSummariesParams) SetCallScoreAnnotation(CallScoreAnnotation string) (*ListCallSummariesParams){ + params.CallScoreAnnotation = &CallScoreAnnotation + return params +} +func (params *ListCallSummariesParams) SetPageSize(PageSize int) (*ListCallSummariesParams){ + params.PageSize = &PageSize + return params +} +func (params *ListCallSummariesParams) SetLimit(Limit int) (*ListCallSummariesParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CallSummaries records from the API. Request is executed immediately. func (c *ApiService) PageCallSummaries(params *ListCallSummariesParams, pageToken, pageNumber string) (*ListCallSummariesResponse, error) { - path := "/v1/Voice/Summaries" + path := "/v1/Voice/Summaries" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.FromCarrier != nil { - data.Set("FromCarrier", *params.FromCarrier) - } - if params != nil && params.ToCarrier != nil { - data.Set("ToCarrier", *params.ToCarrier) - } - if params != nil && params.FromCountryCode != nil { - data.Set("FromCountryCode", *params.FromCountryCode) - } - if params != nil && params.ToCountryCode != nil { - data.Set("ToCountryCode", *params.ToCountryCode) - } - if params != nil && params.Branded != nil { - data.Set("Branded", fmt.Sprint(*params.Branded)) - } - if params != nil && params.VerifiedCaller != nil { - data.Set("VerifiedCaller", fmt.Sprint(*params.VerifiedCaller)) - } - if params != nil && params.HasTag != nil { - data.Set("HasTag", fmt.Sprint(*params.HasTag)) - } - if params != nil && params.StartTime != nil { - data.Set("StartTime", *params.StartTime) - } - if params != nil && params.EndTime != nil { - data.Set("EndTime", *params.EndTime) - } - if params != nil && params.CallType != nil { - data.Set("CallType", *params.CallType) - } - if params != nil && params.CallState != nil { - data.Set("CallState", *params.CallState) - } - if params != nil && params.Direction != nil { - data.Set("Direction", *params.Direction) - } - if params != nil && params.ProcessingState != nil { - data.Set("ProcessingState", *params.ProcessingState) - } - if params != nil && params.SortBy != nil { - data.Set("SortBy", *params.SortBy) - } - if params != nil && params.Subaccount != nil { - data.Set("Subaccount", *params.Subaccount) - } - if params != nil && params.AbnormalSession != nil { - data.Set("AbnormalSession", fmt.Sprint(*params.AbnormalSession)) - } - if params != nil && params.AnsweredBy != nil { - data.Set("AnsweredBy", *params.AnsweredBy) - } - if params != nil && params.AnsweredByAnnotation != nil { - data.Set("AnsweredByAnnotation", *params.AnsweredByAnnotation) - } - if params != nil && params.ConnectivityIssueAnnotation != nil { - data.Set("ConnectivityIssueAnnotation", *params.ConnectivityIssueAnnotation) - } - if params != nil && params.QualityIssueAnnotation != nil { - data.Set("QualityIssueAnnotation", *params.QualityIssueAnnotation) - } - if params != nil && params.SpamAnnotation != nil { - data.Set("SpamAnnotation", fmt.Sprint(*params.SpamAnnotation)) - } - if params != nil && params.CallScoreAnnotation != nil { - data.Set("CallScoreAnnotation", *params.CallScoreAnnotation) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.FromCarrier != nil { + data.Set("FromCarrier", *params.FromCarrier) + } + if params != nil && params.ToCarrier != nil { + data.Set("ToCarrier", *params.ToCarrier) + } + if params != nil && params.FromCountryCode != nil { + data.Set("FromCountryCode", *params.FromCountryCode) + } + if params != nil && params.ToCountryCode != nil { + data.Set("ToCountryCode", *params.ToCountryCode) + } + if params != nil && params.Branded != nil { + data.Set("Branded", fmt.Sprint(*params.Branded)) + } + if params != nil && params.VerifiedCaller != nil { + data.Set("VerifiedCaller", fmt.Sprint(*params.VerifiedCaller)) + } + if params != nil && params.HasTag != nil { + data.Set("HasTag", fmt.Sprint(*params.HasTag)) + } + if params != nil && params.StartTime != nil { + data.Set("StartTime", *params.StartTime) + } + if params != nil && params.EndTime != nil { + data.Set("EndTime", *params.EndTime) + } + if params != nil && params.CallType != nil { + data.Set("CallType", *params.CallType) + } + if params != nil && params.CallState != nil { + data.Set("CallState", *params.CallState) + } + if params != nil && params.Direction != nil { + data.Set("Direction", *params.Direction) + } + if params != nil && params.ProcessingState != nil { + data.Set("ProcessingState", *params.ProcessingState) + } + if params != nil && params.SortBy != nil { + data.Set("SortBy", *params.SortBy) + } + if params != nil && params.Subaccount != nil { + data.Set("Subaccount", *params.Subaccount) + } + if params != nil && params.AbnormalSession != nil { + data.Set("AbnormalSession", fmt.Sprint(*params.AbnormalSession)) + } + if params != nil && params.AnsweredBy != nil { + data.Set("AnsweredBy", *params.AnsweredBy) + } + if params != nil && params.AnsweredByAnnotation != nil { + data.Set("AnsweredByAnnotation", *params.AnsweredByAnnotation) + } + if params != nil && params.ConnectivityIssueAnnotation != nil { + data.Set("ConnectivityIssueAnnotation", *params.ConnectivityIssueAnnotation) + } + if params != nil && params.QualityIssueAnnotation != nil { + data.Set("QualityIssueAnnotation", *params.QualityIssueAnnotation) + } + if params != nil && params.SpamAnnotation != nil { + data.Set("SpamAnnotation", fmt.Sprint(*params.SpamAnnotation)) + } + if params != nil && params.CallScoreAnnotation != nil { + data.Set("CallScoreAnnotation", *params.CallScoreAnnotation) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCallSummariesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCallSummariesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CallSummaries records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -326,6 +328,7 @@ func (c *ApiService) StreamCallSummaries(params *ListCallSummariesParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamCallSummaries(response *ListCallSummariesResponse, params *ListCallSummariesParams, recordChannel chan InsightsV1CallSummaries, errorChannel chan error) { curRecord := 1 @@ -357,19 +360,20 @@ func (c *ApiService) streamCallSummaries(response *ListCallSummariesResponse, pa } func (c *ApiService) getNextListCallSummariesResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCallSummariesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListCallSummariesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/insights/v1/voice_summary.go b/rest/insights/v1/voice_summary.go index bd66f3148..a81a0c191 100644 --- a/rest/insights/v1/voice_summary.go +++ b/rest/insights/v1/voice_summary.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchSummary' type FetchSummaryParams struct { - // The Processing State of this Call Summary. One of `complete`, `partial` or `all`. - ProcessingState *string `json:"ProcessingState,omitempty"` + // The Processing State of this Call Summary. One of `complete`, `partial` or `all`. + ProcessingState *string `json:"ProcessingState,omitempty"` } -func (params *FetchSummaryParams) SetProcessingState(ProcessingState string) *FetchSummaryParams { - params.ProcessingState = &ProcessingState - return params +func (params *FetchSummaryParams) SetProcessingState(ProcessingState string) (*FetchSummaryParams){ + params.ProcessingState = &ProcessingState + return params } // Get a specific Call Summary. func (c *ApiService) FetchSummary(CallSid string, params *FetchSummaryParams) (*InsightsV1Summary, error) { - path := "/v1/Voice/{CallSid}/Summary" - path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + path := "/v1/Voice/{CallSid}/Summary" + path = strings.Replace(path, "{"+"CallSid"+"}", CallSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.ProcessingState != nil { + data.Set("ProcessingState", *params.ProcessingState) + } - if params != nil && params.ProcessingState != nil { - data.Set("ProcessingState", *params.ProcessingState) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &InsightsV1Summary{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &InsightsV1Summary{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/intelligence/v2/README.md b/rest/intelligence/v2/README.md index d8f104b6d..4d452dc98 100644 --- a/rest/intelligence/v2/README.md +++ b/rest/intelligence/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/intelligence/v2/api_service.go b/rest/intelligence/v2/api_service.go index 628737e86..fbee3e436 100644 --- a/rest/intelligence/v2/api_service.go +++ b/rest/intelligence/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://intelligence.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/intelligence/v2/docs/IntelligenceV2OperatorResult.md b/rest/intelligence/v2/docs/IntelligenceV2OperatorResult.md index 7a13d6f54..bb7a95b6a 100644 --- a/rest/intelligence/v2/docs/IntelligenceV2OperatorResult.md +++ b/rest/intelligence/v2/docs/IntelligenceV2OperatorResult.md @@ -16,7 +16,6 @@ Name | Type | Description | Notes **PredictedProbability** | Pointer to **float32** | Percentage of 'matching' class needed to consider a sentence matches. | **LabelProbabilities** | Pointer to **interface{}** | The labels probabilities. This might be available on conversation classify model outputs. | **ExtractResults** | Pointer to **interface{}** | List of text extraction results. This might be available on classify-extract model outputs. | -**TextGenerationResults** | Pointer to **interface{}** | Output of a text generation operator for example Conversation Sumamary. | **TranscriptSid** | Pointer to **string** | A 34 character string that uniquely identifies this Transcript. | **Url** | Pointer to **string** | The URL of this resource. | diff --git a/rest/intelligence/v2/docs/ListOperatorResultResponseMeta.md b/rest/intelligence/v2/docs/ListOperatorResultResponseMeta.md index 7c91b03f2..f0dbaff2c 100644 --- a/rest/intelligence/v2/docs/ListOperatorResultResponseMeta.md +++ b/rest/intelligence/v2/docs/ListOperatorResultResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/intelligence/v2/docs/TranscriptsApi.md b/rest/intelligence/v2/docs/TranscriptsApi.md index d6a373fab..6066607ba 100644 --- a/rest/intelligence/v2/docs/TranscriptsApi.md +++ b/rest/intelligence/v2/docs/TranscriptsApi.md @@ -97,7 +97,7 @@ Name | Type | Description ## FetchTranscript -> IntelligenceV2Transcript FetchTranscript(ctx, Sid) +> IntelligenceV2Transcript FetchTranscript(ctx, Sidoptional) @@ -118,6 +118,7 @@ Other parameters are passed through a pointer to a FetchTranscriptParams struct Name | Type | Description ------------- | ------------- | ------------- +**Redacted** | **bool** | Grant access to PII Redacted/Unredacted Transcript. The default is `true` to access redacted Transcript. ### Return type diff --git a/rest/intelligence/v2/docs/TranscriptsMediaApi.md b/rest/intelligence/v2/docs/TranscriptsMediaApi.md index a6529f87d..eaa53ddf4 100644 --- a/rest/intelligence/v2/docs/TranscriptsMediaApi.md +++ b/rest/intelligence/v2/docs/TranscriptsMediaApi.md @@ -31,7 +31,7 @@ Other parameters are passed through a pointer to a FetchMediaParams struct Name | Type | Description ------------- | ------------- | ------------- -**Redacted** | **bool** | Grant access to PII Redacted/Unredacted Media. If redaction is enabled, the default is `true` to access redacted media. +**Redacted** | **bool** | Grant access to PII Redacted/Unredacted Media. The default is `true` to access redacted media. ### Return type diff --git a/rest/intelligence/v2/docs/TranscriptsOperatorResultsApi.md b/rest/intelligence/v2/docs/TranscriptsOperatorResultsApi.md index 817db601c..0a6a70b1c 100644 --- a/rest/intelligence/v2/docs/TranscriptsOperatorResultsApi.md +++ b/rest/intelligence/v2/docs/TranscriptsOperatorResultsApi.md @@ -33,7 +33,7 @@ Other parameters are passed through a pointer to a FetchOperatorResultParams str Name | Type | Description ------------- | ------------- | ------------- -**Redacted** | **bool** | Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. +**Redacted** | **bool** | Grant access to PII redacted/unredacted Language Understanding operator. The default is True. ### Return type @@ -76,7 +76,7 @@ Other parameters are passed through a pointer to a ListOperatorResultParams stru Name | Type | Description ------------- | ------------- | ------------- -**Redacted** | **bool** | Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. +**Redacted** | **bool** | Grant access to PII redacted/unredacted Language Understanding operator. The default is True. **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. **Limit** | **int** | Max number of records to return. diff --git a/rest/intelligence/v2/docs/TranscriptsSentencesApi.md b/rest/intelligence/v2/docs/TranscriptsSentencesApi.md index c02310fc0..4643f04d7 100644 --- a/rest/intelligence/v2/docs/TranscriptsSentencesApi.md +++ b/rest/intelligence/v2/docs/TranscriptsSentencesApi.md @@ -31,7 +31,7 @@ Other parameters are passed through a pointer to a ListSentenceParams struct Name | Type | Description ------------- | ------------- | ------------- -**Redacted** | **bool** | Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. +**Redacted** | **bool** | Grant access to PII Redacted/Unredacted Sentences. The default is `true` to access redacted sentences. **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. **Limit** | **int** | Max number of records to return. diff --git a/rest/intelligence/v2/model_intelligence_v2_media.go b/rest/intelligence/v2/model_intelligence_v2_media.go index 17c0447e8..4eb45aaa0 100644 --- a/rest/intelligence/v2/model_intelligence_v2_media.go +++ b/rest/intelligence/v2/model_intelligence_v2_media.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // IntelligenceV2Media struct for IntelligenceV2Media type IntelligenceV2Media struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // Downloadable URL for media, if stored in Twilio AI. + // Downloadable URL for media, if stored in Twilio AI. MediaUrl *string `json:"media_url,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The unique SID identifier of the Transcript. + // The unique SID identifier of the Transcript. Sid *string `json:"sid,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/intelligence/v2/model_intelligence_v2_operator_result.go b/rest/intelligence/v2/model_intelligence_v2_operator_result.go index 283506117..dfbabfdc6 100644 --- a/rest/intelligence/v2/model_intelligence_v2_operator_result.go +++ b/rest/intelligence/v2/model_intelligence_v2_operator_result.go @@ -13,63 +13,57 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // IntelligenceV2OperatorResult struct for IntelligenceV2OperatorResult type IntelligenceV2OperatorResult struct { OperatorType *string `json:"operator_type,omitempty"` - // The name of the applied Language Understanding. + // The name of the applied Language Understanding. Name *string `json:"name,omitempty"` - // A 34 character string that identifies this Language Understanding operator sid. + // A 34 character string that identifies this Language Understanding operator sid. OperatorSid *string `json:"operator_sid,omitempty"` - // Boolean to tell if extract Language Understanding Processing model matches results. + // Boolean to tell if extract Language Understanding Processing model matches results. ExtractMatch *bool `json:"extract_match,omitempty"` - // Percentage of 'matching' class needed to consider a sentence matches + // Percentage of 'matching' class needed to consider a sentence matches MatchProbability *float32 `json:"match_probability,omitempty"` - // Normalized output of extraction stage which matches Label. + // Normalized output of extraction stage which matches Label. NormalizedResult *string `json:"normalized_result,omitempty"` - // List of mapped utterance object which matches sentences. + // List of mapped utterance object which matches sentences. UtteranceResults *[]interface{} `json:"utterance_results,omitempty"` - // Boolean to tell if Utterance matches results. + // Boolean to tell if Utterance matches results. UtteranceMatch *bool `json:"utterance_match,omitempty"` - // The 'matching' class. This might be available on conversation classify model outputs. + // The 'matching' class. This might be available on conversation classify model outputs. PredictedLabel *string `json:"predicted_label,omitempty"` - // Percentage of 'matching' class needed to consider a sentence matches. + // Percentage of 'matching' class needed to consider a sentence matches. PredictedProbability *float32 `json:"predicted_probability,omitempty"` - // The labels probabilities. This might be available on conversation classify model outputs. + // The labels probabilities. This might be available on conversation classify model outputs. LabelProbabilities *interface{} `json:"label_probabilities,omitempty"` - // List of text extraction results. This might be available on classify-extract model outputs. + // List of text extraction results. This might be available on classify-extract model outputs. ExtractResults *interface{} `json:"extract_results,omitempty"` - // Output of a text generation operator for example Conversation Sumamary. - TextGenerationResults *interface{} `json:"text_generation_results,omitempty"` - // A 34 character string that uniquely identifies this Transcript. + // A 34 character string that uniquely identifies this Transcript. TranscriptSid *string `json:"transcript_sid,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } func (response *IntelligenceV2OperatorResult) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - OperatorType *string `json:"operator_type"` - Name *string `json:"name"` - OperatorSid *string `json:"operator_sid"` - ExtractMatch *bool `json:"extract_match"` - MatchProbability *interface{} `json:"match_probability"` - NormalizedResult *string `json:"normalized_result"` - UtteranceResults *[]interface{} `json:"utterance_results"` - UtteranceMatch *bool `json:"utterance_match"` - PredictedLabel *string `json:"predicted_label"` - PredictedProbability *interface{} `json:"predicted_probability"` - LabelProbabilities *interface{} `json:"label_probabilities"` - ExtractResults *interface{} `json:"extract_results"` - TextGenerationResults *interface{} `json:"text_generation_results"` - TranscriptSid *string `json:"transcript_sid"` - Url *string `json:"url"` + OperatorType *string `json:"operator_type"` + Name *string `json:"name"` + OperatorSid *string `json:"operator_sid"` + ExtractMatch *bool `json:"extract_match"` + MatchProbability *interface{} `json:"match_probability"` + NormalizedResult *string `json:"normalized_result"` + UtteranceResults *[]interface{} `json:"utterance_results"` + UtteranceMatch *bool `json:"utterance_match"` + PredictedLabel *string `json:"predicted_label"` + PredictedProbability *interface{} `json:"predicted_probability"` + LabelProbabilities *interface{} `json:"label_probabilities"` + ExtractResults *interface{} `json:"extract_results"` + TranscriptSid *string `json:"transcript_sid"` + Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -77,19 +71,18 @@ func (response *IntelligenceV2OperatorResult) UnmarshalJSON(bytes []byte) (err e } *response = IntelligenceV2OperatorResult{ - OperatorType: raw.OperatorType, - Name: raw.Name, - OperatorSid: raw.OperatorSid, - ExtractMatch: raw.ExtractMatch, - NormalizedResult: raw.NormalizedResult, - UtteranceResults: raw.UtteranceResults, - UtteranceMatch: raw.UtteranceMatch, - PredictedLabel: raw.PredictedLabel, - LabelProbabilities: raw.LabelProbabilities, - ExtractResults: raw.ExtractResults, - TextGenerationResults: raw.TextGenerationResults, - TranscriptSid: raw.TranscriptSid, - Url: raw.Url, + OperatorType: raw.OperatorType, + Name: raw.Name, + OperatorSid: raw.OperatorSid, + ExtractMatch: raw.ExtractMatch, + NormalizedResult: raw.NormalizedResult, + UtteranceResults: raw.UtteranceResults, + UtteranceMatch: raw.UtteranceMatch, + PredictedLabel: raw.PredictedLabel, + LabelProbabilities: raw.LabelProbabilities, + ExtractResults: raw.ExtractResults, + TranscriptSid: raw.TranscriptSid, + Url: raw.Url, } responseMatchProbability, err := client.UnmarshalFloat32(raw.MatchProbability) @@ -106,3 +99,4 @@ func (response *IntelligenceV2OperatorResult) UnmarshalJSON(bytes []byte) (err e return } + diff --git a/rest/intelligence/v2/model_intelligence_v2_sentence.go b/rest/intelligence/v2/model_intelligence_v2_sentence.go index 7d62f74ef..6c5b77789 100644 --- a/rest/intelligence/v2/model_intelligence_v2_sentence.go +++ b/rest/intelligence/v2/model_intelligence_v2_sentence.go @@ -13,39 +13,36 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // IntelligenceV2Sentence struct for IntelligenceV2Sentence type IntelligenceV2Sentence struct { - // The channel number. + // The channel number. MediaChannel *int `json:"media_channel,omitempty"` - // The index of the sentence in the transcript. + // The index of the sentence in the transcript. SentenceIndex *int `json:"sentence_index,omitempty"` - // Offset from the beginning of the transcript when this sentence starts. + // Offset from the beginning of the transcript when this sentence starts. StartTime *float32 `json:"start_time,omitempty"` - // Offset from the beginning of the transcript when this sentence ends. + // Offset from the beginning of the transcript when this sentence ends. EndTime *float32 `json:"end_time,omitempty"` - // Transcript text. + // Transcript text. Transcript *string `json:"transcript,omitempty"` - // A 34 character string that uniquely identifies this Sentence. - Sid *string `json:"sid,omitempty"` + // A 34 character string that uniquely identifies this Sentence. + Sid *string `json:"sid,omitempty"` Confidence *float32 `json:"confidence,omitempty"` } func (response *IntelligenceV2Sentence) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - MediaChannel *int `json:"media_channel"` - SentenceIndex *int `json:"sentence_index"` - StartTime *interface{} `json:"start_time"` - EndTime *interface{} `json:"end_time"` - Transcript *string `json:"transcript"` - Sid *string `json:"sid"` - Confidence *interface{} `json:"confidence"` + MediaChannel *int `json:"media_channel"` + SentenceIndex *int `json:"sentence_index"` + StartTime *interface{} `json:"start_time"` + EndTime *interface{} `json:"end_time"` + Transcript *string `json:"transcript"` + Sid *string `json:"sid"` + Confidence *interface{} `json:"confidence"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -53,10 +50,10 @@ func (response *IntelligenceV2Sentence) UnmarshalJSON(bytes []byte) (err error) } *response = IntelligenceV2Sentence{ - MediaChannel: raw.MediaChannel, + MediaChannel: raw.MediaChannel, SentenceIndex: raw.SentenceIndex, - Transcript: raw.Transcript, - Sid: raw.Sid, + Transcript: raw.Transcript, + Sid: raw.Sid, } responseStartTime, err := client.UnmarshalFloat32(raw.StartTime) @@ -79,3 +76,4 @@ func (response *IntelligenceV2Sentence) UnmarshalJSON(bytes []byte) (err error) return } + diff --git a/rest/intelligence/v2/model_intelligence_v2_service.go b/rest/intelligence/v2/model_intelligence_v2_service.go index e382e60f6..a74f77aa0 100644 --- a/rest/intelligence/v2/model_intelligence_v2_service.go +++ b/rest/intelligence/v2/model_intelligence_v2_service.go @@ -13,40 +13,42 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IntelligenceV2Service struct for IntelligenceV2Service type IntelligenceV2Service struct { - // The unique SID identifier of the Account the Service belongs to. + // The unique SID identifier of the Account the Service belongs to. AccountSid *string `json:"account_sid,omitempty"` - // Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. + // Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. AutoRedaction *bool `json:"auto_redaction,omitempty"` - // Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. + // Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. MediaRedaction *bool `json:"media_redaction,omitempty"` - // Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. + // Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. AutoTranscribe *bool `json:"auto_transcribe,omitempty"` - // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. + // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. DataLogging *bool `json:"data_logging,omitempty"` - // The date that this Service was created, given in ISO 8601 format. + // The date that this Service was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Service was updated, given in ISO 8601 format. + // The date that this Service was updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // A human readable description of this resource, up to 64 characters. + // A human readable description of this resource, up to 64 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // The default language code of the audio. + // The default language code of the audio. LanguageCode *string `json:"language_code,omitempty"` - // A 34 character string that uniquely identifies this Service. + // A 34 character string that uniquely identifies this Service. Sid *string `json:"sid,omitempty"` - // Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. + // Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. UniqueName *string `json:"unique_name,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // The URL Twilio will request when executing the Webhook. - WebhookUrl *string `json:"webhook_url,omitempty"` + // The URL Twilio will request when executing the Webhook. + WebhookUrl *string `json:"webhook_url,omitempty"` WebhookHttpMethod *string `json:"webhook_http_method,omitempty"` - // The version number of this Service. + // The version number of this Service. Version *int `json:"version,omitempty"` } + + diff --git a/rest/intelligence/v2/model_intelligence_v2_transcript.go b/rest/intelligence/v2/model_intelligence_v2_transcript.go index 610be4bf3..8d0a9532a 100644 --- a/rest/intelligence/v2/model_intelligence_v2_transcript.go +++ b/rest/intelligence/v2/model_intelligence_v2_transcript.go @@ -13,38 +13,40 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IntelligenceV2Transcript struct for IntelligenceV2Transcript type IntelligenceV2Transcript struct { - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // A 34 character string that uniquely identifies this Transcript. + // A 34 character string that uniquely identifies this Transcript. Sid *string `json:"sid,omitempty"` - // The date that this Transcript was created, given in ISO 8601 format. + // The date that this Transcript was created, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Transcript was updated, given in ISO 8601 format. + // The date that this Transcript was updated, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` - Status *string `json:"status,omitempty"` - // Media Channel describing Transcript Source and Participant Mapping + Status *string `json:"status,omitempty"` + // Media Channel describing Transcript Source and Participant Mapping Channel *interface{} `json:"channel,omitempty"` - // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. + // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. DataLogging *bool `json:"data_logging,omitempty"` - // The default language code of the audio. + // The default language code of the audio. LanguageCode *string `json:"language_code,omitempty"` - CustomerKey *string `json:"customer_key,omitempty"` - // The date that this Transcript's media was started, given in ISO 8601 format. + CustomerKey *string `json:"customer_key,omitempty"` + // The date that this Transcript's media was started, given in ISO 8601 format. MediaStartTime *time.Time `json:"media_start_time,omitempty"` - // The duration of this Transcript's source + // The duration of this Transcript's source Duration *int `json:"duration,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // If the transcript has been redacted, a redacted alternative of the transcript will be available. - Redaction *bool `json:"redaction,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + // If the transcript has been redacted, a redacted alternative of the transcript will be available. + Redaction *bool `json:"redaction,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/intelligence/v2/model_list_operator_result_response.go b/rest/intelligence/v2/model_list_operator_result_response.go index 025f76bdf..c11c3b7e7 100644 --- a/rest/intelligence/v2/model_list_operator_result_response.go +++ b/rest/intelligence/v2/model_list_operator_result_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListOperatorResultResponse struct for ListOperatorResultResponse type ListOperatorResultResponse struct { OperatorResults []IntelligenceV2OperatorResult `json:"operator_results,omitempty"` - Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` + Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/intelligence/v2/model_list_operator_result_response_meta.go b/rest/intelligence/v2/model_list_operator_result_response_meta.go index d9445c31c..9c596ae38 100644 --- a/rest/intelligence/v2/model_list_operator_result_response_meta.go +++ b/rest/intelligence/v2/model_list_operator_result_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListOperatorResultResponseMeta struct for ListOperatorResultResponseMeta type ListOperatorResultResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/intelligence/v2/model_list_sentence_response.go b/rest/intelligence/v2/model_list_sentence_response.go index 36cda46f4..1a74c9048 100644 --- a/rest/intelligence/v2/model_list_sentence_response.go +++ b/rest/intelligence/v2/model_list_sentence_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSentenceResponse struct for ListSentenceResponse type ListSentenceResponse struct { - Sentences []IntelligenceV2Sentence `json:"sentences,omitempty"` - Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` + Sentences []IntelligenceV2Sentence `json:"sentences,omitempty"` + Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/intelligence/v2/model_list_service_response.go b/rest/intelligence/v2/model_list_service_response.go index 738d42a07..43134e33d 100644 --- a/rest/intelligence/v2/model_list_service_response.go +++ b/rest/intelligence/v2/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []IntelligenceV2Service `json:"services,omitempty"` - Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` + Services []IntelligenceV2Service `json:"services,omitempty"` + Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/intelligence/v2/model_list_transcript_response.go b/rest/intelligence/v2/model_list_transcript_response.go index 0c70960ca..e725ad11f 100644 --- a/rest/intelligence/v2/model_list_transcript_response.go +++ b/rest/intelligence/v2/model_list_transcript_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTranscriptResponse struct for ListTranscriptResponse type ListTranscriptResponse struct { - Transcripts []IntelligenceV2Transcript `json:"transcripts,omitempty"` - Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` + Transcripts []IntelligenceV2Transcript `json:"transcripts,omitempty"` + Meta ListOperatorResultResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/intelligence/v2/services.go b/rest/intelligence/v2/services.go index 92c78a929..dc2354763 100644 --- a/rest/intelligence/v2/services.go +++ b/rest/intelligence/v2/services.go @@ -18,209 +18,215 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. - UniqueName *string `json:"UniqueName,omitempty"` - // Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. - AutoTranscribe *bool `json:"AutoTranscribe,omitempty"` - // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. - DataLogging *bool `json:"DataLogging,omitempty"` - // A human readable description of this resource, up to 64 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The default language code of the audio. - LanguageCode *string `json:"LanguageCode,omitempty"` - // Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. - AutoRedaction *bool `json:"AutoRedaction,omitempty"` - // Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. - MediaRedaction *bool `json:"MediaRedaction,omitempty"` - // The URL Twilio will request when executing the Webhook. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // - WebhookHttpMethod *string `json:"WebhookHttpMethod,omitempty"` -} - -func (params *CreateServiceParams) SetUniqueName(UniqueName string) *CreateServiceParams { - params.UniqueName = &UniqueName - return params -} -func (params *CreateServiceParams) SetAutoTranscribe(AutoTranscribe bool) *CreateServiceParams { - params.AutoTranscribe = &AutoTranscribe - return params -} -func (params *CreateServiceParams) SetDataLogging(DataLogging bool) *CreateServiceParams { - params.DataLogging = &DataLogging - return params -} -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateServiceParams) SetLanguageCode(LanguageCode string) *CreateServiceParams { - params.LanguageCode = &LanguageCode - return params -} -func (params *CreateServiceParams) SetAutoRedaction(AutoRedaction bool) *CreateServiceParams { - params.AutoRedaction = &AutoRedaction - return params -} -func (params *CreateServiceParams) SetMediaRedaction(MediaRedaction bool) *CreateServiceParams { - params.MediaRedaction = &MediaRedaction - return params -} -func (params *CreateServiceParams) SetWebhookUrl(WebhookUrl string) *CreateServiceParams { - params.WebhookUrl = &WebhookUrl - return params -} -func (params *CreateServiceParams) SetWebhookHttpMethod(WebhookHttpMethod string) *CreateServiceParams { - params.WebhookHttpMethod = &WebhookHttpMethod - return params + // Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. + UniqueName *string `json:"UniqueName,omitempty"` + // Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. + AutoTranscribe *bool `json:"AutoTranscribe,omitempty"` + // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. + DataLogging *bool `json:"DataLogging,omitempty"` + // A human readable description of this resource, up to 64 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The default language code of the audio. + LanguageCode *string `json:"LanguageCode,omitempty"` + // Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. + AutoRedaction *bool `json:"AutoRedaction,omitempty"` + // Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. + MediaRedaction *bool `json:"MediaRedaction,omitempty"` + // The URL Twilio will request when executing the Webhook. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // + WebhookHttpMethod *string `json:"WebhookHttpMethod,omitempty"` +} + +func (params *CreateServiceParams) SetUniqueName(UniqueName string) (*CreateServiceParams){ + params.UniqueName = &UniqueName + return params +} +func (params *CreateServiceParams) SetAutoTranscribe(AutoTranscribe bool) (*CreateServiceParams){ + params.AutoTranscribe = &AutoTranscribe + return params +} +func (params *CreateServiceParams) SetDataLogging(DataLogging bool) (*CreateServiceParams){ + params.DataLogging = &DataLogging + return params +} +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateServiceParams) SetLanguageCode(LanguageCode string) (*CreateServiceParams){ + params.LanguageCode = &LanguageCode + return params +} +func (params *CreateServiceParams) SetAutoRedaction(AutoRedaction bool) (*CreateServiceParams){ + params.AutoRedaction = &AutoRedaction + return params +} +func (params *CreateServiceParams) SetMediaRedaction(MediaRedaction bool) (*CreateServiceParams){ + params.MediaRedaction = &MediaRedaction + return params +} +func (params *CreateServiceParams) SetWebhookUrl(WebhookUrl string) (*CreateServiceParams){ + params.WebhookUrl = &WebhookUrl + return params +} +func (params *CreateServiceParams) SetWebhookHttpMethod(WebhookHttpMethod string) (*CreateServiceParams){ + params.WebhookHttpMethod = &WebhookHttpMethod + return params } // Create a new Service for the given Account func (c *ApiService) CreateService(params *CreateServiceParams) (*IntelligenceV2Service, error) { - path := "/v2/Services" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.AutoTranscribe != nil { - data.Set("AutoTranscribe", fmt.Sprint(*params.AutoTranscribe)) - } - if params != nil && params.DataLogging != nil { - data.Set("DataLogging", fmt.Sprint(*params.DataLogging)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.LanguageCode != nil { - data.Set("LanguageCode", *params.LanguageCode) - } - if params != nil && params.AutoRedaction != nil { - data.Set("AutoRedaction", fmt.Sprint(*params.AutoRedaction)) - } - if params != nil && params.MediaRedaction != nil { - data.Set("MediaRedaction", fmt.Sprint(*params.MediaRedaction)) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.WebhookHttpMethod != nil { - data.Set("WebhookHttpMethod", *params.WebhookHttpMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IntelligenceV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.AutoTranscribe != nil { + data.Set("AutoTranscribe", fmt.Sprint(*params.AutoTranscribe)) + } + if params != nil && params.DataLogging != nil { + data.Set("DataLogging", fmt.Sprint(*params.DataLogging)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.LanguageCode != nil { + data.Set("LanguageCode", *params.LanguageCode) + } + if params != nil && params.AutoRedaction != nil { + data.Set("AutoRedaction", fmt.Sprint(*params.AutoRedaction)) + } + if params != nil && params.MediaRedaction != nil { + data.Set("MediaRedaction", fmt.Sprint(*params.MediaRedaction)) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.WebhookHttpMethod != nil { + data.Set("WebhookHttpMethod", *params.WebhookHttpMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IntelligenceV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Service. -func (c *ApiService) DeleteService(Sid string) error { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific Service. -func (c *ApiService) FetchService(Sid string) (*IntelligenceV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchService(Sid string, ) (*IntelligenceV2Service, error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IntelligenceV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IntelligenceV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v2/Services" + path := "/v2/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -261,6 +267,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan Intelligence return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan IntelligenceV2Service, errorChannel chan error) { curRecord := 1 @@ -292,139 +299,140 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // The If-Match HTTP request header - IfMatch *string `json:"If-Match,omitempty"` - // Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. - AutoTranscribe *bool `json:"AutoTranscribe,omitempty"` - // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. - DataLogging *bool `json:"DataLogging,omitempty"` - // A human readable description of this resource, up to 64 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The default language code of the audio. - LanguageCode *string `json:"LanguageCode,omitempty"` - // Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. - UniqueName *string `json:"UniqueName,omitempty"` - // Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. - AutoRedaction *bool `json:"AutoRedaction,omitempty"` - // Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. - MediaRedaction *bool `json:"MediaRedaction,omitempty"` - // The URL Twilio will request when executing the Webhook. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // - WebhookHttpMethod *string `json:"WebhookHttpMethod,omitempty"` -} - -func (params *UpdateServiceParams) SetIfMatch(IfMatch string) *UpdateServiceParams { - params.IfMatch = &IfMatch - return params -} -func (params *UpdateServiceParams) SetAutoTranscribe(AutoTranscribe bool) *UpdateServiceParams { - params.AutoTranscribe = &AutoTranscribe - return params -} -func (params *UpdateServiceParams) SetDataLogging(DataLogging bool) *UpdateServiceParams { - params.DataLogging = &DataLogging - return params -} -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetLanguageCode(LanguageCode string) *UpdateServiceParams { - params.LanguageCode = &LanguageCode - return params -} -func (params *UpdateServiceParams) SetUniqueName(UniqueName string) *UpdateServiceParams { - params.UniqueName = &UniqueName - return params -} -func (params *UpdateServiceParams) SetAutoRedaction(AutoRedaction bool) *UpdateServiceParams { - params.AutoRedaction = &AutoRedaction - return params -} -func (params *UpdateServiceParams) SetMediaRedaction(MediaRedaction bool) *UpdateServiceParams { - params.MediaRedaction = &MediaRedaction - return params -} -func (params *UpdateServiceParams) SetWebhookUrl(WebhookUrl string) *UpdateServiceParams { - params.WebhookUrl = &WebhookUrl - return params -} -func (params *UpdateServiceParams) SetWebhookHttpMethod(WebhookHttpMethod string) *UpdateServiceParams { - params.WebhookHttpMethod = &WebhookHttpMethod - return params + // The If-Match HTTP request header + IfMatch *string `json:"If-Match,omitempty"` + // Instructs the Speech Recognition service to automatically transcribe all recordings made on the account. + AutoTranscribe *bool `json:"AutoTranscribe,omitempty"` + // Data logging allows Twilio to improve the quality of the speech recognition through using customer data to refine its speech recognition models. + DataLogging *bool `json:"DataLogging,omitempty"` + // A human readable description of this resource, up to 64 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The default language code of the audio. + LanguageCode *string `json:"LanguageCode,omitempty"` + // Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID. + UniqueName *string `json:"UniqueName,omitempty"` + // Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service. + AutoRedaction *bool `json:"AutoRedaction,omitempty"` + // Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise. + MediaRedaction *bool `json:"MediaRedaction,omitempty"` + // The URL Twilio will request when executing the Webhook. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // + WebhookHttpMethod *string `json:"WebhookHttpMethod,omitempty"` +} + +func (params *UpdateServiceParams) SetIfMatch(IfMatch string) (*UpdateServiceParams){ + params.IfMatch = &IfMatch + return params +} +func (params *UpdateServiceParams) SetAutoTranscribe(AutoTranscribe bool) (*UpdateServiceParams){ + params.AutoTranscribe = &AutoTranscribe + return params +} +func (params *UpdateServiceParams) SetDataLogging(DataLogging bool) (*UpdateServiceParams){ + params.DataLogging = &DataLogging + return params +} +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetLanguageCode(LanguageCode string) (*UpdateServiceParams){ + params.LanguageCode = &LanguageCode + return params +} +func (params *UpdateServiceParams) SetUniqueName(UniqueName string) (*UpdateServiceParams){ + params.UniqueName = &UniqueName + return params +} +func (params *UpdateServiceParams) SetAutoRedaction(AutoRedaction bool) (*UpdateServiceParams){ + params.AutoRedaction = &AutoRedaction + return params +} +func (params *UpdateServiceParams) SetMediaRedaction(MediaRedaction bool) (*UpdateServiceParams){ + params.MediaRedaction = &MediaRedaction + return params +} +func (params *UpdateServiceParams) SetWebhookUrl(WebhookUrl string) (*UpdateServiceParams){ + params.WebhookUrl = &WebhookUrl + return params +} +func (params *UpdateServiceParams) SetWebhookHttpMethod(WebhookHttpMethod string) (*UpdateServiceParams){ + params.WebhookHttpMethod = &WebhookHttpMethod + return params } // Update a specific Service. func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*IntelligenceV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AutoTranscribe != nil { + data.Set("AutoTranscribe", fmt.Sprint(*params.AutoTranscribe)) + } + if params != nil && params.DataLogging != nil { + data.Set("DataLogging", fmt.Sprint(*params.DataLogging)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.LanguageCode != nil { + data.Set("LanguageCode", *params.LanguageCode) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.AutoRedaction != nil { + data.Set("AutoRedaction", fmt.Sprint(*params.AutoRedaction)) + } + if params != nil && params.MediaRedaction != nil { + data.Set("MediaRedaction", fmt.Sprint(*params.MediaRedaction)) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.WebhookHttpMethod != nil { + data.Set("WebhookHttpMethod", *params.WebhookHttpMethod) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AutoTranscribe != nil { - data.Set("AutoTranscribe", fmt.Sprint(*params.AutoTranscribe)) - } - if params != nil && params.DataLogging != nil { - data.Set("DataLogging", fmt.Sprint(*params.DataLogging)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.LanguageCode != nil { - data.Set("LanguageCode", *params.LanguageCode) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.AutoRedaction != nil { - data.Set("AutoRedaction", fmt.Sprint(*params.AutoRedaction)) - } - if params != nil && params.MediaRedaction != nil { - data.Set("MediaRedaction", fmt.Sprint(*params.MediaRedaction)) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.WebhookHttpMethod != nil { - data.Set("WebhookHttpMethod", *params.WebhookHttpMethod) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IntelligenceV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IntelligenceV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/intelligence/v2/transcripts.go b/rest/intelligence/v2/transcripts.go index bb98dbd84..23cf861d1 100644 --- a/rest/intelligence/v2/transcripts.go +++ b/rest/intelligence/v2/transcripts.go @@ -18,243 +18,262 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTranscript' type CreateTranscriptParams struct { - // The unique SID identifier of the Service. - ServiceSid *string `json:"ServiceSid,omitempty"` - // JSON object describing Media Channel including Source and Participants - Channel *interface{} `json:"Channel,omitempty"` - // Used to store client provided metadata. Maximum of 64 double-byte UTF8 characters. - CustomerKey *string `json:"CustomerKey,omitempty"` - // The date that this Transcript's media was started, given in ISO 8601 format. - MediaStartTime *time.Time `json:"MediaStartTime,omitempty"` + // The unique SID identifier of the Service. + ServiceSid *string `json:"ServiceSid,omitempty"` + // JSON object describing Media Channel including Source and Participants + Channel *interface{} `json:"Channel,omitempty"` + // Used to store client provided metadata. Maximum of 64 double-byte UTF8 characters. + CustomerKey *string `json:"CustomerKey,omitempty"` + // The date that this Transcript's media was started, given in ISO 8601 format. + MediaStartTime *time.Time `json:"MediaStartTime,omitempty"` } -func (params *CreateTranscriptParams) SetServiceSid(ServiceSid string) *CreateTranscriptParams { - params.ServiceSid = &ServiceSid - return params +func (params *CreateTranscriptParams) SetServiceSid(ServiceSid string) (*CreateTranscriptParams){ + params.ServiceSid = &ServiceSid + return params } -func (params *CreateTranscriptParams) SetChannel(Channel interface{}) *CreateTranscriptParams { - params.Channel = &Channel - return params +func (params *CreateTranscriptParams) SetChannel(Channel interface{}) (*CreateTranscriptParams){ + params.Channel = &Channel + return params } -func (params *CreateTranscriptParams) SetCustomerKey(CustomerKey string) *CreateTranscriptParams { - params.CustomerKey = &CustomerKey - return params +func (params *CreateTranscriptParams) SetCustomerKey(CustomerKey string) (*CreateTranscriptParams){ + params.CustomerKey = &CustomerKey + return params } -func (params *CreateTranscriptParams) SetMediaStartTime(MediaStartTime time.Time) *CreateTranscriptParams { - params.MediaStartTime = &MediaStartTime - return params +func (params *CreateTranscriptParams) SetMediaStartTime(MediaStartTime time.Time) (*CreateTranscriptParams){ + params.MediaStartTime = &MediaStartTime + return params } // Create a new Transcript for the service func (c *ApiService) CreateTranscript(params *CreateTranscriptParams) (*IntelligenceV2Transcript, error) { - path := "/v2/Transcripts" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Transcripts" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ServiceSid != nil { + data.Set("ServiceSid", *params.ServiceSid) + } + if params != nil && params.Channel != nil { + v, err := json.Marshal(params.Channel) + + if err != nil { + return nil, err + } + + data.Set("Channel", string(v)) + } + if params != nil && params.CustomerKey != nil { + data.Set("CustomerKey", *params.CustomerKey) + } + if params != nil && params.MediaStartTime != nil { + data.Set("MediaStartTime", fmt.Sprint((*params.MediaStartTime).Format(time.RFC3339))) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IntelligenceV2Transcript{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.ServiceSid != nil { - data.Set("ServiceSid", *params.ServiceSid) - } - if params != nil && params.Channel != nil { - v, err := json.Marshal(params.Channel) +// Delete a specific Transcript. +func (c *ApiService) DeleteTranscript(Sid string, ) (error) { + path := "/v2/Transcripts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - data.Set("Channel", string(v)) - } - if params != nil && params.CustomerKey != nil { - data.Set("CustomerKey", *params.CustomerKey) - } - if params != nil && params.MediaStartTime != nil { - data.Set("MediaStartTime", fmt.Sprint((*params.MediaStartTime).Format(time.RFC3339))) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - ps := &IntelligenceV2Transcript{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + return nil } -// Delete a specific Transcript. -func (c *ApiService) DeleteTranscript(Sid string) error { - path := "/v2/Transcripts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() +// Optional parameters for the method 'FetchTranscript' +type FetchTranscriptParams struct { + // Grant access to PII Redacted/Unredacted Transcript. The default is `true` to access redacted Transcript. + Redacted *bool `json:"Redacted,omitempty"` +} - return nil +func (params *FetchTranscriptParams) SetRedacted(Redacted bool) (*FetchTranscriptParams){ + params.Redacted = &Redacted + return params } // Fetch a specific Transcript. -func (c *ApiService) FetchTranscript(Sid string) (*IntelligenceV2Transcript, error) { - path := "/v2/Transcripts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchTranscript(Sid string, params *FetchTranscriptParams) (*IntelligenceV2Transcript, error) { + path := "/v2/Transcripts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + if params != nil && params.Redacted != nil { + data.Set("Redacted", fmt.Sprint(*params.Redacted)) + } - defer resp.Body.Close() - ps := &IntelligenceV2Transcript{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &IntelligenceV2Transcript{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTranscript' type ListTranscriptParams struct { - // The unique SID identifier of the Service. - ServiceSid *string `json:"ServiceSid,omitempty"` - // Filter by before StartTime. - BeforeStartTime *string `json:"BeforeStartTime,omitempty"` - // Filter by after StartTime. - AfterStartTime *string `json:"AfterStartTime,omitempty"` - // Filter by before DateCreated. - BeforeDateCreated *string `json:"BeforeDateCreated,omitempty"` - // Filter by after DateCreated. - AfterDateCreated *string `json:"AfterDateCreated,omitempty"` - // Filter by status. - Status *string `json:"Status,omitempty"` - // Filter by Language Code. - LanguageCode *string `json:"LanguageCode,omitempty"` - // Filter by SourceSid. - SourceSid *string `json:"SourceSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique SID identifier of the Service. + ServiceSid *string `json:"ServiceSid,omitempty"` + // Filter by before StartTime. + BeforeStartTime *string `json:"BeforeStartTime,omitempty"` + // Filter by after StartTime. + AfterStartTime *string `json:"AfterStartTime,omitempty"` + // Filter by before DateCreated. + BeforeDateCreated *string `json:"BeforeDateCreated,omitempty"` + // Filter by after DateCreated. + AfterDateCreated *string `json:"AfterDateCreated,omitempty"` + // Filter by status. + Status *string `json:"Status,omitempty"` + // Filter by Language Code. + LanguageCode *string `json:"LanguageCode,omitempty"` + // Filter by SourceSid. + SourceSid *string `json:"SourceSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTranscriptParams) SetServiceSid(ServiceSid string) *ListTranscriptParams { - params.ServiceSid = &ServiceSid - return params +func (params *ListTranscriptParams) SetServiceSid(ServiceSid string) (*ListTranscriptParams){ + params.ServiceSid = &ServiceSid + return params } -func (params *ListTranscriptParams) SetBeforeStartTime(BeforeStartTime string) *ListTranscriptParams { - params.BeforeStartTime = &BeforeStartTime - return params +func (params *ListTranscriptParams) SetBeforeStartTime(BeforeStartTime string) (*ListTranscriptParams){ + params.BeforeStartTime = &BeforeStartTime + return params } -func (params *ListTranscriptParams) SetAfterStartTime(AfterStartTime string) *ListTranscriptParams { - params.AfterStartTime = &AfterStartTime - return params +func (params *ListTranscriptParams) SetAfterStartTime(AfterStartTime string) (*ListTranscriptParams){ + params.AfterStartTime = &AfterStartTime + return params } -func (params *ListTranscriptParams) SetBeforeDateCreated(BeforeDateCreated string) *ListTranscriptParams { - params.BeforeDateCreated = &BeforeDateCreated - return params +func (params *ListTranscriptParams) SetBeforeDateCreated(BeforeDateCreated string) (*ListTranscriptParams){ + params.BeforeDateCreated = &BeforeDateCreated + return params } -func (params *ListTranscriptParams) SetAfterDateCreated(AfterDateCreated string) *ListTranscriptParams { - params.AfterDateCreated = &AfterDateCreated - return params +func (params *ListTranscriptParams) SetAfterDateCreated(AfterDateCreated string) (*ListTranscriptParams){ + params.AfterDateCreated = &AfterDateCreated + return params } -func (params *ListTranscriptParams) SetStatus(Status string) *ListTranscriptParams { - params.Status = &Status - return params +func (params *ListTranscriptParams) SetStatus(Status string) (*ListTranscriptParams){ + params.Status = &Status + return params } -func (params *ListTranscriptParams) SetLanguageCode(LanguageCode string) *ListTranscriptParams { - params.LanguageCode = &LanguageCode - return params +func (params *ListTranscriptParams) SetLanguageCode(LanguageCode string) (*ListTranscriptParams){ + params.LanguageCode = &LanguageCode + return params } -func (params *ListTranscriptParams) SetSourceSid(SourceSid string) *ListTranscriptParams { - params.SourceSid = &SourceSid - return params +func (params *ListTranscriptParams) SetSourceSid(SourceSid string) (*ListTranscriptParams){ + params.SourceSid = &SourceSid + return params } -func (params *ListTranscriptParams) SetPageSize(PageSize int) *ListTranscriptParams { - params.PageSize = &PageSize - return params +func (params *ListTranscriptParams) SetPageSize(PageSize int) (*ListTranscriptParams){ + params.PageSize = &PageSize + return params } -func (params *ListTranscriptParams) SetLimit(Limit int) *ListTranscriptParams { - params.Limit = &Limit - return params +func (params *ListTranscriptParams) SetLimit(Limit int) (*ListTranscriptParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Transcript records from the API. Request is executed immediately. func (c *ApiService) PageTranscript(params *ListTranscriptParams, pageToken, pageNumber string) (*ListTranscriptResponse, error) { - path := "/v2/Transcripts" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ServiceSid != nil { - data.Set("ServiceSid", *params.ServiceSid) - } - if params != nil && params.BeforeStartTime != nil { - data.Set("BeforeStartTime", *params.BeforeStartTime) - } - if params != nil && params.AfterStartTime != nil { - data.Set("AfterStartTime", *params.AfterStartTime) - } - if params != nil && params.BeforeDateCreated != nil { - data.Set("BeforeDateCreated", *params.BeforeDateCreated) - } - if params != nil && params.AfterDateCreated != nil { - data.Set("AfterDateCreated", *params.AfterDateCreated) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.LanguageCode != nil { - data.Set("LanguageCode", *params.LanguageCode) - } - if params != nil && params.SourceSid != nil { - data.Set("SourceSid", *params.SourceSid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTranscriptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Transcripts" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ServiceSid != nil { + data.Set("ServiceSid", *params.ServiceSid) + } + if params != nil && params.BeforeStartTime != nil { + data.Set("BeforeStartTime", *params.BeforeStartTime) + } + if params != nil && params.AfterStartTime != nil { + data.Set("AfterStartTime", *params.AfterStartTime) + } + if params != nil && params.BeforeDateCreated != nil { + data.Set("BeforeDateCreated", *params.BeforeDateCreated) + } + if params != nil && params.AfterDateCreated != nil { + data.Set("AfterDateCreated", *params.AfterDateCreated) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.LanguageCode != nil { + data.Set("LanguageCode", *params.LanguageCode) + } + if params != nil && params.SourceSid != nil { + data.Set("SourceSid", *params.SourceSid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTranscriptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Transcript records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -295,6 +314,7 @@ func (c *ApiService) StreamTranscript(params *ListTranscriptParams) (chan Intell return recordChannel, errorChannel } + func (c *ApiService) streamTranscript(response *ListTranscriptResponse, params *ListTranscriptParams, recordChannel chan IntelligenceV2Transcript, errorChannel chan error) { curRecord := 1 @@ -326,19 +346,20 @@ func (c *ApiService) streamTranscript(response *ListTranscriptResponse, params * } func (c *ApiService) getNextListTranscriptResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTranscriptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTranscriptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/intelligence/v2/transcripts_media.go b/rest/intelligence/v2/transcripts_media.go index d54171b4f..10e7528df 100644 --- a/rest/intelligence/v2/transcripts_media.go +++ b/rest/intelligence/v2/transcripts_media.go @@ -18,43 +18,46 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchMedia' type FetchMediaParams struct { - // Grant access to PII Redacted/Unredacted Media. If redaction is enabled, the default is `true` to access redacted media. - Redacted *bool `json:"Redacted,omitempty"` + // Grant access to PII Redacted/Unredacted Media. The default is `true` to access redacted media. + Redacted *bool `json:"Redacted,omitempty"` } -func (params *FetchMediaParams) SetRedacted(Redacted bool) *FetchMediaParams { - params.Redacted = &Redacted - return params +func (params *FetchMediaParams) SetRedacted(Redacted bool) (*FetchMediaParams){ + params.Redacted = &Redacted + return params } // Get download URLs for media if possible func (c *ApiService) FetchMedia(Sid string, params *FetchMediaParams) (*IntelligenceV2Media, error) { - path := "/v2/Transcripts/{Sid}/Media" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Transcripts/{Sid}/Media" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Redacted != nil { + data.Set("Redacted", fmt.Sprint(*params.Redacted)) + } - if params != nil && params.Redacted != nil { - data.Set("Redacted", fmt.Sprint(*params.Redacted)) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IntelligenceV2Media{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IntelligenceV2Media{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/intelligence/v2/transcripts_operator_results.go b/rest/intelligence/v2/transcripts_operator_results.go index 15e922c66..da16d55b7 100644 --- a/rest/intelligence/v2/transcripts_operator_results.go +++ b/rest/intelligence/v2/transcripts_operator_results.go @@ -18,109 +18,110 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchOperatorResult' type FetchOperatorResultParams struct { - // Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. - Redacted *bool `json:"Redacted,omitempty"` + // Grant access to PII redacted/unredacted Language Understanding operator. The default is True. + Redacted *bool `json:"Redacted,omitempty"` } -func (params *FetchOperatorResultParams) SetRedacted(Redacted bool) *FetchOperatorResultParams { - params.Redacted = &Redacted - return params +func (params *FetchOperatorResultParams) SetRedacted(Redacted bool) (*FetchOperatorResultParams){ + params.Redacted = &Redacted + return params } // Fetch a specific Operator Result for the given Transcript. func (c *ApiService) FetchOperatorResult(TranscriptSid string, OperatorSid string, params *FetchOperatorResultParams) (*IntelligenceV2OperatorResult, error) { - path := "/v2/Transcripts/{TranscriptSid}/OperatorResults/{OperatorSid}" - path = strings.Replace(path, "{"+"TranscriptSid"+"}", TranscriptSid, -1) - path = strings.Replace(path, "{"+"OperatorSid"+"}", OperatorSid, -1) + path := "/v2/Transcripts/{TranscriptSid}/OperatorResults/{OperatorSid}" + path = strings.Replace(path, "{"+"TranscriptSid"+"}", TranscriptSid, -1) + path = strings.Replace(path, "{"+"OperatorSid"+"}", OperatorSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Redacted != nil { - data.Set("Redacted", fmt.Sprint(*params.Redacted)) - } + if params != nil && params.Redacted != nil { + data.Set("Redacted", fmt.Sprint(*params.Redacted)) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IntelligenceV2OperatorResult{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &IntelligenceV2OperatorResult{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListOperatorResult' type ListOperatorResultParams struct { - // Grant access to PII redacted/unredacted Language Understanding operator. If redaction is enabled, the default is True. - Redacted *bool `json:"Redacted,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Grant access to PII redacted/unredacted Language Understanding operator. The default is True. + Redacted *bool `json:"Redacted,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListOperatorResultParams) SetRedacted(Redacted bool) *ListOperatorResultParams { - params.Redacted = &Redacted - return params +func (params *ListOperatorResultParams) SetRedacted(Redacted bool) (*ListOperatorResultParams){ + params.Redacted = &Redacted + return params } -func (params *ListOperatorResultParams) SetPageSize(PageSize int) *ListOperatorResultParams { - params.PageSize = &PageSize - return params +func (params *ListOperatorResultParams) SetPageSize(PageSize int) (*ListOperatorResultParams){ + params.PageSize = &PageSize + return params } -func (params *ListOperatorResultParams) SetLimit(Limit int) *ListOperatorResultParams { - params.Limit = &Limit - return params +func (params *ListOperatorResultParams) SetLimit(Limit int) (*ListOperatorResultParams){ + params.Limit = &Limit + return params } // Retrieve a single page of OperatorResult records from the API. Request is executed immediately. func (c *ApiService) PageOperatorResult(TranscriptSid string, params *ListOperatorResultParams, pageToken, pageNumber string) (*ListOperatorResultResponse, error) { - path := "/v2/Transcripts/{TranscriptSid}/OperatorResults" + path := "/v2/Transcripts/{TranscriptSid}/OperatorResults" - path = strings.Replace(path, "{"+"TranscriptSid"+"}", TranscriptSid, -1) + path = strings.Replace(path, "{"+"TranscriptSid"+"}", TranscriptSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Redacted != nil { - data.Set("Redacted", fmt.Sprint(*params.Redacted)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Redacted != nil { + data.Set("Redacted", fmt.Sprint(*params.Redacted)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListOperatorResultResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListOperatorResultResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists OperatorResult records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -161,6 +162,7 @@ func (c *ApiService) StreamOperatorResult(TranscriptSid string, params *ListOper return recordChannel, errorChannel } + func (c *ApiService) streamOperatorResult(response *ListOperatorResultResponse, params *ListOperatorResultParams, recordChannel chan IntelligenceV2OperatorResult, errorChannel chan error) { curRecord := 1 @@ -192,19 +194,20 @@ func (c *ApiService) streamOperatorResult(response *ListOperatorResultResponse, } func (c *ApiService) getNextListOperatorResultResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListOperatorResultResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListOperatorResultResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/intelligence/v2/transcripts_sentences.go b/rest/intelligence/v2/transcripts_sentences.go index 6b257de78..78df36197 100644 --- a/rest/intelligence/v2/transcripts_sentences.go +++ b/rest/intelligence/v2/transcripts_sentences.go @@ -18,70 +18,70 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListSentence' type ListSentenceParams struct { - // Grant access to PII Redacted/Unredacted Sentences. If redaction is enabled, the default is `true` to access redacted sentences. - Redacted *bool `json:"Redacted,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Grant access to PII Redacted/Unredacted Sentences. The default is `true` to access redacted sentences. + Redacted *bool `json:"Redacted,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSentenceParams) SetRedacted(Redacted bool) *ListSentenceParams { - params.Redacted = &Redacted - return params +func (params *ListSentenceParams) SetRedacted(Redacted bool) (*ListSentenceParams){ + params.Redacted = &Redacted + return params } -func (params *ListSentenceParams) SetPageSize(PageSize int) *ListSentenceParams { - params.PageSize = &PageSize - return params +func (params *ListSentenceParams) SetPageSize(PageSize int) (*ListSentenceParams){ + params.PageSize = &PageSize + return params } -func (params *ListSentenceParams) SetLimit(Limit int) *ListSentenceParams { - params.Limit = &Limit - return params +func (params *ListSentenceParams) SetLimit(Limit int) (*ListSentenceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Sentence records from the API. Request is executed immediately. func (c *ApiService) PageSentence(TranscriptSid string, params *ListSentenceParams, pageToken, pageNumber string) (*ListSentenceResponse, error) { - path := "/v2/Transcripts/{TranscriptSid}/Sentences" + path := "/v2/Transcripts/{TranscriptSid}/Sentences" - path = strings.Replace(path, "{"+"TranscriptSid"+"}", TranscriptSid, -1) + path = strings.Replace(path, "{"+"TranscriptSid"+"}", TranscriptSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Redacted != nil { - data.Set("Redacted", fmt.Sprint(*params.Redacted)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Redacted != nil { + data.Set("Redacted", fmt.Sprint(*params.Redacted)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSentenceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSentenceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Sentence records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -122,6 +122,7 @@ func (c *ApiService) StreamSentence(TranscriptSid string, params *ListSentencePa return recordChannel, errorChannel } + func (c *ApiService) streamSentence(response *ListSentenceResponse, params *ListSentenceParams, recordChannel chan IntelligenceV2Sentence, errorChannel chan error) { curRecord := 1 @@ -153,19 +154,20 @@ func (c *ApiService) streamSentence(response *ListSentenceResponse, params *List } func (c *ApiService) getNextListSentenceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSentenceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSentenceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/ip_messaging/v1/README.md b/rest/ip_messaging/v1/README.md index 650d34b55..ed4d7d00d 100644 --- a/rest/ip_messaging/v1/README.md +++ b/rest/ip_messaging/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/ip_messaging/v1/api_service.go b/rest/ip_messaging/v1/api_service.go index d15ea97c9..039b82654 100644 --- a/rest/ip_messaging/v1/api_service.go +++ b/rest/ip_messaging/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://ip-messaging.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/ip_messaging/v1/credentials.go b/rest/ip_messaging/v1/credentials.go index 850c839e0..8241af275 100644 --- a/rest/ip_messaging/v1/credentials.go +++ b/rest/ip_messaging/v1/credentials.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredential' type CreateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Certificate *string `json:"Certificate,omitempty"` - // - PrivateKey *string `json:"PrivateKey,omitempty"` - // - Sandbox *bool `json:"Sandbox,omitempty"` - // - ApiKey *string `json:"ApiKey,omitempty"` - // - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Certificate *string `json:"Certificate,omitempty"` + // + PrivateKey *string `json:"PrivateKey,omitempty"` + // + Sandbox *bool `json:"Sandbox,omitempty"` + // + ApiKey *string `json:"ApiKey,omitempty"` + // + Secret *string `json:"Secret,omitempty"` } -func (params *CreateCredentialParams) SetType(Type string) *CreateCredentialParams { - params.Type = &Type - return params +func (params *CreateCredentialParams) SetType(Type string) (*CreateCredentialParams){ + params.Type = &Type + return params } -func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) *CreateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) (*CreateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialParams) SetCertificate(Certificate string) *CreateCredentialParams { - params.Certificate = &Certificate - return params +func (params *CreateCredentialParams) SetCertificate(Certificate string) (*CreateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) *CreateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) (*CreateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *CreateCredentialParams) SetSandbox(Sandbox bool) *CreateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *CreateCredentialParams) SetSandbox(Sandbox bool) (*CreateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *CreateCredentialParams) SetApiKey(ApiKey string) *CreateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *CreateCredentialParams) SetApiKey(ApiKey string) (*CreateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *CreateCredentialParams) SetSecret(Secret string) *CreateCredentialParams { - params.Secret = &Secret - return params +func (params *CreateCredentialParams) SetSecret(Secret string) (*CreateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) CreateCredential(params *CreateCredentialParams) (*IpMessagingV1Credential, error) { - path := "/v1/Credentials" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Credentials" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } +// +func (c *ApiService) DeleteCredential(Sid string, ) (error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &IpMessagingV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteCredential(Sid string) error { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchCredential(Sid string, ) (*IpMessagingV1Credential, error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchCredential(Sid string) (*IpMessagingV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &IpMessagingV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &IpMessagingV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListCredential' type ListCredentialParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialParams) SetPageSize(PageSize int) *ListCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialParams) SetPageSize(PageSize int) (*ListCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialParams) SetLimit(Limit int) *ListCredentialParams { - params.Limit = &Limit - return params +func (params *ListCredentialParams) SetLimit(Limit int) (*ListCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Credential records from the API. Request is executed immediately. func (c *ApiService) PageCredential(params *ListCredentialParams, pageToken, pageNumber string) (*ListCredentialResponse, error) { - path := "/v1/Credentials" + path := "/v1/Credentials" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Credential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCredential(params *ListCredentialParams) (chan IpMess return recordChannel, errorChannel } + func (c *ApiService) streamCredential(response *ListCredentialResponse, params *ListCredentialParams, recordChannel chan IpMessagingV1Credential, errorChannel chan error) { curRecord := 1 @@ -274,102 +281,104 @@ func (c *ApiService) streamCredential(response *ListCredentialResponse, params * } func (c *ApiService) getNextListCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredential' type UpdateCredentialParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Certificate *string `json:"Certificate,omitempty"` - // - PrivateKey *string `json:"PrivateKey,omitempty"` - // - Sandbox *bool `json:"Sandbox,omitempty"` - // - ApiKey *string `json:"ApiKey,omitempty"` - // - Secret *string `json:"Secret,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Certificate *string `json:"Certificate,omitempty"` + // + PrivateKey *string `json:"PrivateKey,omitempty"` + // + Sandbox *bool `json:"Sandbox,omitempty"` + // + ApiKey *string `json:"ApiKey,omitempty"` + // + Secret *string `json:"Secret,omitempty"` } -func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) *UpdateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCredentialParams) SetCertificate(Certificate string) *UpdateCredentialParams { - params.Certificate = &Certificate - return params +func (params *UpdateCredentialParams) SetCertificate(Certificate string) (*UpdateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) *UpdateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) (*UpdateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) *UpdateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) (*UpdateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *UpdateCredentialParams) SetApiKey(ApiKey string) *UpdateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *UpdateCredentialParams) SetApiKey(ApiKey string) (*UpdateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *UpdateCredentialParams) SetSecret(Secret string) *UpdateCredentialParams { - params.Secret = &Secret - return params +func (params *UpdateCredentialParams) SetSecret(Secret string) (*UpdateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) UpdateCredential(Sid string, params *UpdateCredentialParams) (*IpMessagingV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IpMessagingV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/ip_messaging/v1/docs/ListChannelResponseMeta.md b/rest/ip_messaging/v1/docs/ListChannelResponseMeta.md index d507879b9..b007fb5e6 100644 --- a/rest/ip_messaging/v1/docs/ListChannelResponseMeta.md +++ b/rest/ip_messaging/v1/docs/ListChannelResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_channel.go b/rest/ip_messaging/v1/model_ip_messaging_v1_channel.go index 276594cb0..2f1db348d 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_channel.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_channel.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Channel struct for IpMessagingV1Channel type IpMessagingV1Channel struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - UniqueName *string `json:"unique_name,omitempty"` - Attributes *string `json:"attributes,omitempty"` - Type *string `json:"type,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - CreatedBy *string `json:"created_by,omitempty"` - MembersCount *int `json:"members_count,omitempty"` - MessagesCount *int `json:"messages_count,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + UniqueName *string `json:"unique_name,omitempty"` + Attributes *string `json:"attributes,omitempty"` + Type *string `json:"type,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + CreatedBy *string `json:"created_by,omitempty"` + MembersCount *int `json:"members_count,omitempty"` + MessagesCount *int `json:"messages_count,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_credential.go b/rest/ip_messaging/v1/model_ip_messaging_v1_credential.go index 0cc0a32f6..0288e093e 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_credential.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_credential.go @@ -13,19 +13,21 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Credential struct for IpMessagingV1Credential type IpMessagingV1Credential struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - Sandbox *string `json:"sandbox,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + Type *string `json:"type,omitempty"` + Sandbox *string `json:"sandbox,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_invite.go b/rest/ip_messaging/v1/model_ip_messaging_v1_invite.go index b9b9440ad..953955017 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_invite.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_invite.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Invite struct for IpMessagingV1Invite type IpMessagingV1Invite struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - Identity *string `json:"identity,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + Identity *string `json:"identity,omitempty"` DateCreated *time.Time `json:"date_created,omitempty"` DateUpdated *time.Time `json:"date_updated,omitempty"` - RoleSid *string `json:"role_sid,omitempty"` - CreatedBy *string `json:"created_by,omitempty"` - Url *string `json:"url,omitempty"` + RoleSid *string `json:"role_sid,omitempty"` + CreatedBy *string `json:"created_by,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_member.go b/rest/ip_messaging/v1/model_ip_messaging_v1_member.go index 9165e9708..b59c79d4e 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_member.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_member.go @@ -13,22 +13,24 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Member struct for IpMessagingV1Member type IpMessagingV1Member struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - Identity *string `json:"identity,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - RoleSid *string `json:"role_sid,omitempty"` - LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + Identity *string `json:"identity,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + RoleSid *string `json:"role_sid,omitempty"` + LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` LastConsumptionTimestamp *time.Time `json:"last_consumption_timestamp,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_message.go b/rest/ip_messaging/v1/model_ip_messaging_v1_message.go index f9f97b98b..158097784 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_message.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_message.go @@ -13,24 +13,26 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Message struct for IpMessagingV1Message type IpMessagingV1Message struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - Attributes *string `json:"attributes,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - To *string `json:"to,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + Attributes *string `json:"attributes,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + To *string `json:"to,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` DateCreated *time.Time `json:"date_created,omitempty"` DateUpdated *time.Time `json:"date_updated,omitempty"` - WasEdited *bool `json:"was_edited,omitempty"` - From *string `json:"from,omitempty"` - Body *string `json:"body,omitempty"` - Index *int `json:"index,omitempty"` - Url *string `json:"url,omitempty"` + WasEdited *bool `json:"was_edited,omitempty"` + From *string `json:"from,omitempty"` + Body *string `json:"body,omitempty"` + Index *int `json:"index,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_role.go b/rest/ip_messaging/v1/model_ip_messaging_v1_role.go index f545b56c9..f3f1e0120 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_role.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_role.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Role struct for IpMessagingV1Role type IpMessagingV1Role struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - Permissions *[]string `json:"permissions,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + Type *string `json:"type,omitempty"` + Permissions *[]string `json:"permissions,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_service.go b/rest/ip_messaging/v1/model_ip_messaging_v1_service.go index 7d288e9c0..839542836 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_service.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_service.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1Service struct for IpMessagingV1Service type IpMessagingV1Service struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - DefaultServiceRoleSid *string `json:"default_service_role_sid,omitempty"` - DefaultChannelRoleSid *string `json:"default_channel_role_sid,omitempty"` - DefaultChannelCreatorRoleSid *string `json:"default_channel_creator_role_sid,omitempty"` - ReadStatusEnabled *bool `json:"read_status_enabled,omitempty"` - ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` - TypingIndicatorTimeout *int `json:"typing_indicator_timeout,omitempty"` - ConsumptionReportInterval *int `json:"consumption_report_interval,omitempty"` - Limits *interface{} `json:"limits,omitempty"` - Webhooks *interface{} `json:"webhooks,omitempty"` - PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` - PostWebhookUrl *string `json:"post_webhook_url,omitempty"` - WebhookMethod *string `json:"webhook_method,omitempty"` - WebhookFilters *[]string `json:"webhook_filters,omitempty"` - Notifications *interface{} `json:"notifications,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + DefaultServiceRoleSid *string `json:"default_service_role_sid,omitempty"` + DefaultChannelRoleSid *string `json:"default_channel_role_sid,omitempty"` + DefaultChannelCreatorRoleSid *string `json:"default_channel_creator_role_sid,omitempty"` + ReadStatusEnabled *bool `json:"read_status_enabled,omitempty"` + ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` + TypingIndicatorTimeout *int `json:"typing_indicator_timeout,omitempty"` + ConsumptionReportInterval *int `json:"consumption_report_interval,omitempty"` + Limits *interface{} `json:"limits,omitempty"` + Webhooks *interface{} `json:"webhooks,omitempty"` + PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` + PostWebhookUrl *string `json:"post_webhook_url,omitempty"` + WebhookMethod *string `json:"webhook_method,omitempty"` + WebhookFilters *[]string `json:"webhook_filters,omitempty"` + Notifications *interface{} `json:"notifications,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_user.go b/rest/ip_messaging/v1/model_ip_messaging_v1_user.go index c71f2bdc7..304aaec9c 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_user.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_user.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV1User struct for IpMessagingV1User type IpMessagingV1User struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - Attributes *string `json:"attributes,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - RoleSid *string `json:"role_sid,omitempty"` - Identity *string `json:"identity,omitempty"` - IsOnline *bool `json:"is_online,omitempty"` - IsNotifiable *bool `json:"is_notifiable,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - JoinedChannelsCount *int `json:"joined_channels_count,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + Attributes *string `json:"attributes,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + RoleSid *string `json:"role_sid,omitempty"` + Identity *string `json:"identity,omitempty"` + IsOnline *bool `json:"is_online,omitempty"` + IsNotifiable *bool `json:"is_notifiable,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + JoinedChannelsCount *int `json:"joined_channels_count,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_ip_messaging_v1_user_channel.go b/rest/ip_messaging/v1/model_ip_messaging_v1_user_channel.go index 2cc301619..9269d6f70 100644 --- a/rest/ip_messaging/v1/model_ip_messaging_v1_user_channel.go +++ b/rest/ip_messaging/v1/model_ip_messaging_v1_user_channel.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // IpMessagingV1UserChannel struct for IpMessagingV1UserChannel type IpMessagingV1UserChannel struct { - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - MemberSid *string `json:"member_sid,omitempty"` - Status *string `json:"status,omitempty"` - LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` - UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + MemberSid *string `json:"member_sid,omitempty"` + Status *string `json:"status,omitempty"` + LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` + UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_channel_response.go b/rest/ip_messaging/v1/model_list_channel_response.go index 54e5ef404..513d1c92d 100644 --- a/rest/ip_messaging/v1/model_list_channel_response.go +++ b/rest/ip_messaging/v1/model_list_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponse struct for ListChannelResponse type ListChannelResponse struct { - Channels []IpMessagingV1Channel `json:"channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Channels []IpMessagingV1Channel `json:"channels,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_channel_response_meta.go b/rest/ip_messaging/v1/model_list_channel_response_meta.go index 4e3849511..4bbd5da67 100644 --- a/rest/ip_messaging/v1/model_list_channel_response_meta.go +++ b/rest/ip_messaging/v1/model_list_channel_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponseMeta struct for ListChannelResponseMeta type ListChannelResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_credential_response.go b/rest/ip_messaging/v1/model_list_credential_response.go index 0f040507b..1376ac38e 100644 --- a/rest/ip_messaging/v1/model_list_credential_response.go +++ b/rest/ip_messaging/v1/model_list_credential_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialResponse struct for ListCredentialResponse type ListCredentialResponse struct { Credentials []IpMessagingV1Credential `json:"credentials,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_invite_response.go b/rest/ip_messaging/v1/model_list_invite_response.go index f5f185d91..9943ec052 100644 --- a/rest/ip_messaging/v1/model_list_invite_response.go +++ b/rest/ip_messaging/v1/model_list_invite_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInviteResponse struct for ListInviteResponse type ListInviteResponse struct { - Invites []IpMessagingV1Invite `json:"invites,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Invites []IpMessagingV1Invite `json:"invites,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_member_response.go b/rest/ip_messaging/v1/model_list_member_response.go index efd096aae..8dc1ba9f0 100644 --- a/rest/ip_messaging/v1/model_list_member_response.go +++ b/rest/ip_messaging/v1/model_list_member_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMemberResponse struct for ListMemberResponse type ListMemberResponse struct { - Members []IpMessagingV1Member `json:"members,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Members []IpMessagingV1Member `json:"members,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_message_response.go b/rest/ip_messaging/v1/model_list_message_response.go index 35cca5850..f3ad7df04 100644 --- a/rest/ip_messaging/v1/model_list_message_response.go +++ b/rest/ip_messaging/v1/model_list_message_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessageResponse struct for ListMessageResponse type ListMessageResponse struct { - Messages []IpMessagingV1Message `json:"messages,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Messages []IpMessagingV1Message `json:"messages,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_role_response.go b/rest/ip_messaging/v1/model_list_role_response.go index 33000351b..8ffce864a 100644 --- a/rest/ip_messaging/v1/model_list_role_response.go +++ b/rest/ip_messaging/v1/model_list_role_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoleResponse struct for ListRoleResponse type ListRoleResponse struct { - Roles []IpMessagingV1Role `json:"roles,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Roles []IpMessagingV1Role `json:"roles,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_service_response.go b/rest/ip_messaging/v1/model_list_service_response.go index 3a2e5e095..4ce0f31e9 100644 --- a/rest/ip_messaging/v1/model_list_service_response.go +++ b/rest/ip_messaging/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []IpMessagingV1Service `json:"services,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Services []IpMessagingV1Service `json:"services,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_user_channel_response.go b/rest/ip_messaging/v1/model_list_user_channel_response.go index 7ce8cb47f..614f17792 100644 --- a/rest/ip_messaging/v1/model_list_user_channel_response.go +++ b/rest/ip_messaging/v1/model_list_user_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserChannelResponse struct for ListUserChannelResponse type ListUserChannelResponse struct { Channels []IpMessagingV1UserChannel `json:"channels,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/model_list_user_response.go b/rest/ip_messaging/v1/model_list_user_response.go index 541322d13..ec7c71cfa 100644 --- a/rest/ip_messaging/v1/model_list_user_response.go +++ b/rest/ip_messaging/v1/model_list_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserResponse struct for ListUserResponse type ListUserResponse struct { - Users []IpMessagingV1User `json:"users,omitempty"` - Meta ListChannelResponseMeta `json:"meta,omitempty"` + Users []IpMessagingV1User `json:"users,omitempty"` + Meta ListChannelResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v1/services.go b/rest/ip_messaging/v1/services.go index a1370fc84..b1e11f025 100644 --- a/rest/ip_messaging/v1/services.go +++ b/rest/ip_messaging/v1/services.go @@ -18,137 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateService(params *CreateServiceParams) (*IpMessagingV1Service, error) { - path := "/v1/Services" + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchService(Sid string) (*IpMessagingV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchService(Sid string, ) (*IpMessagingV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &IpMessagingV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +195,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan IpMessagingV return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan IpMessagingV1Service, errorChannel chan error) { curRecord := 1 @@ -220,536 +227,538 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` - // - DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` - // - DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` - // - ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` - // - ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` - // - TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` - // - ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` - // - NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` - // - NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` - // - NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` - // - NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` - // - NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` - // - NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` - // - NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` - // - NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` - // - PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` - // - PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` - // - WebhookMethod *string `json:"WebhookMethod,omitempty"` - // - WebhookFilters *[]string `json:"WebhookFilters,omitempty"` - // - WebhooksOnMessageSendUrl *string `json:"Webhooks.OnMessageSend.Url,omitempty"` - // - WebhooksOnMessageSendMethod *string `json:"Webhooks.OnMessageSend.Method,omitempty"` - // - WebhooksOnMessageUpdateUrl *string `json:"Webhooks.OnMessageUpdate.Url,omitempty"` - // - WebhooksOnMessageUpdateMethod *string `json:"Webhooks.OnMessageUpdate.Method,omitempty"` - // - WebhooksOnMessageRemoveUrl *string `json:"Webhooks.OnMessageRemove.Url,omitempty"` - // - WebhooksOnMessageRemoveMethod *string `json:"Webhooks.OnMessageRemove.Method,omitempty"` - // - WebhooksOnChannelAddUrl *string `json:"Webhooks.OnChannelAdd.Url,omitempty"` - // - WebhooksOnChannelAddMethod *string `json:"Webhooks.OnChannelAdd.Method,omitempty"` - // - WebhooksOnChannelDestroyUrl *string `json:"Webhooks.OnChannelDestroy.Url,omitempty"` - // - WebhooksOnChannelDestroyMethod *string `json:"Webhooks.OnChannelDestroy.Method,omitempty"` - // - WebhooksOnChannelUpdateUrl *string `json:"Webhooks.OnChannelUpdate.Url,omitempty"` - // - WebhooksOnChannelUpdateMethod *string `json:"Webhooks.OnChannelUpdate.Method,omitempty"` - // - WebhooksOnMemberAddUrl *string `json:"Webhooks.OnMemberAdd.Url,omitempty"` - // - WebhooksOnMemberAddMethod *string `json:"Webhooks.OnMemberAdd.Method,omitempty"` - // - WebhooksOnMemberRemoveUrl *string `json:"Webhooks.OnMemberRemove.Url,omitempty"` - // - WebhooksOnMemberRemoveMethod *string `json:"Webhooks.OnMemberRemove.Method,omitempty"` - // - WebhooksOnMessageSentUrl *string `json:"Webhooks.OnMessageSent.Url,omitempty"` - // - WebhooksOnMessageSentMethod *string `json:"Webhooks.OnMessageSent.Method,omitempty"` - // - WebhooksOnMessageUpdatedUrl *string `json:"Webhooks.OnMessageUpdated.Url,omitempty"` - // - WebhooksOnMessageUpdatedMethod *string `json:"Webhooks.OnMessageUpdated.Method,omitempty"` - // - WebhooksOnMessageRemovedUrl *string `json:"Webhooks.OnMessageRemoved.Url,omitempty"` - // - WebhooksOnMessageRemovedMethod *string `json:"Webhooks.OnMessageRemoved.Method,omitempty"` - // - WebhooksOnChannelAddedUrl *string `json:"Webhooks.OnChannelAdded.Url,omitempty"` - // - WebhooksOnChannelAddedMethod *string `json:"Webhooks.OnChannelAdded.Method,omitempty"` - // - WebhooksOnChannelDestroyedUrl *string `json:"Webhooks.OnChannelDestroyed.Url,omitempty"` - // - WebhooksOnChannelDestroyedMethod *string `json:"Webhooks.OnChannelDestroyed.Method,omitempty"` - // - WebhooksOnChannelUpdatedUrl *string `json:"Webhooks.OnChannelUpdated.Url,omitempty"` - // - WebhooksOnChannelUpdatedMethod *string `json:"Webhooks.OnChannelUpdated.Method,omitempty"` - // - WebhooksOnMemberAddedUrl *string `json:"Webhooks.OnMemberAdded.Url,omitempty"` - // - WebhooksOnMemberAddedMethod *string `json:"Webhooks.OnMemberAdded.Method,omitempty"` - // - WebhooksOnMemberRemovedUrl *string `json:"Webhooks.OnMemberRemoved.Url,omitempty"` - // - WebhooksOnMemberRemovedMethod *string `json:"Webhooks.OnMemberRemoved.Method,omitempty"` - // - LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` - // - LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) *UpdateServiceParams { - params.DefaultServiceRoleSid = &DefaultServiceRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) *UpdateServiceParams { - params.DefaultChannelRoleSid = &DefaultChannelRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) *UpdateServiceParams { - params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid - return params -} -func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) *UpdateServiceParams { - params.ReadStatusEnabled = &ReadStatusEnabled - return params -} -func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) *UpdateServiceParams { - params.ReachabilityEnabled = &ReachabilityEnabled - return params -} -func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) *UpdateServiceParams { - params.TypingIndicatorTimeout = &TypingIndicatorTimeout - return params -} -func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) *UpdateServiceParams { - params.ConsumptionReportInterval = &ConsumptionReportInterval - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) *UpdateServiceParams { - params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) *UpdateServiceParams { - params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) *UpdateServiceParams { - params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) *UpdateServiceParams { - params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) *UpdateServiceParams { - params.PreWebhookUrl = &PreWebhookUrl - return params -} -func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) *UpdateServiceParams { - params.PostWebhookUrl = &PostWebhookUrl - return params -} -func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) *UpdateServiceParams { - params.WebhookMethod = &WebhookMethod - return params -} -func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) *UpdateServiceParams { - params.WebhookFilters = &WebhookFilters - return params -} -func (params *UpdateServiceParams) SetWebhooksOnMessageSendUrl(WebhooksOnMessageSendUrl string) *UpdateServiceParams { - params.WebhooksOnMessageSendUrl = &WebhooksOnMessageSendUrl - return params -} -func (params *UpdateServiceParams) SetWebhooksOnMessageSendMethod(WebhooksOnMessageSendMethod string) *UpdateServiceParams { - params.WebhooksOnMessageSendMethod = &WebhooksOnMessageSendMethod - return params -} -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateUrl(WebhooksOnMessageUpdateUrl string) *UpdateServiceParams { - params.WebhooksOnMessageUpdateUrl = &WebhooksOnMessageUpdateUrl - return params + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` + // + DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` + // + DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` + // + ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` + // + ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` + // + TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` + // + ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` + // + NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` + // + NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` + // + NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` + // + NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` + // + NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` + // + NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` + // + NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` + // + NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` + // + PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` + // + PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` + // + WebhookMethod *string `json:"WebhookMethod,omitempty"` + // + WebhookFilters *[]string `json:"WebhookFilters,omitempty"` + // + WebhooksOnMessageSendUrl *string `json:"Webhooks.OnMessageSend.Url,omitempty"` + // + WebhooksOnMessageSendMethod *string `json:"Webhooks.OnMessageSend.Method,omitempty"` + // + WebhooksOnMessageUpdateUrl *string `json:"Webhooks.OnMessageUpdate.Url,omitempty"` + // + WebhooksOnMessageUpdateMethod *string `json:"Webhooks.OnMessageUpdate.Method,omitempty"` + // + WebhooksOnMessageRemoveUrl *string `json:"Webhooks.OnMessageRemove.Url,omitempty"` + // + WebhooksOnMessageRemoveMethod *string `json:"Webhooks.OnMessageRemove.Method,omitempty"` + // + WebhooksOnChannelAddUrl *string `json:"Webhooks.OnChannelAdd.Url,omitempty"` + // + WebhooksOnChannelAddMethod *string `json:"Webhooks.OnChannelAdd.Method,omitempty"` + // + WebhooksOnChannelDestroyUrl *string `json:"Webhooks.OnChannelDestroy.Url,omitempty"` + // + WebhooksOnChannelDestroyMethod *string `json:"Webhooks.OnChannelDestroy.Method,omitempty"` + // + WebhooksOnChannelUpdateUrl *string `json:"Webhooks.OnChannelUpdate.Url,omitempty"` + // + WebhooksOnChannelUpdateMethod *string `json:"Webhooks.OnChannelUpdate.Method,omitempty"` + // + WebhooksOnMemberAddUrl *string `json:"Webhooks.OnMemberAdd.Url,omitempty"` + // + WebhooksOnMemberAddMethod *string `json:"Webhooks.OnMemberAdd.Method,omitempty"` + // + WebhooksOnMemberRemoveUrl *string `json:"Webhooks.OnMemberRemove.Url,omitempty"` + // + WebhooksOnMemberRemoveMethod *string `json:"Webhooks.OnMemberRemove.Method,omitempty"` + // + WebhooksOnMessageSentUrl *string `json:"Webhooks.OnMessageSent.Url,omitempty"` + // + WebhooksOnMessageSentMethod *string `json:"Webhooks.OnMessageSent.Method,omitempty"` + // + WebhooksOnMessageUpdatedUrl *string `json:"Webhooks.OnMessageUpdated.Url,omitempty"` + // + WebhooksOnMessageUpdatedMethod *string `json:"Webhooks.OnMessageUpdated.Method,omitempty"` + // + WebhooksOnMessageRemovedUrl *string `json:"Webhooks.OnMessageRemoved.Url,omitempty"` + // + WebhooksOnMessageRemovedMethod *string `json:"Webhooks.OnMessageRemoved.Method,omitempty"` + // + WebhooksOnChannelAddedUrl *string `json:"Webhooks.OnChannelAdded.Url,omitempty"` + // + WebhooksOnChannelAddedMethod *string `json:"Webhooks.OnChannelAdded.Method,omitempty"` + // + WebhooksOnChannelDestroyedUrl *string `json:"Webhooks.OnChannelDestroyed.Url,omitempty"` + // + WebhooksOnChannelDestroyedMethod *string `json:"Webhooks.OnChannelDestroyed.Method,omitempty"` + // + WebhooksOnChannelUpdatedUrl *string `json:"Webhooks.OnChannelUpdated.Url,omitempty"` + // + WebhooksOnChannelUpdatedMethod *string `json:"Webhooks.OnChannelUpdated.Method,omitempty"` + // + WebhooksOnMemberAddedUrl *string `json:"Webhooks.OnMemberAdded.Url,omitempty"` + // + WebhooksOnMemberAddedMethod *string `json:"Webhooks.OnMemberAdded.Method,omitempty"` + // + WebhooksOnMemberRemovedUrl *string `json:"Webhooks.OnMemberRemoved.Url,omitempty"` + // + WebhooksOnMemberRemovedMethod *string `json:"Webhooks.OnMemberRemoved.Method,omitempty"` + // + LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` + // + LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) (*UpdateServiceParams){ + params.DefaultServiceRoleSid = &DefaultServiceRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelRoleSid = &DefaultChannelRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid + return params +} +func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) (*UpdateServiceParams){ + params.ReadStatusEnabled = &ReadStatusEnabled + return params +} +func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) (*UpdateServiceParams){ + params.ReachabilityEnabled = &ReachabilityEnabled + return params +} +func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) (*UpdateServiceParams){ + params.TypingIndicatorTimeout = &TypingIndicatorTimeout + return params +} +func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) (*UpdateServiceParams){ + params.ConsumptionReportInterval = &ConsumptionReportInterval + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) (*UpdateServiceParams){ + params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) (*UpdateServiceParams){ + params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) (*UpdateServiceParams){ + params.PreWebhookUrl = &PreWebhookUrl + return params +} +func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) (*UpdateServiceParams){ + params.PostWebhookUrl = &PostWebhookUrl + return params +} +func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) (*UpdateServiceParams){ + params.WebhookMethod = &WebhookMethod + return params +} +func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) (*UpdateServiceParams){ + params.WebhookFilters = &WebhookFilters + return params +} +func (params *UpdateServiceParams) SetWebhooksOnMessageSendUrl(WebhooksOnMessageSendUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageSendUrl = &WebhooksOnMessageSendUrl + return params +} +func (params *UpdateServiceParams) SetWebhooksOnMessageSendMethod(WebhooksOnMessageSendMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageSendMethod = &WebhooksOnMessageSendMethod + return params +} +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateUrl(WebhooksOnMessageUpdateUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdateUrl = &WebhooksOnMessageUpdateUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateMethod(WebhooksOnMessageUpdateMethod string) *UpdateServiceParams { - params.WebhooksOnMessageUpdateMethod = &WebhooksOnMessageUpdateMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdateMethod(WebhooksOnMessageUpdateMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdateMethod = &WebhooksOnMessageUpdateMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveUrl(WebhooksOnMessageRemoveUrl string) *UpdateServiceParams { - params.WebhooksOnMessageRemoveUrl = &WebhooksOnMessageRemoveUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveUrl(WebhooksOnMessageRemoveUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemoveUrl = &WebhooksOnMessageRemoveUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveMethod(WebhooksOnMessageRemoveMethod string) *UpdateServiceParams { - params.WebhooksOnMessageRemoveMethod = &WebhooksOnMessageRemoveMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemoveMethod(WebhooksOnMessageRemoveMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemoveMethod = &WebhooksOnMessageRemoveMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddUrl(WebhooksOnChannelAddUrl string) *UpdateServiceParams { - params.WebhooksOnChannelAddUrl = &WebhooksOnChannelAddUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddUrl(WebhooksOnChannelAddUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddUrl = &WebhooksOnChannelAddUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddMethod(WebhooksOnChannelAddMethod string) *UpdateServiceParams { - params.WebhooksOnChannelAddMethod = &WebhooksOnChannelAddMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddMethod(WebhooksOnChannelAddMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddMethod = &WebhooksOnChannelAddMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyUrl(WebhooksOnChannelDestroyUrl string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyUrl = &WebhooksOnChannelDestroyUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyUrl(WebhooksOnChannelDestroyUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyUrl = &WebhooksOnChannelDestroyUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyMethod(WebhooksOnChannelDestroyMethod string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyMethod = &WebhooksOnChannelDestroyMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyMethod(WebhooksOnChannelDestroyMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyMethod = &WebhooksOnChannelDestroyMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateUrl(WebhooksOnChannelUpdateUrl string) *UpdateServiceParams { - params.WebhooksOnChannelUpdateUrl = &WebhooksOnChannelUpdateUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateUrl(WebhooksOnChannelUpdateUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdateUrl = &WebhooksOnChannelUpdateUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateMethod(WebhooksOnChannelUpdateMethod string) *UpdateServiceParams { - params.WebhooksOnChannelUpdateMethod = &WebhooksOnChannelUpdateMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdateMethod(WebhooksOnChannelUpdateMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdateMethod = &WebhooksOnChannelUpdateMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddUrl(WebhooksOnMemberAddUrl string) *UpdateServiceParams { - params.WebhooksOnMemberAddUrl = &WebhooksOnMemberAddUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddUrl(WebhooksOnMemberAddUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddUrl = &WebhooksOnMemberAddUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddMethod(WebhooksOnMemberAddMethod string) *UpdateServiceParams { - params.WebhooksOnMemberAddMethod = &WebhooksOnMemberAddMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddMethod(WebhooksOnMemberAddMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddMethod = &WebhooksOnMemberAddMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveUrl(WebhooksOnMemberRemoveUrl string) *UpdateServiceParams { - params.WebhooksOnMemberRemoveUrl = &WebhooksOnMemberRemoveUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveUrl(WebhooksOnMemberRemoveUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemoveUrl = &WebhooksOnMemberRemoveUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveMethod(WebhooksOnMemberRemoveMethod string) *UpdateServiceParams { - params.WebhooksOnMemberRemoveMethod = &WebhooksOnMemberRemoveMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemoveMethod(WebhooksOnMemberRemoveMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemoveMethod = &WebhooksOnMemberRemoveMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageSentUrl(WebhooksOnMessageSentUrl string) *UpdateServiceParams { - params.WebhooksOnMessageSentUrl = &WebhooksOnMessageSentUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageSentUrl(WebhooksOnMessageSentUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageSentUrl = &WebhooksOnMessageSentUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageSentMethod(WebhooksOnMessageSentMethod string) *UpdateServiceParams { - params.WebhooksOnMessageSentMethod = &WebhooksOnMessageSentMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageSentMethod(WebhooksOnMessageSentMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageSentMethod = &WebhooksOnMessageSentMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedUrl(WebhooksOnMessageUpdatedUrl string) *UpdateServiceParams { - params.WebhooksOnMessageUpdatedUrl = &WebhooksOnMessageUpdatedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedUrl(WebhooksOnMessageUpdatedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdatedUrl = &WebhooksOnMessageUpdatedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedMethod(WebhooksOnMessageUpdatedMethod string) *UpdateServiceParams { - params.WebhooksOnMessageUpdatedMethod = &WebhooksOnMessageUpdatedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageUpdatedMethod(WebhooksOnMessageUpdatedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageUpdatedMethod = &WebhooksOnMessageUpdatedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedUrl(WebhooksOnMessageRemovedUrl string) *UpdateServiceParams { - params.WebhooksOnMessageRemovedUrl = &WebhooksOnMessageRemovedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedUrl(WebhooksOnMessageRemovedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemovedUrl = &WebhooksOnMessageRemovedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedMethod(WebhooksOnMessageRemovedMethod string) *UpdateServiceParams { - params.WebhooksOnMessageRemovedMethod = &WebhooksOnMessageRemovedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMessageRemovedMethod(WebhooksOnMessageRemovedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMessageRemovedMethod = &WebhooksOnMessageRemovedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddedUrl(WebhooksOnChannelAddedUrl string) *UpdateServiceParams { - params.WebhooksOnChannelAddedUrl = &WebhooksOnChannelAddedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddedUrl(WebhooksOnChannelAddedUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddedUrl = &WebhooksOnChannelAddedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelAddedMethod(WebhooksOnChannelAddedMethod string) *UpdateServiceParams { - params.WebhooksOnChannelAddedMethod = &WebhooksOnChannelAddedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelAddedMethod(WebhooksOnChannelAddedMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelAddedMethod = &WebhooksOnChannelAddedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedUrl(WebhooksOnChannelDestroyedUrl string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyedUrl = &WebhooksOnChannelDestroyedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedUrl(WebhooksOnChannelDestroyedUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyedUrl = &WebhooksOnChannelDestroyedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedMethod(WebhooksOnChannelDestroyedMethod string) *UpdateServiceParams { - params.WebhooksOnChannelDestroyedMethod = &WebhooksOnChannelDestroyedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelDestroyedMethod(WebhooksOnChannelDestroyedMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelDestroyedMethod = &WebhooksOnChannelDestroyedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedUrl(WebhooksOnChannelUpdatedUrl string) *UpdateServiceParams { - params.WebhooksOnChannelUpdatedUrl = &WebhooksOnChannelUpdatedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedUrl(WebhooksOnChannelUpdatedUrl string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdatedUrl = &WebhooksOnChannelUpdatedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedMethod(WebhooksOnChannelUpdatedMethod string) *UpdateServiceParams { - params.WebhooksOnChannelUpdatedMethod = &WebhooksOnChannelUpdatedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnChannelUpdatedMethod(WebhooksOnChannelUpdatedMethod string) (*UpdateServiceParams){ + params.WebhooksOnChannelUpdatedMethod = &WebhooksOnChannelUpdatedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddedUrl(WebhooksOnMemberAddedUrl string) *UpdateServiceParams { - params.WebhooksOnMemberAddedUrl = &WebhooksOnMemberAddedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddedUrl(WebhooksOnMemberAddedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddedUrl = &WebhooksOnMemberAddedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberAddedMethod(WebhooksOnMemberAddedMethod string) *UpdateServiceParams { - params.WebhooksOnMemberAddedMethod = &WebhooksOnMemberAddedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberAddedMethod(WebhooksOnMemberAddedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberAddedMethod = &WebhooksOnMemberAddedMethod + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedUrl(WebhooksOnMemberRemovedUrl string) *UpdateServiceParams { - params.WebhooksOnMemberRemovedUrl = &WebhooksOnMemberRemovedUrl - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedUrl(WebhooksOnMemberRemovedUrl string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemovedUrl = &WebhooksOnMemberRemovedUrl + return params } -func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedMethod(WebhooksOnMemberRemovedMethod string) *UpdateServiceParams { - params.WebhooksOnMemberRemovedMethod = &WebhooksOnMemberRemovedMethod - return params +func (params *UpdateServiceParams) SetWebhooksOnMemberRemovedMethod(WebhooksOnMemberRemovedMethod string) (*UpdateServiceParams){ + params.WebhooksOnMemberRemovedMethod = &WebhooksOnMemberRemovedMethod + return params } -func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) *UpdateServiceParams { - params.LimitsChannelMembers = &LimitsChannelMembers - return params +func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) (*UpdateServiceParams){ + params.LimitsChannelMembers = &LimitsChannelMembers + return params } -func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) *UpdateServiceParams { - params.LimitsUserChannels = &LimitsUserChannels - return params +func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) (*UpdateServiceParams){ + params.LimitsUserChannels = &LimitsUserChannels + return params } -// +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*IpMessagingV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DefaultServiceRoleSid != nil { - data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) - } - if params != nil && params.DefaultChannelRoleSid != nil { - data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) - } - if params != nil && params.DefaultChannelCreatorRoleSid != nil { - data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) - } - if params != nil && params.ReadStatusEnabled != nil { - data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) - } - if params != nil && params.ReachabilityEnabled != nil { - data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) - } - if params != nil && params.TypingIndicatorTimeout != nil { - data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) - } - if params != nil && params.ConsumptionReportInterval != nil { - data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) - } - if params != nil && params.NotificationsNewMessageEnabled != nil { - data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) - } - if params != nil && params.NotificationsNewMessageTemplate != nil { - data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) - } - if params != nil && params.NotificationsAddedToChannelEnabled != nil { - data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) - } - if params != nil && params.NotificationsAddedToChannelTemplate != nil { - data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) - } - if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { - data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) - } - if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { - data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) - } - if params != nil && params.NotificationsInvitedToChannelEnabled != nil { - data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) - } - if params != nil && params.NotificationsInvitedToChannelTemplate != nil { - data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) - } - if params != nil && params.PreWebhookUrl != nil { - data.Set("PreWebhookUrl", *params.PreWebhookUrl) - } - if params != nil && params.PostWebhookUrl != nil { - data.Set("PostWebhookUrl", *params.PostWebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - if params != nil && params.WebhookFilters != nil { - for _, item := range *params.WebhookFilters { - data.Add("WebhookFilters", item) - } - } - if params != nil && params.WebhooksOnMessageSendUrl != nil { - data.Set("Webhooks.OnMessageSend.Url", *params.WebhooksOnMessageSendUrl) - } - if params != nil && params.WebhooksOnMessageSendMethod != nil { - data.Set("Webhooks.OnMessageSend.Method", *params.WebhooksOnMessageSendMethod) - } - if params != nil && params.WebhooksOnMessageUpdateUrl != nil { - data.Set("Webhooks.OnMessageUpdate.Url", *params.WebhooksOnMessageUpdateUrl) - } - if params != nil && params.WebhooksOnMessageUpdateMethod != nil { - data.Set("Webhooks.OnMessageUpdate.Method", *params.WebhooksOnMessageUpdateMethod) - } - if params != nil && params.WebhooksOnMessageRemoveUrl != nil { - data.Set("Webhooks.OnMessageRemove.Url", *params.WebhooksOnMessageRemoveUrl) - } - if params != nil && params.WebhooksOnMessageRemoveMethod != nil { - data.Set("Webhooks.OnMessageRemove.Method", *params.WebhooksOnMessageRemoveMethod) - } - if params != nil && params.WebhooksOnChannelAddUrl != nil { - data.Set("Webhooks.OnChannelAdd.Url", *params.WebhooksOnChannelAddUrl) - } - if params != nil && params.WebhooksOnChannelAddMethod != nil { - data.Set("Webhooks.OnChannelAdd.Method", *params.WebhooksOnChannelAddMethod) - } - if params != nil && params.WebhooksOnChannelDestroyUrl != nil { - data.Set("Webhooks.OnChannelDestroy.Url", *params.WebhooksOnChannelDestroyUrl) - } - if params != nil && params.WebhooksOnChannelDestroyMethod != nil { - data.Set("Webhooks.OnChannelDestroy.Method", *params.WebhooksOnChannelDestroyMethod) - } - if params != nil && params.WebhooksOnChannelUpdateUrl != nil { - data.Set("Webhooks.OnChannelUpdate.Url", *params.WebhooksOnChannelUpdateUrl) - } - if params != nil && params.WebhooksOnChannelUpdateMethod != nil { - data.Set("Webhooks.OnChannelUpdate.Method", *params.WebhooksOnChannelUpdateMethod) - } - if params != nil && params.WebhooksOnMemberAddUrl != nil { - data.Set("Webhooks.OnMemberAdd.Url", *params.WebhooksOnMemberAddUrl) - } - if params != nil && params.WebhooksOnMemberAddMethod != nil { - data.Set("Webhooks.OnMemberAdd.Method", *params.WebhooksOnMemberAddMethod) - } - if params != nil && params.WebhooksOnMemberRemoveUrl != nil { - data.Set("Webhooks.OnMemberRemove.Url", *params.WebhooksOnMemberRemoveUrl) - } - if params != nil && params.WebhooksOnMemberRemoveMethod != nil { - data.Set("Webhooks.OnMemberRemove.Method", *params.WebhooksOnMemberRemoveMethod) - } - if params != nil && params.WebhooksOnMessageSentUrl != nil { - data.Set("Webhooks.OnMessageSent.Url", *params.WebhooksOnMessageSentUrl) - } - if params != nil && params.WebhooksOnMessageSentMethod != nil { - data.Set("Webhooks.OnMessageSent.Method", *params.WebhooksOnMessageSentMethod) - } - if params != nil && params.WebhooksOnMessageUpdatedUrl != nil { - data.Set("Webhooks.OnMessageUpdated.Url", *params.WebhooksOnMessageUpdatedUrl) - } - if params != nil && params.WebhooksOnMessageUpdatedMethod != nil { - data.Set("Webhooks.OnMessageUpdated.Method", *params.WebhooksOnMessageUpdatedMethod) - } - if params != nil && params.WebhooksOnMessageRemovedUrl != nil { - data.Set("Webhooks.OnMessageRemoved.Url", *params.WebhooksOnMessageRemovedUrl) - } - if params != nil && params.WebhooksOnMessageRemovedMethod != nil { - data.Set("Webhooks.OnMessageRemoved.Method", *params.WebhooksOnMessageRemovedMethod) - } - if params != nil && params.WebhooksOnChannelAddedUrl != nil { - data.Set("Webhooks.OnChannelAdded.Url", *params.WebhooksOnChannelAddedUrl) - } - if params != nil && params.WebhooksOnChannelAddedMethod != nil { - data.Set("Webhooks.OnChannelAdded.Method", *params.WebhooksOnChannelAddedMethod) - } - if params != nil && params.WebhooksOnChannelDestroyedUrl != nil { - data.Set("Webhooks.OnChannelDestroyed.Url", *params.WebhooksOnChannelDestroyedUrl) - } - if params != nil && params.WebhooksOnChannelDestroyedMethod != nil { - data.Set("Webhooks.OnChannelDestroyed.Method", *params.WebhooksOnChannelDestroyedMethod) - } - if params != nil && params.WebhooksOnChannelUpdatedUrl != nil { - data.Set("Webhooks.OnChannelUpdated.Url", *params.WebhooksOnChannelUpdatedUrl) - } - if params != nil && params.WebhooksOnChannelUpdatedMethod != nil { - data.Set("Webhooks.OnChannelUpdated.Method", *params.WebhooksOnChannelUpdatedMethod) - } - if params != nil && params.WebhooksOnMemberAddedUrl != nil { - data.Set("Webhooks.OnMemberAdded.Url", *params.WebhooksOnMemberAddedUrl) - } - if params != nil && params.WebhooksOnMemberAddedMethod != nil { - data.Set("Webhooks.OnMemberAdded.Method", *params.WebhooksOnMemberAddedMethod) - } - if params != nil && params.WebhooksOnMemberRemovedUrl != nil { - data.Set("Webhooks.OnMemberRemoved.Url", *params.WebhooksOnMemberRemovedUrl) - } - if params != nil && params.WebhooksOnMemberRemovedMethod != nil { - data.Set("Webhooks.OnMemberRemoved.Method", *params.WebhooksOnMemberRemovedMethod) - } - if params != nil && params.LimitsChannelMembers != nil { - data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) - } - if params != nil && params.LimitsUserChannels != nil { - data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IpMessagingV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DefaultServiceRoleSid != nil { + data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) + } + if params != nil && params.DefaultChannelRoleSid != nil { + data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) + } + if params != nil && params.DefaultChannelCreatorRoleSid != nil { + data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) + } + if params != nil && params.ReadStatusEnabled != nil { + data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) + } + if params != nil && params.ReachabilityEnabled != nil { + data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) + } + if params != nil && params.TypingIndicatorTimeout != nil { + data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) + } + if params != nil && params.ConsumptionReportInterval != nil { + data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) + } + if params != nil && params.NotificationsNewMessageEnabled != nil { + data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) + } + if params != nil && params.NotificationsNewMessageTemplate != nil { + data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) + } + if params != nil && params.NotificationsAddedToChannelEnabled != nil { + data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) + } + if params != nil && params.NotificationsAddedToChannelTemplate != nil { + data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) + } + if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { + data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) + } + if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { + data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) + } + if params != nil && params.NotificationsInvitedToChannelEnabled != nil { + data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) + } + if params != nil && params.NotificationsInvitedToChannelTemplate != nil { + data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) + } + if params != nil && params.PreWebhookUrl != nil { + data.Set("PreWebhookUrl", *params.PreWebhookUrl) + } + if params != nil && params.PostWebhookUrl != nil { + data.Set("PostWebhookUrl", *params.PostWebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + if params != nil && params.WebhookFilters != nil { + for _, item := range *params.WebhookFilters { + data.Add("WebhookFilters", item) + } + } + if params != nil && params.WebhooksOnMessageSendUrl != nil { + data.Set("Webhooks.OnMessageSend.Url", *params.WebhooksOnMessageSendUrl) + } + if params != nil && params.WebhooksOnMessageSendMethod != nil { + data.Set("Webhooks.OnMessageSend.Method", *params.WebhooksOnMessageSendMethod) + } + if params != nil && params.WebhooksOnMessageUpdateUrl != nil { + data.Set("Webhooks.OnMessageUpdate.Url", *params.WebhooksOnMessageUpdateUrl) + } + if params != nil && params.WebhooksOnMessageUpdateMethod != nil { + data.Set("Webhooks.OnMessageUpdate.Method", *params.WebhooksOnMessageUpdateMethod) + } + if params != nil && params.WebhooksOnMessageRemoveUrl != nil { + data.Set("Webhooks.OnMessageRemove.Url", *params.WebhooksOnMessageRemoveUrl) + } + if params != nil && params.WebhooksOnMessageRemoveMethod != nil { + data.Set("Webhooks.OnMessageRemove.Method", *params.WebhooksOnMessageRemoveMethod) + } + if params != nil && params.WebhooksOnChannelAddUrl != nil { + data.Set("Webhooks.OnChannelAdd.Url", *params.WebhooksOnChannelAddUrl) + } + if params != nil && params.WebhooksOnChannelAddMethod != nil { + data.Set("Webhooks.OnChannelAdd.Method", *params.WebhooksOnChannelAddMethod) + } + if params != nil && params.WebhooksOnChannelDestroyUrl != nil { + data.Set("Webhooks.OnChannelDestroy.Url", *params.WebhooksOnChannelDestroyUrl) + } + if params != nil && params.WebhooksOnChannelDestroyMethod != nil { + data.Set("Webhooks.OnChannelDestroy.Method", *params.WebhooksOnChannelDestroyMethod) + } + if params != nil && params.WebhooksOnChannelUpdateUrl != nil { + data.Set("Webhooks.OnChannelUpdate.Url", *params.WebhooksOnChannelUpdateUrl) + } + if params != nil && params.WebhooksOnChannelUpdateMethod != nil { + data.Set("Webhooks.OnChannelUpdate.Method", *params.WebhooksOnChannelUpdateMethod) + } + if params != nil && params.WebhooksOnMemberAddUrl != nil { + data.Set("Webhooks.OnMemberAdd.Url", *params.WebhooksOnMemberAddUrl) + } + if params != nil && params.WebhooksOnMemberAddMethod != nil { + data.Set("Webhooks.OnMemberAdd.Method", *params.WebhooksOnMemberAddMethod) + } + if params != nil && params.WebhooksOnMemberRemoveUrl != nil { + data.Set("Webhooks.OnMemberRemove.Url", *params.WebhooksOnMemberRemoveUrl) + } + if params != nil && params.WebhooksOnMemberRemoveMethod != nil { + data.Set("Webhooks.OnMemberRemove.Method", *params.WebhooksOnMemberRemoveMethod) + } + if params != nil && params.WebhooksOnMessageSentUrl != nil { + data.Set("Webhooks.OnMessageSent.Url", *params.WebhooksOnMessageSentUrl) + } + if params != nil && params.WebhooksOnMessageSentMethod != nil { + data.Set("Webhooks.OnMessageSent.Method", *params.WebhooksOnMessageSentMethod) + } + if params != nil && params.WebhooksOnMessageUpdatedUrl != nil { + data.Set("Webhooks.OnMessageUpdated.Url", *params.WebhooksOnMessageUpdatedUrl) + } + if params != nil && params.WebhooksOnMessageUpdatedMethod != nil { + data.Set("Webhooks.OnMessageUpdated.Method", *params.WebhooksOnMessageUpdatedMethod) + } + if params != nil && params.WebhooksOnMessageRemovedUrl != nil { + data.Set("Webhooks.OnMessageRemoved.Url", *params.WebhooksOnMessageRemovedUrl) + } + if params != nil && params.WebhooksOnMessageRemovedMethod != nil { + data.Set("Webhooks.OnMessageRemoved.Method", *params.WebhooksOnMessageRemovedMethod) + } + if params != nil && params.WebhooksOnChannelAddedUrl != nil { + data.Set("Webhooks.OnChannelAdded.Url", *params.WebhooksOnChannelAddedUrl) + } + if params != nil && params.WebhooksOnChannelAddedMethod != nil { + data.Set("Webhooks.OnChannelAdded.Method", *params.WebhooksOnChannelAddedMethod) + } + if params != nil && params.WebhooksOnChannelDestroyedUrl != nil { + data.Set("Webhooks.OnChannelDestroyed.Url", *params.WebhooksOnChannelDestroyedUrl) + } + if params != nil && params.WebhooksOnChannelDestroyedMethod != nil { + data.Set("Webhooks.OnChannelDestroyed.Method", *params.WebhooksOnChannelDestroyedMethod) + } + if params != nil && params.WebhooksOnChannelUpdatedUrl != nil { + data.Set("Webhooks.OnChannelUpdated.Url", *params.WebhooksOnChannelUpdatedUrl) + } + if params != nil && params.WebhooksOnChannelUpdatedMethod != nil { + data.Set("Webhooks.OnChannelUpdated.Method", *params.WebhooksOnChannelUpdatedMethod) + } + if params != nil && params.WebhooksOnMemberAddedUrl != nil { + data.Set("Webhooks.OnMemberAdded.Url", *params.WebhooksOnMemberAddedUrl) + } + if params != nil && params.WebhooksOnMemberAddedMethod != nil { + data.Set("Webhooks.OnMemberAdded.Method", *params.WebhooksOnMemberAddedMethod) + } + if params != nil && params.WebhooksOnMemberRemovedUrl != nil { + data.Set("Webhooks.OnMemberRemoved.Url", *params.WebhooksOnMemberRemovedUrl) + } + if params != nil && params.WebhooksOnMemberRemovedMethod != nil { + data.Set("Webhooks.OnMemberRemoved.Method", *params.WebhooksOnMemberRemovedMethod) + } + if params != nil && params.LimitsChannelMembers != nil { + data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) + } + if params != nil && params.LimitsUserChannels != nil { + data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/ip_messaging/v1/services_channels.go b/rest/ip_messaging/v1/services_channels.go index 22d296a9e..0e9d0c16c 100644 --- a/rest/ip_messaging/v1/services_channels.go +++ b/rest/ip_messaging/v1/services_channels.go @@ -18,180 +18,185 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannel' type CreateChannelParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - UniqueName *string `json:"UniqueName,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - Type *string `json:"Type,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + UniqueName *string `json:"UniqueName,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + Type *string `json:"Type,omitempty"` } -func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) *CreateChannelParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) (*CreateChannelParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateChannelParams) SetUniqueName(UniqueName string) *CreateChannelParams { - params.UniqueName = &UniqueName - return params +func (params *CreateChannelParams) SetUniqueName(UniqueName string) (*CreateChannelParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateChannelParams) SetAttributes(Attributes string) *CreateChannelParams { - params.Attributes = &Attributes - return params +func (params *CreateChannelParams) SetAttributes(Attributes string) (*CreateChannelParams){ + params.Attributes = &Attributes + return params } -func (params *CreateChannelParams) SetType(Type string) *CreateChannelParams { - params.Type = &Type - return params +func (params *CreateChannelParams) SetType(Type string) (*CreateChannelParams){ + params.Type = &Type + return params } -// +// func (c *ApiService) CreateChannel(ServiceSid string, params *CreateChannelParams) (*IpMessagingV1Channel, error) { - path := "/v1/Services/{ServiceSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Channels" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteChannel(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return ps, err -} + defer resp.Body.Close() -// -func (c *ApiService) DeleteChannel(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchChannel(ServiceSid string, Sid string, ) (*IpMessagingV1Channel, error) { + path := "/v1/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchChannel(ServiceSid string, Sid string) (*IpMessagingV1Channel, error) { - path := "/v1/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListChannel' type ListChannelParams struct { - // - Type *[]string `json:"Type,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Type *[]string `json:"Type,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelParams) SetType(Type []string) *ListChannelParams { - params.Type = &Type - return params +func (params *ListChannelParams) SetType(Type []string) (*ListChannelParams){ + params.Type = &Type + return params } -func (params *ListChannelParams) SetPageSize(PageSize int) *ListChannelParams { - params.PageSize = &PageSize - return params +func (params *ListChannelParams) SetPageSize(PageSize int) (*ListChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelParams) SetLimit(Limit int) *ListChannelParams { - params.Limit = &Limit - return params +func (params *ListChannelParams) SetLimit(Limit int) (*ListChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Channel records from the API. Request is executed immediately. func (c *ApiService) PageChannel(ServiceSid string, params *ListChannelParams, pageToken, pageNumber string) (*ListChannelResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Type != nil { - for _, item := range *params.Type { - data.Add("Type", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Channels" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + for _, item := range *params.Type { + data.Add("Type", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Channel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -232,6 +237,7 @@ func (c *ApiService) StreamChannel(ServiceSid string, params *ListChannelParams) return recordChannel, errorChannel } + func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListChannelParams, recordChannel chan IpMessagingV1Channel, errorChannel chan error) { curRecord := 1 @@ -263,76 +269,78 @@ func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListCh } func (c *ApiService) getNextListChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChannel' type UpdateChannelParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - UniqueName *string `json:"UniqueName,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + UniqueName *string `json:"UniqueName,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` } -func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) *UpdateChannelParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) (*UpdateChannelParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateChannelParams) SetUniqueName(UniqueName string) *UpdateChannelParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateChannelParams) SetUniqueName(UniqueName string) (*UpdateChannelParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateChannelParams) SetAttributes(Attributes string) *UpdateChannelParams { - params.Attributes = &Attributes - return params +func (params *UpdateChannelParams) SetAttributes(Attributes string) (*UpdateChannelParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) UpdateChannel(ServiceSid string, Sid string, params *UpdateChannelParams) (*IpMessagingV1Channel, error) { - path := "/v1/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v1/services_channels_invites.go b/rest/ip_messaging/v1/services_channels_invites.go index 30253d330..3885d5568 100644 --- a/rest/ip_messaging/v1/services_channels_invites.go +++ b/rest/ip_messaging/v1/services_channels_invites.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInvite' type CreateInviteParams struct { - // - Identity *string `json:"Identity,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` + // + Identity *string `json:"Identity,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateInviteParams) SetIdentity(Identity string) *CreateInviteParams { - params.Identity = &Identity - return params +func (params *CreateInviteParams) SetIdentity(Identity string) (*CreateInviteParams){ + params.Identity = &Identity + return params } -func (params *CreateInviteParams) SetRoleSid(RoleSid string) *CreateInviteParams { - params.RoleSid = &RoleSid - return params +func (params *CreateInviteParams) SetRoleSid(RoleSid string) (*CreateInviteParams){ + params.RoleSid = &RoleSid + return params } -// +// func (c *ApiService) CreateInvite(ServiceSid string, ChannelSid string, params *CreateInviteParams) (*IpMessagingV1Invite, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV1Invite, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV1Invite, error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV1Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &IpMessagingV1Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListInvite' type ListInviteParams struct { - // - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInviteParams) SetIdentity(Identity []string) *ListInviteParams { - params.Identity = &Identity - return params +func (params *ListInviteParams) SetIdentity(Identity []string) (*ListInviteParams){ + params.Identity = &Identity + return params } -func (params *ListInviteParams) SetPageSize(PageSize int) *ListInviteParams { - params.PageSize = &PageSize - return params +func (params *ListInviteParams) SetPageSize(PageSize int) (*ListInviteParams){ + params.PageSize = &PageSize + return params } -func (params *ListInviteParams) SetLimit(Limit int) *ListInviteParams { - params.Limit = &Limit - return params +func (params *ListInviteParams) SetLimit(Limit int) (*ListInviteParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Invite records from the API. Request is executed immediately. func (c *ApiService) PageInvite(ServiceSid string, ChannelSid string, params *ListInviteParams, pageToken, pageNumber string) (*ListInviteResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Invite records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamInvite(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInviteParams, recordChannel chan IpMessagingV1Invite, errorChannel chan error) { curRecord := 1 @@ -249,19 +255,20 @@ func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInvi } func (c *ApiService) getNextListInviteResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/ip_messaging/v1/services_channels_members.go b/rest/ip_messaging/v1/services_channels_members.go index 77b1b4e90..97e252344 100644 --- a/rest/ip_messaging/v1/services_channels_members.go +++ b/rest/ip_messaging/v1/services_channels_members.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMember' type CreateMemberParams struct { - // - Identity *string `json:"Identity,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` + // + Identity *string `json:"Identity,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateMemberParams) SetIdentity(Identity string) *CreateMemberParams { - params.Identity = &Identity - return params +func (params *CreateMemberParams) SetIdentity(Identity string) (*CreateMemberParams){ + params.Identity = &Identity + return params } -func (params *CreateMemberParams) SetRoleSid(RoleSid string) *CreateMemberParams { - params.RoleSid = &RoleSid - return params +func (params *CreateMemberParams) SetRoleSid(RoleSid string) (*CreateMemberParams){ + params.RoleSid = &RoleSid + return params } -// +// func (c *ApiService) CreateMember(ServiceSid string, ChannelSid string, params *CreateMemberParams) (*IpMessagingV1Member, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV1Member, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV1Member, error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV1Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &IpMessagingV1Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMember' type ListMemberParams struct { - // - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMemberParams) SetIdentity(Identity []string) *ListMemberParams { - params.Identity = &Identity - return params +func (params *ListMemberParams) SetIdentity(Identity []string) (*ListMemberParams){ + params.Identity = &Identity + return params } -func (params *ListMemberParams) SetPageSize(PageSize int) *ListMemberParams { - params.PageSize = &PageSize - return params +func (params *ListMemberParams) SetPageSize(PageSize int) (*ListMemberParams){ + params.PageSize = &PageSize + return params } -func (params *ListMemberParams) SetLimit(Limit int) *ListMemberParams { - params.Limit = &Limit - return params +func (params *ListMemberParams) SetLimit(Limit int) (*ListMemberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Member records from the API. Request is executed immediately. func (c *ApiService) PageMember(ServiceSid string, ChannelSid string, params *ListMemberParams, pageToken, pageNumber string) (*ListMemberResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Member records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamMember(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemberParams, recordChannel chan IpMessagingV1Member, errorChannel chan error) { curRecord := 1 @@ -249,68 +255,70 @@ func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemb } func (c *ApiService) getNextListMemberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMember' type UpdateMemberParams struct { - // - RoleSid *string `json:"RoleSid,omitempty"` - // - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` } -func (params *UpdateMemberParams) SetRoleSid(RoleSid string) *UpdateMemberParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateMemberParams) SetRoleSid(RoleSid string) (*UpdateMemberParams){ + params.RoleSid = &RoleSid + return params } -func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *UpdateMemberParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params +func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*UpdateMemberParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params } -// +// func (c *ApiService) UpdateMember(ServiceSid string, ChannelSid string, Sid string, params *UpdateMemberParams) (*IpMessagingV1Member, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v1/services_channels_messages.go b/rest/ip_messaging/v1/services_channels_messages.go index 28f929dda..fdca98ce5 100644 --- a/rest/ip_messaging/v1/services_channels_messages.go +++ b/rest/ip_messaging/v1/services_channels_messages.go @@ -18,173 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessage' type CreateMessageParams struct { - // - Body *string `json:"Body,omitempty"` - // - From *string `json:"From,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` + // + Body *string `json:"Body,omitempty"` + // + From *string `json:"From,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` } -func (params *CreateMessageParams) SetBody(Body string) *CreateMessageParams { - params.Body = &Body - return params +func (params *CreateMessageParams) SetBody(Body string) (*CreateMessageParams){ + params.Body = &Body + return params } -func (params *CreateMessageParams) SetFrom(From string) *CreateMessageParams { - params.From = &From - return params +func (params *CreateMessageParams) SetFrom(From string) (*CreateMessageParams){ + params.From = &From + return params } -func (params *CreateMessageParams) SetAttributes(Attributes string) *CreateMessageParams { - params.Attributes = &Attributes - return params +func (params *CreateMessageParams) SetAttributes(Attributes string) (*CreateMessageParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) CreateMessage(ServiceSid string, ChannelSid string, params *CreateMessageParams) (*IpMessagingV1Message, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &IpMessagingV1Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV1Message, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV1Message, error) { + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV1Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListMessage' type ListMessageParams struct { - // - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessageParams) SetOrder(Order string) *ListMessageParams { - params.Order = &Order - return params +func (params *ListMessageParams) SetOrder(Order string) (*ListMessageParams){ + params.Order = &Order + return params } -func (params *ListMessageParams) SetPageSize(PageSize int) *ListMessageParams { - params.PageSize = &PageSize - return params +func (params *ListMessageParams) SetPageSize(PageSize int) (*ListMessageParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessageParams) SetLimit(Limit int) *ListMessageParams { - params.Limit = &Limit - return params +func (params *ListMessageParams) SetLimit(Limit int) (*ListMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Message records from the API. Request is executed immediately. func (c *ApiService) PageMessage(ServiceSid string, ChannelSid string, params *ListMessageParams, pageToken, pageNumber string) (*ListMessageResponse, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Message records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +230,7 @@ func (c *ApiService) StreamMessage(ServiceSid string, ChannelSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMessageParams, recordChannel chan IpMessagingV1Message, errorChannel chan error) { curRecord := 1 @@ -256,68 +262,70 @@ func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMe } func (c *ApiService) getNextListMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMessage' type UpdateMessageParams struct { - // - Body *string `json:"Body,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` + // + Body *string `json:"Body,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` } -func (params *UpdateMessageParams) SetBody(Body string) *UpdateMessageParams { - params.Body = &Body - return params +func (params *UpdateMessageParams) SetBody(Body string) (*UpdateMessageParams){ + params.Body = &Body + return params } -func (params *UpdateMessageParams) SetAttributes(Attributes string) *UpdateMessageParams { - params.Attributes = &Attributes - return params +func (params *UpdateMessageParams) SetAttributes(Attributes string) (*UpdateMessageParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) UpdateMessage(ServiceSid string, ChannelSid string, Sid string, params *UpdateMessageParams) (*IpMessagingV1Message, error) { - path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v1/services_roles.go b/rest/ip_messaging/v1/services_roles.go index 3d562e6c0..1bd6a1a5e 100644 --- a/rest/ip_messaging/v1/services_roles.go +++ b/rest/ip_messaging/v1/services_roles.go @@ -18,162 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRole' type CreateRoleParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // - Permission *[]string `json:"Permission,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // + Permission *[]string `json:"Permission,omitempty"` } -func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) *CreateRoleParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) (*CreateRoleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRoleParams) SetType(Type string) *CreateRoleParams { - params.Type = &Type - return params +func (params *CreateRoleParams) SetType(Type string) (*CreateRoleParams){ + params.Type = &Type + return params } -func (params *CreateRoleParams) SetPermission(Permission []string) *CreateRoleParams { - params.Permission = &Permission - return params +func (params *CreateRoleParams) SetPermission(Permission []string) (*CreateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) CreateRole(ServiceSid string, params *CreateRoleParams) (*IpMessagingV1Role, error) { - path := "/v1/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Roles" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteRole(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - ps := &IpMessagingV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteRole(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchRole(ServiceSid string, Sid string, ) (*IpMessagingV1Role, error) { + path := "/v1/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchRole(ServiceSid string, Sid string) (*IpMessagingV1Role, error) { - path := "/v1/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRole' type ListRoleParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoleParams) SetPageSize(PageSize int) *ListRoleParams { - params.PageSize = &PageSize - return params +func (params *ListRoleParams) SetPageSize(PageSize int) (*ListRoleParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoleParams) SetLimit(Limit int) *ListRoleParams { - params.Limit = &Limit - return params +func (params *ListRoleParams) SetLimit(Limit int) (*ListRoleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Role records from the API. Request is executed immediately. func (c *ApiService) PageRole(ServiceSid string, params *ListRoleParams, pageToken, pageNumber string) (*ListRoleResponse, error) { - path := "/v1/Services/{ServiceSid}/Roles" + path := "/v1/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Role records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -214,6 +219,7 @@ func (c *ApiService) StreamRole(ServiceSid string, params *ListRoleParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRoleParams, recordChannel chan IpMessagingV1Role, errorChannel chan error) { curRecord := 1 @@ -245,60 +251,62 @@ func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRolePara } func (c *ApiService) getNextListRoleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRole' type UpdateRoleParams struct { - // - Permission *[]string `json:"Permission,omitempty"` + // + Permission *[]string `json:"Permission,omitempty"` } -func (params *UpdateRoleParams) SetPermission(Permission []string) *UpdateRoleParams { - params.Permission = &Permission - return params +func (params *UpdateRoleParams) SetPermission(Permission []string) (*UpdateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) UpdateRole(ServiceSid string, Sid string, params *UpdateRoleParams) (*IpMessagingV1Role, error) { - path := "/v1/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v1/services_users.go b/rest/ip_messaging/v1/services_users.go index 8fe15c616..ab363a7f4 100644 --- a/rest/ip_messaging/v1/services_users.go +++ b/rest/ip_messaging/v1/services_users.go @@ -18,169 +18,174 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUser' type CreateUserParams struct { - // - Identity *string `json:"Identity,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // + Identity *string `json:"Identity,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateUserParams) SetIdentity(Identity string) *CreateUserParams { - params.Identity = &Identity - return params +func (params *CreateUserParams) SetIdentity(Identity string) (*CreateUserParams){ + params.Identity = &Identity + return params } -func (params *CreateUserParams) SetRoleSid(RoleSid string) *CreateUserParams { - params.RoleSid = &RoleSid - return params +func (params *CreateUserParams) SetRoleSid(RoleSid string) (*CreateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *CreateUserParams) SetAttributes(Attributes string) *CreateUserParams { - params.Attributes = &Attributes - return params +func (params *CreateUserParams) SetAttributes(Attributes string) (*CreateUserParams){ + params.Attributes = &Attributes + return params } -func (params *CreateUserParams) SetFriendlyName(FriendlyName string) *CreateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateUserParams) SetFriendlyName(FriendlyName string) (*CreateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateUser(ServiceSid string, params *CreateUserParams) (*IpMessagingV1User, error) { - path := "/v1/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Users" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteUser(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - ps := &IpMessagingV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteUser(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchUser(ServiceSid string, Sid string, ) (*IpMessagingV1User, error) { + path := "/v1/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchUser(ServiceSid string, Sid string) (*IpMessagingV1User, error) { - path := "/v1/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListUser' type ListUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserParams) SetPageSize(PageSize int) *ListUserParams { - params.PageSize = &PageSize - return params +func (params *ListUserParams) SetPageSize(PageSize int) (*ListUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserParams) SetLimit(Limit int) *ListUserParams { - params.Limit = &Limit - return params +func (params *ListUserParams) SetLimit(Limit int) (*ListUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of User records from the API. Request is executed immediately. func (c *ApiService) PageUser(ServiceSid string, params *ListUserParams, pageToken, pageNumber string) (*ListUserResponse, error) { - path := "/v1/Services/{ServiceSid}/Users" + path := "/v1/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists User records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -221,6 +226,7 @@ func (c *ApiService) StreamUser(ServiceSid string, params *ListUserParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserParams, recordChannel chan IpMessagingV1User, errorChannel chan error) { curRecord := 1 @@ -252,76 +258,78 @@ func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserPara } func (c *ApiService) getNextListUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUser' type UpdateUserParams struct { - // - RoleSid *string `json:"RoleSid,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateUserParams) SetRoleSid(RoleSid string) *UpdateUserParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateUserParams) SetRoleSid(RoleSid string) (*UpdateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *UpdateUserParams) SetAttributes(Attributes string) *UpdateUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateUserParams) SetAttributes(Attributes string) (*UpdateUserParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) *UpdateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) (*UpdateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateUser(ServiceSid string, Sid string, params *UpdateUserParams) (*IpMessagingV1User, error) { - path := "/v1/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV1User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV1User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v1/services_users_channels.go b/rest/ip_messaging/v1/services_users_channels.go index 32b0dfc05..9cc8db2af 100644 --- a/rest/ip_messaging/v1/services_users_channels.go +++ b/rest/ip_messaging/v1/services_users_channels.go @@ -18,62 +18,62 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUserChannel' type ListUserChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserChannelParams) SetPageSize(PageSize int) *ListUserChannelParams { - params.PageSize = &PageSize - return params +func (params *ListUserChannelParams) SetPageSize(PageSize int) (*ListUserChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserChannelParams) SetLimit(Limit int) *ListUserChannelParams { - params.Limit = &Limit - return params +func (params *ListUserChannelParams) SetLimit(Limit int) (*ListUserChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserChannel records from the API. Request is executed immediately. func (c *ApiService) PageUserChannel(ServiceSid string, UserSid string, params *ListUserChannelParams, pageToken, pageNumber string) (*ListUserChannelResponse, error) { - path := "/v1/Services/{ServiceSid}/Users/{UserSid}/Channels" + path := "/v1/Services/{ServiceSid}/Users/{UserSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UserChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -114,6 +114,7 @@ func (c *ApiService) StreamUserChannel(ServiceSid string, UserSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params *ListUserChannelParams, recordChannel chan IpMessagingV1UserChannel, errorChannel chan error) { curRecord := 1 @@ -145,19 +146,20 @@ func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params } func (c *ApiService) getNextListUserChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/ip_messaging/v2/README.md b/rest/ip_messaging/v2/README.md index a42200d0a..5f05893a7 100644 --- a/rest/ip_messaging/v2/README.md +++ b/rest/ip_messaging/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/ip_messaging/v2/api_service.go b/rest/ip_messaging/v2/api_service.go index d15ea97c9..039b82654 100644 --- a/rest/ip_messaging/v2/api_service.go +++ b/rest/ip_messaging/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://ip-messaging.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/ip_messaging/v2/credentials.go b/rest/ip_messaging/v2/credentials.go index 7d4227335..ac280f303 100644 --- a/rest/ip_messaging/v2/credentials.go +++ b/rest/ip_messaging/v2/credentials.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredential' type CreateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Certificate *string `json:"Certificate,omitempty"` - // - PrivateKey *string `json:"PrivateKey,omitempty"` - // - Sandbox *bool `json:"Sandbox,omitempty"` - // - ApiKey *string `json:"ApiKey,omitempty"` - // - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Certificate *string `json:"Certificate,omitempty"` + // + PrivateKey *string `json:"PrivateKey,omitempty"` + // + Sandbox *bool `json:"Sandbox,omitempty"` + // + ApiKey *string `json:"ApiKey,omitempty"` + // + Secret *string `json:"Secret,omitempty"` } -func (params *CreateCredentialParams) SetType(Type string) *CreateCredentialParams { - params.Type = &Type - return params +func (params *CreateCredentialParams) SetType(Type string) (*CreateCredentialParams){ + params.Type = &Type + return params } -func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) *CreateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) (*CreateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialParams) SetCertificate(Certificate string) *CreateCredentialParams { - params.Certificate = &Certificate - return params +func (params *CreateCredentialParams) SetCertificate(Certificate string) (*CreateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) *CreateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) (*CreateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *CreateCredentialParams) SetSandbox(Sandbox bool) *CreateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *CreateCredentialParams) SetSandbox(Sandbox bool) (*CreateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *CreateCredentialParams) SetApiKey(ApiKey string) *CreateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *CreateCredentialParams) SetApiKey(ApiKey string) (*CreateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *CreateCredentialParams) SetSecret(Secret string) *CreateCredentialParams { - params.Secret = &Secret - return params +func (params *CreateCredentialParams) SetSecret(Secret string) (*CreateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) CreateCredential(params *CreateCredentialParams) (*IpMessagingV2Credential, error) { - path := "/v2/Credentials" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Credentials" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } +// +func (c *ApiService) DeleteCredential(Sid string, ) (error) { + path := "/v2/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &IpMessagingV2Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteCredential(Sid string) error { - path := "/v2/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchCredential(Sid string, ) (*IpMessagingV2Credential, error) { + path := "/v2/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchCredential(Sid string) (*IpMessagingV2Credential, error) { - path := "/v2/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &IpMessagingV2Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &IpMessagingV2Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListCredential' type ListCredentialParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialParams) SetPageSize(PageSize int) *ListCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialParams) SetPageSize(PageSize int) (*ListCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialParams) SetLimit(Limit int) *ListCredentialParams { - params.Limit = &Limit - return params +func (params *ListCredentialParams) SetLimit(Limit int) (*ListCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Credential records from the API. Request is executed immediately. func (c *ApiService) PageCredential(params *ListCredentialParams, pageToken, pageNumber string) (*ListCredentialResponse, error) { - path := "/v2/Credentials" + path := "/v2/Credentials" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Credential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCredential(params *ListCredentialParams) (chan IpMess return recordChannel, errorChannel } + func (c *ApiService) streamCredential(response *ListCredentialResponse, params *ListCredentialParams, recordChannel chan IpMessagingV2Credential, errorChannel chan error) { curRecord := 1 @@ -274,102 +281,104 @@ func (c *ApiService) streamCredential(response *ListCredentialResponse, params * } func (c *ApiService) getNextListCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredential' type UpdateCredentialParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Certificate *string `json:"Certificate,omitempty"` - // - PrivateKey *string `json:"PrivateKey,omitempty"` - // - Sandbox *bool `json:"Sandbox,omitempty"` - // - ApiKey *string `json:"ApiKey,omitempty"` - // - Secret *string `json:"Secret,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Certificate *string `json:"Certificate,omitempty"` + // + PrivateKey *string `json:"PrivateKey,omitempty"` + // + Sandbox *bool `json:"Sandbox,omitempty"` + // + ApiKey *string `json:"ApiKey,omitempty"` + // + Secret *string `json:"Secret,omitempty"` } -func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) *UpdateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCredentialParams) SetCertificate(Certificate string) *UpdateCredentialParams { - params.Certificate = &Certificate - return params +func (params *UpdateCredentialParams) SetCertificate(Certificate string) (*UpdateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) *UpdateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) (*UpdateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) *UpdateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) (*UpdateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *UpdateCredentialParams) SetApiKey(ApiKey string) *UpdateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *UpdateCredentialParams) SetApiKey(ApiKey string) (*UpdateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *UpdateCredentialParams) SetSecret(Secret string) *UpdateCredentialParams { - params.Secret = &Secret - return params +func (params *UpdateCredentialParams) SetSecret(Secret string) (*UpdateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) UpdateCredential(Sid string, params *UpdateCredentialParams) (*IpMessagingV2Credential, error) { - path := "/v2/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IpMessagingV2Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/ip_messaging/v2/docs/ListBindingResponseMeta.md b/rest/ip_messaging/v2/docs/ListBindingResponseMeta.md index f40b7bc19..fcd580e38 100644 --- a/rest/ip_messaging/v2/docs/ListBindingResponseMeta.md +++ b/rest/ip_messaging/v2/docs/ListBindingResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_binding.go b/rest/ip_messaging/v2/model_ip_messaging_v2_binding.go index 86e942177..bcb0e7c10 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_binding.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_binding.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Binding struct for IpMessagingV2Binding type IpMessagingV2Binding struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - Identity *string `json:"identity,omitempty"` - CredentialSid *string `json:"credential_sid,omitempty"` - BindingType *string `json:"binding_type,omitempty"` - MessageTypes *[]string `json:"message_types,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + Identity *string `json:"identity,omitempty"` + CredentialSid *string `json:"credential_sid,omitempty"` + BindingType *string `json:"binding_type,omitempty"` + MessageTypes *[]string `json:"message_types,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_channel.go b/rest/ip_messaging/v2/model_ip_messaging_v2_channel.go index e31b53852..01e043538 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_channel.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_channel.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Channel struct for IpMessagingV2Channel type IpMessagingV2Channel struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - UniqueName *string `json:"unique_name,omitempty"` - Attributes *string `json:"attributes,omitempty"` - Type *string `json:"type,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - CreatedBy *string `json:"created_by,omitempty"` - MembersCount *int `json:"members_count,omitempty"` - MessagesCount *int `json:"messages_count,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + UniqueName *string `json:"unique_name,omitempty"` + Attributes *string `json:"attributes,omitempty"` + Type *string `json:"type,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + CreatedBy *string `json:"created_by,omitempty"` + MembersCount *int `json:"members_count,omitempty"` + MessagesCount *int `json:"messages_count,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_channel_webhook.go b/rest/ip_messaging/v2/model_ip_messaging_v2_channel_webhook.go index 9db007f91..aa07e0c03 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_channel_webhook.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_channel_webhook.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2ChannelWebhook struct for IpMessagingV2ChannelWebhook type IpMessagingV2ChannelWebhook struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - Type *string `json:"type,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + Type *string `json:"type,omitempty"` + Url *string `json:"url,omitempty"` Configuration *interface{} `json:"configuration,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_credential.go b/rest/ip_messaging/v2/model_ip_messaging_v2_credential.go index e217e261f..249a7b2e9 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_credential.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_credential.go @@ -13,19 +13,21 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Credential struct for IpMessagingV2Credential type IpMessagingV2Credential struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - Sandbox *string `json:"sandbox,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + Type *string `json:"type,omitempty"` + Sandbox *string `json:"sandbox,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_invite.go b/rest/ip_messaging/v2/model_ip_messaging_v2_invite.go index 946fb55e3..711f52fcd 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_invite.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_invite.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Invite struct for IpMessagingV2Invite type IpMessagingV2Invite struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - Identity *string `json:"identity,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + Identity *string `json:"identity,omitempty"` DateCreated *time.Time `json:"date_created,omitempty"` DateUpdated *time.Time `json:"date_updated,omitempty"` - RoleSid *string `json:"role_sid,omitempty"` - CreatedBy *string `json:"created_by,omitempty"` - Url *string `json:"url,omitempty"` + RoleSid *string `json:"role_sid,omitempty"` + CreatedBy *string `json:"created_by,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_member.go b/rest/ip_messaging/v2/model_ip_messaging_v2_member.go index 42b64eee6..322c56edf 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_member.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_member.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Member struct for IpMessagingV2Member type IpMessagingV2Member struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - Identity *string `json:"identity,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - RoleSid *string `json:"role_sid,omitempty"` - LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + Identity *string `json:"identity,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + RoleSid *string `json:"role_sid,omitempty"` + LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` LastConsumptionTimestamp *time.Time `json:"last_consumption_timestamp,omitempty"` - Url *string `json:"url,omitempty"` - Attributes *string `json:"attributes,omitempty"` + Url *string `json:"url,omitempty"` + Attributes *string `json:"attributes,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_message.go b/rest/ip_messaging/v2/model_ip_messaging_v2_message.go index 71a6616ed..2d9873ef3 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_message.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_message.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Message struct for IpMessagingV2Message type IpMessagingV2Message struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - Attributes *string `json:"attributes,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - To *string `json:"to,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - LastUpdatedBy *string `json:"last_updated_by,omitempty"` - WasEdited *bool `json:"was_edited,omitempty"` - From *string `json:"from,omitempty"` - Body *string `json:"body,omitempty"` - Index *int `json:"index,omitempty"` - Type *string `json:"type,omitempty"` - Media *interface{} `json:"media,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + Attributes *string `json:"attributes,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + To *string `json:"to,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + WasEdited *bool `json:"was_edited,omitempty"` + From *string `json:"from,omitempty"` + Body *string `json:"body,omitempty"` + Index *int `json:"index,omitempty"` + Type *string `json:"type,omitempty"` + Media *interface{} `json:"media,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_role.go b/rest/ip_messaging/v2/model_ip_messaging_v2_role.go index 1192e4474..a8764de51 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_role.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_role.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Role struct for IpMessagingV2Role type IpMessagingV2Role struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - Permissions *[]string `json:"permissions,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + Type *string `json:"type,omitempty"` + Permissions *[]string `json:"permissions,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_service.go b/rest/ip_messaging/v2/model_ip_messaging_v2_service.go index eff37a6ba..a3a2041f1 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_service.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_service.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2Service struct for IpMessagingV2Service type IpMessagingV2Service struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - DefaultServiceRoleSid *string `json:"default_service_role_sid,omitempty"` - DefaultChannelRoleSid *string `json:"default_channel_role_sid,omitempty"` - DefaultChannelCreatorRoleSid *string `json:"default_channel_creator_role_sid,omitempty"` - ReadStatusEnabled *bool `json:"read_status_enabled,omitempty"` - ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` - TypingIndicatorTimeout *int `json:"typing_indicator_timeout,omitempty"` - ConsumptionReportInterval *int `json:"consumption_report_interval,omitempty"` - Limits *interface{} `json:"limits,omitempty"` - PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` - PostWebhookUrl *string `json:"post_webhook_url,omitempty"` - WebhookMethod *string `json:"webhook_method,omitempty"` - WebhookFilters *[]string `json:"webhook_filters,omitempty"` - PreWebhookRetryCount *int `json:"pre_webhook_retry_count,omitempty"` - PostWebhookRetryCount *int `json:"post_webhook_retry_count,omitempty"` - Notifications *interface{} `json:"notifications,omitempty"` - Media *interface{} `json:"media,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + DefaultServiceRoleSid *string `json:"default_service_role_sid,omitempty"` + DefaultChannelRoleSid *string `json:"default_channel_role_sid,omitempty"` + DefaultChannelCreatorRoleSid *string `json:"default_channel_creator_role_sid,omitempty"` + ReadStatusEnabled *bool `json:"read_status_enabled,omitempty"` + ReachabilityEnabled *bool `json:"reachability_enabled,omitempty"` + TypingIndicatorTimeout *int `json:"typing_indicator_timeout,omitempty"` + ConsumptionReportInterval *int `json:"consumption_report_interval,omitempty"` + Limits *interface{} `json:"limits,omitempty"` + PreWebhookUrl *string `json:"pre_webhook_url,omitempty"` + PostWebhookUrl *string `json:"post_webhook_url,omitempty"` + WebhookMethod *string `json:"webhook_method,omitempty"` + WebhookFilters *[]string `json:"webhook_filters,omitempty"` + PreWebhookRetryCount *int `json:"pre_webhook_retry_count,omitempty"` + PostWebhookRetryCount *int `json:"post_webhook_retry_count,omitempty"` + Notifications *interface{} `json:"notifications,omitempty"` + Media *interface{} `json:"media,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_user.go b/rest/ip_messaging/v2/model_ip_messaging_v2_user.go index 0796b0d21..77368f2c0 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_user.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_user.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2User struct for IpMessagingV2User type IpMessagingV2User struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - Attributes *string `json:"attributes,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - RoleSid *string `json:"role_sid,omitempty"` - Identity *string `json:"identity,omitempty"` - IsOnline *bool `json:"is_online,omitempty"` - IsNotifiable *bool `json:"is_notifiable,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - JoinedChannelsCount *int `json:"joined_channels_count,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + Attributes *string `json:"attributes,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + RoleSid *string `json:"role_sid,omitempty"` + Identity *string `json:"identity,omitempty"` + IsOnline *bool `json:"is_online,omitempty"` + IsNotifiable *bool `json:"is_notifiable,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + JoinedChannelsCount *int `json:"joined_channels_count,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_user_binding.go b/rest/ip_messaging/v2/model_ip_messaging_v2_user_binding.go index 75b55e261..33fda5320 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_user_binding.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_user_binding.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // IpMessagingV2UserBinding struct for IpMessagingV2UserBinding type IpMessagingV2UserBinding struct { - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` - Endpoint *string `json:"endpoint,omitempty"` - Identity *string `json:"identity,omitempty"` - UserSid *string `json:"user_sid,omitempty"` - CredentialSid *string `json:"credential_sid,omitempty"` - BindingType *string `json:"binding_type,omitempty"` - MessageTypes *[]string `json:"message_types,omitempty"` - Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` + Endpoint *string `json:"endpoint,omitempty"` + Identity *string `json:"identity,omitempty"` + UserSid *string `json:"user_sid,omitempty"` + CredentialSid *string `json:"credential_sid,omitempty"` + BindingType *string `json:"binding_type,omitempty"` + MessageTypes *[]string `json:"message_types,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_ip_messaging_v2_user_channel.go b/rest/ip_messaging/v2/model_ip_messaging_v2_user_channel.go index 5571a85c3..18cc13c29 100644 --- a/rest/ip_messaging/v2/model_ip_messaging_v2_user_channel.go +++ b/rest/ip_messaging/v2/model_ip_messaging_v2_user_channel.go @@ -13,18 +13,23 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // IpMessagingV2UserChannel struct for IpMessagingV2UserChannel type IpMessagingV2UserChannel struct { - AccountSid *string `json:"account_sid,omitempty"` - ServiceSid *string `json:"service_sid,omitempty"` - ChannelSid *string `json:"channel_sid,omitempty"` - UserSid *string `json:"user_sid,omitempty"` - MemberSid *string `json:"member_sid,omitempty"` - Status *string `json:"status,omitempty"` - LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` - UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` - Url *string `json:"url,omitempty"` - NotificationLevel *string `json:"notification_level,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + ServiceSid *string `json:"service_sid,omitempty"` + ChannelSid *string `json:"channel_sid,omitempty"` + UserSid *string `json:"user_sid,omitempty"` + MemberSid *string `json:"member_sid,omitempty"` + Status *string `json:"status,omitempty"` + LastConsumedMessageIndex *int `json:"last_consumed_message_index,omitempty"` + UnreadMessagesCount *int `json:"unread_messages_count,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` + Url *string `json:"url,omitempty"` + NotificationLevel *string `json:"notification_level,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_binding_response.go b/rest/ip_messaging/v2/model_list_binding_response.go index e38836d66..21f63b820 100644 --- a/rest/ip_messaging/v2/model_list_binding_response.go +++ b/rest/ip_messaging/v2/model_list_binding_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBindingResponse struct for ListBindingResponse type ListBindingResponse struct { - Bindings []IpMessagingV2Binding `json:"bindings,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Bindings []IpMessagingV2Binding `json:"bindings,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_binding_response_meta.go b/rest/ip_messaging/v2/model_list_binding_response_meta.go index 8e97c4e4b..9b2c88d8b 100644 --- a/rest/ip_messaging/v2/model_list_binding_response_meta.go +++ b/rest/ip_messaging/v2/model_list_binding_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBindingResponseMeta struct for ListBindingResponseMeta type ListBindingResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_channel_response.go b/rest/ip_messaging/v2/model_list_channel_response.go index 3f25f2f6e..38688e31a 100644 --- a/rest/ip_messaging/v2/model_list_channel_response.go +++ b/rest/ip_messaging/v2/model_list_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelResponse struct for ListChannelResponse type ListChannelResponse struct { - Channels []IpMessagingV2Channel `json:"channels,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Channels []IpMessagingV2Channel `json:"channels,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_channel_webhook_response.go b/rest/ip_messaging/v2/model_list_channel_webhook_response.go index 1f0263cff..c3cff1aa1 100644 --- a/rest/ip_messaging/v2/model_list_channel_webhook_response.go +++ b/rest/ip_messaging/v2/model_list_channel_webhook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelWebhookResponse struct for ListChannelWebhookResponse type ListChannelWebhookResponse struct { Webhooks []IpMessagingV2ChannelWebhook `json:"webhooks,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_credential_response.go b/rest/ip_messaging/v2/model_list_credential_response.go index 253ee410c..db93fd82f 100644 --- a/rest/ip_messaging/v2/model_list_credential_response.go +++ b/rest/ip_messaging/v2/model_list_credential_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialResponse struct for ListCredentialResponse type ListCredentialResponse struct { Credentials []IpMessagingV2Credential `json:"credentials,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_invite_response.go b/rest/ip_messaging/v2/model_list_invite_response.go index c64422d07..cd17d56e8 100644 --- a/rest/ip_messaging/v2/model_list_invite_response.go +++ b/rest/ip_messaging/v2/model_list_invite_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInviteResponse struct for ListInviteResponse type ListInviteResponse struct { - Invites []IpMessagingV2Invite `json:"invites,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Invites []IpMessagingV2Invite `json:"invites,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_member_response.go b/rest/ip_messaging/v2/model_list_member_response.go index a8767f85b..cd7d5467c 100644 --- a/rest/ip_messaging/v2/model_list_member_response.go +++ b/rest/ip_messaging/v2/model_list_member_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMemberResponse struct for ListMemberResponse type ListMemberResponse struct { - Members []IpMessagingV2Member `json:"members,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Members []IpMessagingV2Member `json:"members,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_message_response.go b/rest/ip_messaging/v2/model_list_message_response.go index 2d55a94c5..6069a4a47 100644 --- a/rest/ip_messaging/v2/model_list_message_response.go +++ b/rest/ip_messaging/v2/model_list_message_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessageResponse struct for ListMessageResponse type ListMessageResponse struct { - Messages []IpMessagingV2Message `json:"messages,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Messages []IpMessagingV2Message `json:"messages,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_role_response.go b/rest/ip_messaging/v2/model_list_role_response.go index 5de84da77..1cc43eb34 100644 --- a/rest/ip_messaging/v2/model_list_role_response.go +++ b/rest/ip_messaging/v2/model_list_role_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoleResponse struct for ListRoleResponse type ListRoleResponse struct { - Roles []IpMessagingV2Role `json:"roles,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Roles []IpMessagingV2Role `json:"roles,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_service_response.go b/rest/ip_messaging/v2/model_list_service_response.go index 7d3dde8b8..932ccc639 100644 --- a/rest/ip_messaging/v2/model_list_service_response.go +++ b/rest/ip_messaging/v2/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []IpMessagingV2Service `json:"services,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Services []IpMessagingV2Service `json:"services,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_user_binding_response.go b/rest/ip_messaging/v2/model_list_user_binding_response.go index f45854ddc..e61e71e98 100644 --- a/rest/ip_messaging/v2/model_list_user_binding_response.go +++ b/rest/ip_messaging/v2/model_list_user_binding_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserBindingResponse struct for ListUserBindingResponse type ListUserBindingResponse struct { Bindings []IpMessagingV2UserBinding `json:"bindings,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_user_channel_response.go b/rest/ip_messaging/v2/model_list_user_channel_response.go index e79781a5c..fef1463a5 100644 --- a/rest/ip_messaging/v2/model_list_user_channel_response.go +++ b/rest/ip_messaging/v2/model_list_user_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserChannelResponse struct for ListUserChannelResponse type ListUserChannelResponse struct { Channels []IpMessagingV2UserChannel `json:"channels,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/model_list_user_response.go b/rest/ip_messaging/v2/model_list_user_response.go index e9958ef7f..7977998f0 100644 --- a/rest/ip_messaging/v2/model_list_user_response.go +++ b/rest/ip_messaging/v2/model_list_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUserResponse struct for ListUserResponse type ListUserResponse struct { - Users []IpMessagingV2User `json:"users,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Users []IpMessagingV2User `json:"users,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/ip_messaging/v2/services.go b/rest/ip_messaging/v2/services.go index 3b093dcd5..4348d2a2d 100644 --- a/rest/ip_messaging/v2/services.go +++ b/rest/ip_messaging/v2/services.go @@ -18,137 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateService(params *CreateServiceParams) (*IpMessagingV2Service, error) { - path := "/v2/Services" + path := "/v2/Services" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchService(Sid string) (*IpMessagingV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchService(Sid string, ) (*IpMessagingV2Service, error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v2/Services" + path := "/v2/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +195,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan IpMessagingV return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan IpMessagingV2Service, errorChannel chan error) { curRecord := 1 @@ -220,329 +227,331 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` - // - DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` - // - DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` - // - ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` - // - ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` - // - TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` - // - ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` - // - NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` - // - NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` - // - NotificationsNewMessageSound *string `json:"Notifications.NewMessage.Sound,omitempty"` - // - NotificationsNewMessageBadgeCountEnabled *bool `json:"Notifications.NewMessage.BadgeCountEnabled,omitempty"` - // - NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` - // - NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` - // - NotificationsAddedToChannelSound *string `json:"Notifications.AddedToChannel.Sound,omitempty"` - // - NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` - // - NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` - // - NotificationsRemovedFromChannelSound *string `json:"Notifications.RemovedFromChannel.Sound,omitempty"` - // - NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` - // - NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` - // - NotificationsInvitedToChannelSound *string `json:"Notifications.InvitedToChannel.Sound,omitempty"` - // - PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` - // - PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` - // - WebhookMethod *string `json:"WebhookMethod,omitempty"` - // - WebhookFilters *[]string `json:"WebhookFilters,omitempty"` - // - LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` - // - LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` - // - MediaCompatibilityMessage *string `json:"Media.CompatibilityMessage,omitempty"` - // - PreWebhookRetryCount *int `json:"PreWebhookRetryCount,omitempty"` - // - PostWebhookRetryCount *int `json:"PostWebhookRetryCount,omitempty"` - // - NotificationsLogEnabled *bool `json:"Notifications.LogEnabled,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) *UpdateServiceParams { - params.DefaultServiceRoleSid = &DefaultServiceRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) *UpdateServiceParams { - params.DefaultChannelRoleSid = &DefaultChannelRoleSid - return params -} -func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) *UpdateServiceParams { - params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid - return params -} -func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) *UpdateServiceParams { - params.ReadStatusEnabled = &ReadStatusEnabled - return params -} -func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) *UpdateServiceParams { - params.ReachabilityEnabled = &ReachabilityEnabled - return params -} -func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) *UpdateServiceParams { - params.TypingIndicatorTimeout = &TypingIndicatorTimeout - return params -} -func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) *UpdateServiceParams { - params.ConsumptionReportInterval = &ConsumptionReportInterval - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) *UpdateServiceParams { - params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) *UpdateServiceParams { - params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageSound(NotificationsNewMessageSound string) *UpdateServiceParams { - params.NotificationsNewMessageSound = &NotificationsNewMessageSound - return params -} -func (params *UpdateServiceParams) SetNotificationsNewMessageBadgeCountEnabled(NotificationsNewMessageBadgeCountEnabled bool) *UpdateServiceParams { - params.NotificationsNewMessageBadgeCountEnabled = &NotificationsNewMessageBadgeCountEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsAddedToChannelSound(NotificationsAddedToChannelSound string) *UpdateServiceParams { - params.NotificationsAddedToChannelSound = &NotificationsAddedToChannelSound - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) *UpdateServiceParams { - params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) *UpdateServiceParams { - params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelSound(NotificationsRemovedFromChannelSound string) *UpdateServiceParams { - params.NotificationsRemovedFromChannelSound = &NotificationsRemovedFromChannelSound - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) *UpdateServiceParams { - params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) *UpdateServiceParams { - params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate - return params -} -func (params *UpdateServiceParams) SetNotificationsInvitedToChannelSound(NotificationsInvitedToChannelSound string) *UpdateServiceParams { - params.NotificationsInvitedToChannelSound = &NotificationsInvitedToChannelSound - return params -} -func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) *UpdateServiceParams { - params.PreWebhookUrl = &PreWebhookUrl - return params + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + DefaultServiceRoleSid *string `json:"DefaultServiceRoleSid,omitempty"` + // + DefaultChannelRoleSid *string `json:"DefaultChannelRoleSid,omitempty"` + // + DefaultChannelCreatorRoleSid *string `json:"DefaultChannelCreatorRoleSid,omitempty"` + // + ReadStatusEnabled *bool `json:"ReadStatusEnabled,omitempty"` + // + ReachabilityEnabled *bool `json:"ReachabilityEnabled,omitempty"` + // + TypingIndicatorTimeout *int `json:"TypingIndicatorTimeout,omitempty"` + // + ConsumptionReportInterval *int `json:"ConsumptionReportInterval,omitempty"` + // + NotificationsNewMessageEnabled *bool `json:"Notifications.NewMessage.Enabled,omitempty"` + // + NotificationsNewMessageTemplate *string `json:"Notifications.NewMessage.Template,omitempty"` + // + NotificationsNewMessageSound *string `json:"Notifications.NewMessage.Sound,omitempty"` + // + NotificationsNewMessageBadgeCountEnabled *bool `json:"Notifications.NewMessage.BadgeCountEnabled,omitempty"` + // + NotificationsAddedToChannelEnabled *bool `json:"Notifications.AddedToChannel.Enabled,omitempty"` + // + NotificationsAddedToChannelTemplate *string `json:"Notifications.AddedToChannel.Template,omitempty"` + // + NotificationsAddedToChannelSound *string `json:"Notifications.AddedToChannel.Sound,omitempty"` + // + NotificationsRemovedFromChannelEnabled *bool `json:"Notifications.RemovedFromChannel.Enabled,omitempty"` + // + NotificationsRemovedFromChannelTemplate *string `json:"Notifications.RemovedFromChannel.Template,omitempty"` + // + NotificationsRemovedFromChannelSound *string `json:"Notifications.RemovedFromChannel.Sound,omitempty"` + // + NotificationsInvitedToChannelEnabled *bool `json:"Notifications.InvitedToChannel.Enabled,omitempty"` + // + NotificationsInvitedToChannelTemplate *string `json:"Notifications.InvitedToChannel.Template,omitempty"` + // + NotificationsInvitedToChannelSound *string `json:"Notifications.InvitedToChannel.Sound,omitempty"` + // + PreWebhookUrl *string `json:"PreWebhookUrl,omitempty"` + // + PostWebhookUrl *string `json:"PostWebhookUrl,omitempty"` + // + WebhookMethod *string `json:"WebhookMethod,omitempty"` + // + WebhookFilters *[]string `json:"WebhookFilters,omitempty"` + // + LimitsChannelMembers *int `json:"Limits.ChannelMembers,omitempty"` + // + LimitsUserChannels *int `json:"Limits.UserChannels,omitempty"` + // + MediaCompatibilityMessage *string `json:"Media.CompatibilityMessage,omitempty"` + // + PreWebhookRetryCount *int `json:"PreWebhookRetryCount,omitempty"` + // + PostWebhookRetryCount *int `json:"PostWebhookRetryCount,omitempty"` + // + NotificationsLogEnabled *bool `json:"Notifications.LogEnabled,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetDefaultServiceRoleSid(DefaultServiceRoleSid string) (*UpdateServiceParams){ + params.DefaultServiceRoleSid = &DefaultServiceRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelRoleSid(DefaultChannelRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelRoleSid = &DefaultChannelRoleSid + return params +} +func (params *UpdateServiceParams) SetDefaultChannelCreatorRoleSid(DefaultChannelCreatorRoleSid string) (*UpdateServiceParams){ + params.DefaultChannelCreatorRoleSid = &DefaultChannelCreatorRoleSid + return params +} +func (params *UpdateServiceParams) SetReadStatusEnabled(ReadStatusEnabled bool) (*UpdateServiceParams){ + params.ReadStatusEnabled = &ReadStatusEnabled + return params +} +func (params *UpdateServiceParams) SetReachabilityEnabled(ReachabilityEnabled bool) (*UpdateServiceParams){ + params.ReachabilityEnabled = &ReachabilityEnabled + return params +} +func (params *UpdateServiceParams) SetTypingIndicatorTimeout(TypingIndicatorTimeout int) (*UpdateServiceParams){ + params.TypingIndicatorTimeout = &TypingIndicatorTimeout + return params +} +func (params *UpdateServiceParams) SetConsumptionReportInterval(ConsumptionReportInterval int) (*UpdateServiceParams){ + params.ConsumptionReportInterval = &ConsumptionReportInterval + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageEnabled(NotificationsNewMessageEnabled bool) (*UpdateServiceParams){ + params.NotificationsNewMessageEnabled = &NotificationsNewMessageEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageTemplate(NotificationsNewMessageTemplate string) (*UpdateServiceParams){ + params.NotificationsNewMessageTemplate = &NotificationsNewMessageTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageSound(NotificationsNewMessageSound string) (*UpdateServiceParams){ + params.NotificationsNewMessageSound = &NotificationsNewMessageSound + return params +} +func (params *UpdateServiceParams) SetNotificationsNewMessageBadgeCountEnabled(NotificationsNewMessageBadgeCountEnabled bool) (*UpdateServiceParams){ + params.NotificationsNewMessageBadgeCountEnabled = &NotificationsNewMessageBadgeCountEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelEnabled(NotificationsAddedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsAddedToChannelEnabled = &NotificationsAddedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelTemplate(NotificationsAddedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsAddedToChannelTemplate = &NotificationsAddedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsAddedToChannelSound(NotificationsAddedToChannelSound string) (*UpdateServiceParams){ + params.NotificationsAddedToChannelSound = &NotificationsAddedToChannelSound + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelEnabled(NotificationsRemovedFromChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelEnabled = &NotificationsRemovedFromChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelTemplate(NotificationsRemovedFromChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelTemplate = &NotificationsRemovedFromChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsRemovedFromChannelSound(NotificationsRemovedFromChannelSound string) (*UpdateServiceParams){ + params.NotificationsRemovedFromChannelSound = &NotificationsRemovedFromChannelSound + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelEnabled(NotificationsInvitedToChannelEnabled bool) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelEnabled = &NotificationsInvitedToChannelEnabled + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelTemplate(NotificationsInvitedToChannelTemplate string) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelTemplate = &NotificationsInvitedToChannelTemplate + return params +} +func (params *UpdateServiceParams) SetNotificationsInvitedToChannelSound(NotificationsInvitedToChannelSound string) (*UpdateServiceParams){ + params.NotificationsInvitedToChannelSound = &NotificationsInvitedToChannelSound + return params +} +func (params *UpdateServiceParams) SetPreWebhookUrl(PreWebhookUrl string) (*UpdateServiceParams){ + params.PreWebhookUrl = &PreWebhookUrl + return params } -func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) *UpdateServiceParams { - params.PostWebhookUrl = &PostWebhookUrl - return params +func (params *UpdateServiceParams) SetPostWebhookUrl(PostWebhookUrl string) (*UpdateServiceParams){ + params.PostWebhookUrl = &PostWebhookUrl + return params } -func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) *UpdateServiceParams { - params.WebhookMethod = &WebhookMethod - return params +func (params *UpdateServiceParams) SetWebhookMethod(WebhookMethod string) (*UpdateServiceParams){ + params.WebhookMethod = &WebhookMethod + return params } -func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) *UpdateServiceParams { - params.WebhookFilters = &WebhookFilters - return params +func (params *UpdateServiceParams) SetWebhookFilters(WebhookFilters []string) (*UpdateServiceParams){ + params.WebhookFilters = &WebhookFilters + return params } -func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) *UpdateServiceParams { - params.LimitsChannelMembers = &LimitsChannelMembers - return params +func (params *UpdateServiceParams) SetLimitsChannelMembers(LimitsChannelMembers int) (*UpdateServiceParams){ + params.LimitsChannelMembers = &LimitsChannelMembers + return params } -func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) *UpdateServiceParams { - params.LimitsUserChannels = &LimitsUserChannels - return params +func (params *UpdateServiceParams) SetLimitsUserChannels(LimitsUserChannels int) (*UpdateServiceParams){ + params.LimitsUserChannels = &LimitsUserChannels + return params } -func (params *UpdateServiceParams) SetMediaCompatibilityMessage(MediaCompatibilityMessage string) *UpdateServiceParams { - params.MediaCompatibilityMessage = &MediaCompatibilityMessage - return params +func (params *UpdateServiceParams) SetMediaCompatibilityMessage(MediaCompatibilityMessage string) (*UpdateServiceParams){ + params.MediaCompatibilityMessage = &MediaCompatibilityMessage + return params } -func (params *UpdateServiceParams) SetPreWebhookRetryCount(PreWebhookRetryCount int) *UpdateServiceParams { - params.PreWebhookRetryCount = &PreWebhookRetryCount - return params +func (params *UpdateServiceParams) SetPreWebhookRetryCount(PreWebhookRetryCount int) (*UpdateServiceParams){ + params.PreWebhookRetryCount = &PreWebhookRetryCount + return params } -func (params *UpdateServiceParams) SetPostWebhookRetryCount(PostWebhookRetryCount int) *UpdateServiceParams { - params.PostWebhookRetryCount = &PostWebhookRetryCount - return params +func (params *UpdateServiceParams) SetPostWebhookRetryCount(PostWebhookRetryCount int) (*UpdateServiceParams){ + params.PostWebhookRetryCount = &PostWebhookRetryCount + return params } -func (params *UpdateServiceParams) SetNotificationsLogEnabled(NotificationsLogEnabled bool) *UpdateServiceParams { - params.NotificationsLogEnabled = &NotificationsLogEnabled - return params +func (params *UpdateServiceParams) SetNotificationsLogEnabled(NotificationsLogEnabled bool) (*UpdateServiceParams){ + params.NotificationsLogEnabled = &NotificationsLogEnabled + return params } -// +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*IpMessagingV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DefaultServiceRoleSid != nil { - data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) - } - if params != nil && params.DefaultChannelRoleSid != nil { - data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) - } - if params != nil && params.DefaultChannelCreatorRoleSid != nil { - data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) - } - if params != nil && params.ReadStatusEnabled != nil { - data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) - } - if params != nil && params.ReachabilityEnabled != nil { - data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) - } - if params != nil && params.TypingIndicatorTimeout != nil { - data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) - } - if params != nil && params.ConsumptionReportInterval != nil { - data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) - } - if params != nil && params.NotificationsNewMessageEnabled != nil { - data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) - } - if params != nil && params.NotificationsNewMessageTemplate != nil { - data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) - } - if params != nil && params.NotificationsNewMessageSound != nil { - data.Set("Notifications.NewMessage.Sound", *params.NotificationsNewMessageSound) - } - if params != nil && params.NotificationsNewMessageBadgeCountEnabled != nil { - data.Set("Notifications.NewMessage.BadgeCountEnabled", fmt.Sprint(*params.NotificationsNewMessageBadgeCountEnabled)) - } - if params != nil && params.NotificationsAddedToChannelEnabled != nil { - data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) - } - if params != nil && params.NotificationsAddedToChannelTemplate != nil { - data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) - } - if params != nil && params.NotificationsAddedToChannelSound != nil { - data.Set("Notifications.AddedToChannel.Sound", *params.NotificationsAddedToChannelSound) - } - if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { - data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) - } - if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { - data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) - } - if params != nil && params.NotificationsRemovedFromChannelSound != nil { - data.Set("Notifications.RemovedFromChannel.Sound", *params.NotificationsRemovedFromChannelSound) - } - if params != nil && params.NotificationsInvitedToChannelEnabled != nil { - data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) - } - if params != nil && params.NotificationsInvitedToChannelTemplate != nil { - data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) - } - if params != nil && params.NotificationsInvitedToChannelSound != nil { - data.Set("Notifications.InvitedToChannel.Sound", *params.NotificationsInvitedToChannelSound) - } - if params != nil && params.PreWebhookUrl != nil { - data.Set("PreWebhookUrl", *params.PreWebhookUrl) - } - if params != nil && params.PostWebhookUrl != nil { - data.Set("PostWebhookUrl", *params.PostWebhookUrl) - } - if params != nil && params.WebhookMethod != nil { - data.Set("WebhookMethod", *params.WebhookMethod) - } - if params != nil && params.WebhookFilters != nil { - for _, item := range *params.WebhookFilters { - data.Add("WebhookFilters", item) - } - } - if params != nil && params.LimitsChannelMembers != nil { - data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) - } - if params != nil && params.LimitsUserChannels != nil { - data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) - } - if params != nil && params.MediaCompatibilityMessage != nil { - data.Set("Media.CompatibilityMessage", *params.MediaCompatibilityMessage) - } - if params != nil && params.PreWebhookRetryCount != nil { - data.Set("PreWebhookRetryCount", fmt.Sprint(*params.PreWebhookRetryCount)) - } - if params != nil && params.PostWebhookRetryCount != nil { - data.Set("PostWebhookRetryCount", fmt.Sprint(*params.PostWebhookRetryCount)) - } - if params != nil && params.NotificationsLogEnabled != nil { - data.Set("Notifications.LogEnabled", fmt.Sprint(*params.NotificationsLogEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IpMessagingV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DefaultServiceRoleSid != nil { + data.Set("DefaultServiceRoleSid", *params.DefaultServiceRoleSid) + } + if params != nil && params.DefaultChannelRoleSid != nil { + data.Set("DefaultChannelRoleSid", *params.DefaultChannelRoleSid) + } + if params != nil && params.DefaultChannelCreatorRoleSid != nil { + data.Set("DefaultChannelCreatorRoleSid", *params.DefaultChannelCreatorRoleSid) + } + if params != nil && params.ReadStatusEnabled != nil { + data.Set("ReadStatusEnabled", fmt.Sprint(*params.ReadStatusEnabled)) + } + if params != nil && params.ReachabilityEnabled != nil { + data.Set("ReachabilityEnabled", fmt.Sprint(*params.ReachabilityEnabled)) + } + if params != nil && params.TypingIndicatorTimeout != nil { + data.Set("TypingIndicatorTimeout", fmt.Sprint(*params.TypingIndicatorTimeout)) + } + if params != nil && params.ConsumptionReportInterval != nil { + data.Set("ConsumptionReportInterval", fmt.Sprint(*params.ConsumptionReportInterval)) + } + if params != nil && params.NotificationsNewMessageEnabled != nil { + data.Set("Notifications.NewMessage.Enabled", fmt.Sprint(*params.NotificationsNewMessageEnabled)) + } + if params != nil && params.NotificationsNewMessageTemplate != nil { + data.Set("Notifications.NewMessage.Template", *params.NotificationsNewMessageTemplate) + } + if params != nil && params.NotificationsNewMessageSound != nil { + data.Set("Notifications.NewMessage.Sound", *params.NotificationsNewMessageSound) + } + if params != nil && params.NotificationsNewMessageBadgeCountEnabled != nil { + data.Set("Notifications.NewMessage.BadgeCountEnabled", fmt.Sprint(*params.NotificationsNewMessageBadgeCountEnabled)) + } + if params != nil && params.NotificationsAddedToChannelEnabled != nil { + data.Set("Notifications.AddedToChannel.Enabled", fmt.Sprint(*params.NotificationsAddedToChannelEnabled)) + } + if params != nil && params.NotificationsAddedToChannelTemplate != nil { + data.Set("Notifications.AddedToChannel.Template", *params.NotificationsAddedToChannelTemplate) + } + if params != nil && params.NotificationsAddedToChannelSound != nil { + data.Set("Notifications.AddedToChannel.Sound", *params.NotificationsAddedToChannelSound) + } + if params != nil && params.NotificationsRemovedFromChannelEnabled != nil { + data.Set("Notifications.RemovedFromChannel.Enabled", fmt.Sprint(*params.NotificationsRemovedFromChannelEnabled)) + } + if params != nil && params.NotificationsRemovedFromChannelTemplate != nil { + data.Set("Notifications.RemovedFromChannel.Template", *params.NotificationsRemovedFromChannelTemplate) + } + if params != nil && params.NotificationsRemovedFromChannelSound != nil { + data.Set("Notifications.RemovedFromChannel.Sound", *params.NotificationsRemovedFromChannelSound) + } + if params != nil && params.NotificationsInvitedToChannelEnabled != nil { + data.Set("Notifications.InvitedToChannel.Enabled", fmt.Sprint(*params.NotificationsInvitedToChannelEnabled)) + } + if params != nil && params.NotificationsInvitedToChannelTemplate != nil { + data.Set("Notifications.InvitedToChannel.Template", *params.NotificationsInvitedToChannelTemplate) + } + if params != nil && params.NotificationsInvitedToChannelSound != nil { + data.Set("Notifications.InvitedToChannel.Sound", *params.NotificationsInvitedToChannelSound) + } + if params != nil && params.PreWebhookUrl != nil { + data.Set("PreWebhookUrl", *params.PreWebhookUrl) + } + if params != nil && params.PostWebhookUrl != nil { + data.Set("PostWebhookUrl", *params.PostWebhookUrl) + } + if params != nil && params.WebhookMethod != nil { + data.Set("WebhookMethod", *params.WebhookMethod) + } + if params != nil && params.WebhookFilters != nil { + for _, item := range *params.WebhookFilters { + data.Add("WebhookFilters", item) + } + } + if params != nil && params.LimitsChannelMembers != nil { + data.Set("Limits.ChannelMembers", fmt.Sprint(*params.LimitsChannelMembers)) + } + if params != nil && params.LimitsUserChannels != nil { + data.Set("Limits.UserChannels", fmt.Sprint(*params.LimitsUserChannels)) + } + if params != nil && params.MediaCompatibilityMessage != nil { + data.Set("Media.CompatibilityMessage", *params.MediaCompatibilityMessage) + } + if params != nil && params.PreWebhookRetryCount != nil { + data.Set("PreWebhookRetryCount", fmt.Sprint(*params.PreWebhookRetryCount)) + } + if params != nil && params.PostWebhookRetryCount != nil { + data.Set("PostWebhookRetryCount", fmt.Sprint(*params.PostWebhookRetryCount)) + } + if params != nil && params.NotificationsLogEnabled != nil { + data.Set("Notifications.LogEnabled", fmt.Sprint(*params.NotificationsLogEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/ip_messaging/v2/services_bindings.go b/rest/ip_messaging/v2/services_bindings.go index 248da0f90..4a2f2a3cc 100644 --- a/rest/ip_messaging/v2/services_bindings.go +++ b/rest/ip_messaging/v2/services_bindings.go @@ -18,126 +18,130 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteBinding(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteBinding(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchBinding(ServiceSid string, Sid string) (*IpMessagingV2Binding, error) { - path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchBinding(ServiceSid string, Sid string, ) (*IpMessagingV2Binding, error) { + path := "/v2/Services/{ServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2Binding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &IpMessagingV2Binding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListBinding' type ListBindingParams struct { - // - BindingType *[]string `json:"BindingType,omitempty"` - // - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + BindingType *[]string `json:"BindingType,omitempty"` + // + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBindingParams) SetBindingType(BindingType []string) *ListBindingParams { - params.BindingType = &BindingType - return params +func (params *ListBindingParams) SetBindingType(BindingType []string) (*ListBindingParams){ + params.BindingType = &BindingType + return params } -func (params *ListBindingParams) SetIdentity(Identity []string) *ListBindingParams { - params.Identity = &Identity - return params +func (params *ListBindingParams) SetIdentity(Identity []string) (*ListBindingParams){ + params.Identity = &Identity + return params } -func (params *ListBindingParams) SetPageSize(PageSize int) *ListBindingParams { - params.PageSize = &PageSize - return params +func (params *ListBindingParams) SetPageSize(PageSize int) (*ListBindingParams){ + params.PageSize = &PageSize + return params } -func (params *ListBindingParams) SetLimit(Limit int) *ListBindingParams { - params.Limit = &Limit - return params +func (params *ListBindingParams) SetLimit(Limit int) (*ListBindingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Binding records from the API. Request is executed immediately. func (c *ApiService) PageBinding(ServiceSid string, params *ListBindingParams, pageToken, pageNumber string) (*ListBindingResponse, error) { - path := "/v2/Services/{ServiceSid}/Bindings" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BindingType != nil { - for _, item := range *params.BindingType { - data.Add("BindingType", item) - } - } - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Bindings" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BindingType != nil { + for _, item := range *params.BindingType { + data.Add("BindingType", item) + } + } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Binding records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -178,6 +182,7 @@ func (c *ApiService) StreamBinding(ServiceSid string, params *ListBindingParams) return recordChannel, errorChannel } + func (c *ApiService) streamBinding(response *ListBindingResponse, params *ListBindingParams, recordChannel chan IpMessagingV2Binding, errorChannel chan error) { curRecord := 1 @@ -209,19 +214,20 @@ func (c *ApiService) streamBinding(response *ListBindingResponse, params *ListBi } func (c *ApiService) getNextListBindingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/ip_messaging/v2/services_channels.go b/rest/ip_messaging/v2/services_channels.go index 98a24ca5d..77091b1e3 100644 --- a/rest/ip_messaging/v2/services_channels.go +++ b/rest/ip_messaging/v2/services_channels.go @@ -18,233 +18,235 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannel' type CreateChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - UniqueName *string `json:"UniqueName,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - Type *string `json:"Type,omitempty"` - // - DateCreated *time.Time `json:"DateCreated,omitempty"` - // - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - CreatedBy *string `json:"CreatedBy,omitempty"` -} - -func (params *CreateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) *CreateChannelParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateChannelParams) SetUniqueName(UniqueName string) *CreateChannelParams { - params.UniqueName = &UniqueName - return params -} -func (params *CreateChannelParams) SetAttributes(Attributes string) *CreateChannelParams { - params.Attributes = &Attributes - return params -} -func (params *CreateChannelParams) SetType(Type string) *CreateChannelParams { - params.Type = &Type - return params -} -func (params *CreateChannelParams) SetDateCreated(DateCreated time.Time) *CreateChannelParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateChannelParams) SetDateUpdated(DateUpdated time.Time) *CreateChannelParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateChannelParams) SetCreatedBy(CreatedBy string) *CreateChannelParams { - params.CreatedBy = &CreatedBy - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + UniqueName *string `json:"UniqueName,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + Type *string `json:"Type,omitempty"` + // + DateCreated *time.Time `json:"DateCreated,omitempty"` + // + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + CreatedBy *string `json:"CreatedBy,omitempty"` +} + +func (params *CreateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateChannelParams) SetFriendlyName(FriendlyName string) (*CreateChannelParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateChannelParams) SetUniqueName(UniqueName string) (*CreateChannelParams){ + params.UniqueName = &UniqueName + return params +} +func (params *CreateChannelParams) SetAttributes(Attributes string) (*CreateChannelParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateChannelParams) SetType(Type string) (*CreateChannelParams){ + params.Type = &Type + return params +} +func (params *CreateChannelParams) SetDateCreated(DateCreated time.Time) (*CreateChannelParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateChannelParams) SetDateUpdated(DateUpdated time.Time) (*CreateChannelParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateChannelParams) SetCreatedBy(CreatedBy string) (*CreateChannelParams){ + params.CreatedBy = &CreatedBy + return params +} + +// func (c *ApiService) CreateChannel(ServiceSid string, params *CreateChannelParams) (*IpMessagingV2Channel, error) { - path := "/v2/Services/{ServiceSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Channels" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.CreatedBy != nil { + data.Set("CreatedBy", *params.CreatedBy) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.CreatedBy != nil { - data.Set("CreatedBy", *params.CreatedBy) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteChannel' type DeleteChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -// -func (c *ApiService) DeleteChannel(ServiceSid string, Sid string, params *DeleteChannelParams) error { - path := "/v2/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteChannel(ServiceSid string, Sid string, params *DeleteChannelParams) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } -// -func (c *ApiService) FetchChannel(ServiceSid string, Sid string) (*IpMessagingV2Channel, error) { - path := "/v2/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchChannel(ServiceSid string, Sid string, ) (*IpMessagingV2Channel, error) { + path := "/v2/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &IpMessagingV2Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListChannel' type ListChannelParams struct { - // - Type *[]string `json:"Type,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Type *[]string `json:"Type,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelParams) SetType(Type []string) *ListChannelParams { - params.Type = &Type - return params +func (params *ListChannelParams) SetType(Type []string) (*ListChannelParams){ + params.Type = &Type + return params } -func (params *ListChannelParams) SetPageSize(PageSize int) *ListChannelParams { - params.PageSize = &PageSize - return params +func (params *ListChannelParams) SetPageSize(PageSize int) (*ListChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelParams) SetLimit(Limit int) *ListChannelParams { - params.Limit = &Limit - return params +func (params *ListChannelParams) SetLimit(Limit int) (*ListChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Channel records from the API. Request is executed immediately. func (c *ApiService) PageChannel(ServiceSid string, params *ListChannelParams, pageToken, pageNumber string) (*ListChannelResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels" + path := "/v2/Services/{ServiceSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Type != nil { - for _, item := range *params.Type { - data.Add("Type", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Type != nil { + for _, item := range *params.Type { + data.Add("Type", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Channel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -285,6 +287,7 @@ func (c *ApiService) StreamChannel(ServiceSid string, params *ListChannelParams) return recordChannel, errorChannel } + func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListChannelParams, recordChannel chan IpMessagingV2Channel, errorChannel chan error) { curRecord := 1 @@ -316,113 +319,114 @@ func (c *ApiService) streamChannel(response *ListChannelResponse, params *ListCh } func (c *ApiService) getNextListChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChannel' type UpdateChannelParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - UniqueName *string `json:"UniqueName,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - DateCreated *time.Time `json:"DateCreated,omitempty"` - // - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - CreatedBy *string `json:"CreatedBy,omitempty"` -} - -func (params *UpdateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateChannelParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) *UpdateChannelParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateChannelParams) SetUniqueName(UniqueName string) *UpdateChannelParams { - params.UniqueName = &UniqueName - return params -} -func (params *UpdateChannelParams) SetAttributes(Attributes string) *UpdateChannelParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateChannelParams) SetDateCreated(DateCreated time.Time) *UpdateChannelParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateChannelParams) SetDateUpdated(DateUpdated time.Time) *UpdateChannelParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateChannelParams) SetCreatedBy(CreatedBy string) *UpdateChannelParams { - params.CreatedBy = &CreatedBy - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + UniqueName *string `json:"UniqueName,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + DateCreated *time.Time `json:"DateCreated,omitempty"` + // + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + CreatedBy *string `json:"CreatedBy,omitempty"` +} + +func (params *UpdateChannelParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateChannelParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateChannelParams) SetFriendlyName(FriendlyName string) (*UpdateChannelParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateChannelParams) SetUniqueName(UniqueName string) (*UpdateChannelParams){ + params.UniqueName = &UniqueName + return params +} +func (params *UpdateChannelParams) SetAttributes(Attributes string) (*UpdateChannelParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateChannelParams) SetDateCreated(DateCreated time.Time) (*UpdateChannelParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateChannelParams) SetDateUpdated(DateUpdated time.Time) (*UpdateChannelParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateChannelParams) SetCreatedBy(CreatedBy string) (*UpdateChannelParams){ + params.CreatedBy = &CreatedBy + return params +} + +// func (c *ApiService) UpdateChannel(ServiceSid string, Sid string, params *UpdateChannelParams) (*IpMessagingV2Channel, error) { - path := "/v2/Services/{ServiceSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.CreatedBy != nil { + data.Set("CreatedBy", *params.CreatedBy) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.CreatedBy != nil { - data.Set("CreatedBy", *params.CreatedBy) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2Channel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Channel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v2/services_channels_invites.go b/rest/ip_messaging/v2/services_channels_invites.go index f02e2cbbc..e8090ff63 100644 --- a/rest/ip_messaging/v2/services_channels_invites.go +++ b/rest/ip_messaging/v2/services_channels_invites.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateInvite' type CreateInviteParams struct { - // - Identity *string `json:"Identity,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` + // + Identity *string `json:"Identity,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` } -func (params *CreateInviteParams) SetIdentity(Identity string) *CreateInviteParams { - params.Identity = &Identity - return params +func (params *CreateInviteParams) SetIdentity(Identity string) (*CreateInviteParams){ + params.Identity = &Identity + return params } -func (params *CreateInviteParams) SetRoleSid(RoleSid string) *CreateInviteParams { - params.RoleSid = &RoleSid - return params +func (params *CreateInviteParams) SetRoleSid(RoleSid string) (*CreateInviteParams){ + params.RoleSid = &RoleSid + return params } -// +// func (c *ApiService) CreateInvite(ServiceSid string, ChannelSid string, params *CreateInviteParams) (*IpMessagingV2Invite, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV2Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV2Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteInvite(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV2Invite, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchInvite(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV2Invite, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2Invite{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &IpMessagingV2Invite{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListInvite' type ListInviteParams struct { - // - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInviteParams) SetIdentity(Identity []string) *ListInviteParams { - params.Identity = &Identity - return params +func (params *ListInviteParams) SetIdentity(Identity []string) (*ListInviteParams){ + params.Identity = &Identity + return params } -func (params *ListInviteParams) SetPageSize(PageSize int) *ListInviteParams { - params.PageSize = &PageSize - return params +func (params *ListInviteParams) SetPageSize(PageSize int) (*ListInviteParams){ + params.PageSize = &PageSize + return params } -func (params *ListInviteParams) SetLimit(Limit int) *ListInviteParams { - params.Limit = &Limit - return params +func (params *ListInviteParams) SetLimit(Limit int) (*ListInviteParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Invite records from the API. Request is executed immediately. func (c *ApiService) PageInvite(ServiceSid string, ChannelSid string, params *ListInviteParams, pageToken, pageNumber string) (*ListInviteResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Invite records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamInvite(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInviteParams, recordChannel chan IpMessagingV2Invite, errorChannel chan error) { curRecord := 1 @@ -249,19 +255,20 @@ func (c *ApiService) streamInvite(response *ListInviteResponse, params *ListInvi } func (c *ApiService) getNextListInviteResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInviteResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInviteResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/ip_messaging/v2/services_channels_members.go b/rest/ip_messaging/v2/services_channels_members.go index 724db92cf..26736ae93 100644 --- a/rest/ip_messaging/v2/services_channels_members.go +++ b/rest/ip_messaging/v2/services_channels_members.go @@ -18,237 +18,239 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMember' type CreateMemberParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - Identity *string `json:"Identity,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` - // - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` - // - LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` - // - DateCreated *time.Time `json:"DateCreated,omitempty"` - // - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` -} - -func (params *CreateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateMemberParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateMemberParams) SetIdentity(Identity string) *CreateMemberParams { - params.Identity = &Identity - return params -} -func (params *CreateMemberParams) SetRoleSid(RoleSid string) *CreateMemberParams { - params.RoleSid = &RoleSid - return params -} -func (params *CreateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *CreateMemberParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params -} -func (params *CreateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) *CreateMemberParams { - params.LastConsumptionTimestamp = &LastConsumptionTimestamp - return params -} -func (params *CreateMemberParams) SetDateCreated(DateCreated time.Time) *CreateMemberParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateMemberParams) SetDateUpdated(DateUpdated time.Time) *CreateMemberParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateMemberParams) SetAttributes(Attributes string) *CreateMemberParams { - params.Attributes = &Attributes - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + Identity *string `json:"Identity,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // + LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` + // + DateCreated *time.Time `json:"DateCreated,omitempty"` + // + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` +} + +func (params *CreateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateMemberParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateMemberParams) SetIdentity(Identity string) (*CreateMemberParams){ + params.Identity = &Identity + return params +} +func (params *CreateMemberParams) SetRoleSid(RoleSid string) (*CreateMemberParams){ + params.RoleSid = &RoleSid + return params +} +func (params *CreateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*CreateMemberParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params +} +func (params *CreateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) (*CreateMemberParams){ + params.LastConsumptionTimestamp = &LastConsumptionTimestamp + return params +} +func (params *CreateMemberParams) SetDateCreated(DateCreated time.Time) (*CreateMemberParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateMemberParams) SetDateUpdated(DateUpdated time.Time) (*CreateMemberParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateMemberParams) SetAttributes(Attributes string) (*CreateMemberParams){ + params.Attributes = &Attributes + return params +} + +// func (c *ApiService) CreateMember(ServiceSid string, ChannelSid string, params *CreateMemberParams) (*IpMessagingV2Member, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } + if params != nil && params.LastConsumptionTimestamp != nil { + data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } - if params != nil && params.LastConsumptionTimestamp != nil { - data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteMember' type DeleteMemberParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteMemberParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteMemberParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -// -func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string, params *DeleteMemberParams) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMember(ServiceSid string, ChannelSid string, Sid string, params *DeleteMemberParams) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } -// -func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV2Member, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMember(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV2Member, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &IpMessagingV2Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMember' type ListMemberParams struct { - // - Identity *[]string `json:"Identity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Identity *[]string `json:"Identity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMemberParams) SetIdentity(Identity []string) *ListMemberParams { - params.Identity = &Identity - return params +func (params *ListMemberParams) SetIdentity(Identity []string) (*ListMemberParams){ + params.Identity = &Identity + return params } -func (params *ListMemberParams) SetPageSize(PageSize int) *ListMemberParams { - params.PageSize = &PageSize - return params +func (params *ListMemberParams) SetPageSize(PageSize int) (*ListMemberParams){ + params.PageSize = &PageSize + return params } -func (params *ListMemberParams) SetLimit(Limit int) *ListMemberParams { - params.Limit = &Limit - return params +func (params *ListMemberParams) SetLimit(Limit int) (*ListMemberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Member records from the API. Request is executed immediately. func (c *ApiService) PageMember(ServiceSid string, ChannelSid string, params *ListMemberParams, pageToken, pageNumber string) (*ListMemberResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Member records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -289,6 +291,7 @@ func (c *ApiService) StreamMember(ServiceSid string, ChannelSid string, params * return recordChannel, errorChannel } + func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemberParams, recordChannel chan IpMessagingV2Member, errorChannel chan error) { curRecord := 1 @@ -320,114 +323,115 @@ func (c *ApiService) streamMember(response *ListMemberResponse, params *ListMemb } func (c *ApiService) getNextListMemberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMemberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListMemberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMember' type UpdateMemberParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` - // - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` - // - LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` - // - DateCreated *time.Time `json:"DateCreated,omitempty"` - // - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` -} - -func (params *UpdateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateMemberParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateMemberParams) SetRoleSid(RoleSid string) *UpdateMemberParams { - params.RoleSid = &RoleSid - return params -} -func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *UpdateMemberParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params -} -func (params *UpdateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) *UpdateMemberParams { - params.LastConsumptionTimestamp = &LastConsumptionTimestamp - return params -} -func (params *UpdateMemberParams) SetDateCreated(DateCreated time.Time) *UpdateMemberParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateMemberParams) SetDateUpdated(DateUpdated time.Time) *UpdateMemberParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateMemberParams) SetAttributes(Attributes string) *UpdateMemberParams { - params.Attributes = &Attributes - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // + LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` + // + DateCreated *time.Time `json:"DateCreated,omitempty"` + // + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` +} + +func (params *UpdateMemberParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateMemberParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateMemberParams) SetRoleSid(RoleSid string) (*UpdateMemberParams){ + params.RoleSid = &RoleSid + return params +} +func (params *UpdateMemberParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*UpdateMemberParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params +} +func (params *UpdateMemberParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) (*UpdateMemberParams){ + params.LastConsumptionTimestamp = &LastConsumptionTimestamp + return params +} +func (params *UpdateMemberParams) SetDateCreated(DateCreated time.Time) (*UpdateMemberParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateMemberParams) SetDateUpdated(DateUpdated time.Time) (*UpdateMemberParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateMemberParams) SetAttributes(Attributes string) (*UpdateMemberParams){ + params.Attributes = &Attributes + return params +} + +// func (c *ApiService) UpdateMember(ServiceSid string, ChannelSid string, Sid string, params *UpdateMemberParams) (*IpMessagingV2Member, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } + if params != nil && params.LastConsumptionTimestamp != nil { + data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } - if params != nil && params.LastConsumptionTimestamp != nil { - data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2Member{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Member{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v2/services_channels_messages.go b/rest/ip_messaging/v2/services_channels_messages.go index 4f53a5345..25e24a68a 100644 --- a/rest/ip_messaging/v2/services_channels_messages.go +++ b/rest/ip_messaging/v2/services_channels_messages.go @@ -18,235 +18,237 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessage' type CreateMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - From *string `json:"From,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - DateCreated *time.Time `json:"DateCreated,omitempty"` - // - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` - // - Body *string `json:"Body,omitempty"` - // - MediaSid *string `json:"MediaSid,omitempty"` -} - -func (params *CreateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *CreateMessageParams) SetFrom(From string) *CreateMessageParams { - params.From = &From - return params -} -func (params *CreateMessageParams) SetAttributes(Attributes string) *CreateMessageParams { - params.Attributes = &Attributes - return params -} -func (params *CreateMessageParams) SetDateCreated(DateCreated time.Time) *CreateMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *CreateMessageParams) SetDateUpdated(DateUpdated time.Time) *CreateMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *CreateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) *CreateMessageParams { - params.LastUpdatedBy = &LastUpdatedBy - return params -} -func (params *CreateMessageParams) SetBody(Body string) *CreateMessageParams { - params.Body = &Body - return params -} -func (params *CreateMessageParams) SetMediaSid(MediaSid string) *CreateMessageParams { - params.MediaSid = &MediaSid - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + From *string `json:"From,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + DateCreated *time.Time `json:"DateCreated,omitempty"` + // + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` + // + Body *string `json:"Body,omitempty"` + // + MediaSid *string `json:"MediaSid,omitempty"` +} + +func (params *CreateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *CreateMessageParams) SetFrom(From string) (*CreateMessageParams){ + params.From = &From + return params +} +func (params *CreateMessageParams) SetAttributes(Attributes string) (*CreateMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *CreateMessageParams) SetDateCreated(DateCreated time.Time) (*CreateMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *CreateMessageParams) SetDateUpdated(DateUpdated time.Time) (*CreateMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *CreateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) (*CreateMessageParams){ + params.LastUpdatedBy = &LastUpdatedBy + return params +} +func (params *CreateMessageParams) SetBody(Body string) (*CreateMessageParams){ + params.Body = &Body + return params +} +func (params *CreateMessageParams) SetMediaSid(MediaSid string) (*CreateMessageParams){ + params.MediaSid = &MediaSid + return params +} + +// func (c *ApiService) CreateMessage(ServiceSid string, ChannelSid string, params *CreateMessageParams) (*IpMessagingV2Message, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.LastUpdatedBy != nil { + data.Set("LastUpdatedBy", *params.LastUpdatedBy) + } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.MediaSid != nil { + data.Set("MediaSid", *params.MediaSid) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.LastUpdatedBy != nil { - data.Set("LastUpdatedBy", *params.LastUpdatedBy) - } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.MediaSid != nil { - data.Set("MediaSid", *params.MediaSid) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'DeleteMessage' type DeleteMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` } -func (params *DeleteMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *DeleteMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *DeleteMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*DeleteMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -// -func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string, params *DeleteMessageParams) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteMessage(ServiceSid string, ChannelSid string, Sid string, params *DeleteMessageParams) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + defer resp.Body.Close() - defer resp.Body.Close() - - return nil + return nil } -// -func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV2Message, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMessage(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV2Message, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &IpMessagingV2Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMessage' type ListMessageParams struct { - // - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessageParams) SetOrder(Order string) *ListMessageParams { - params.Order = &Order - return params +func (params *ListMessageParams) SetOrder(Order string) (*ListMessageParams){ + params.Order = &Order + return params } -func (params *ListMessageParams) SetPageSize(PageSize int) *ListMessageParams { - params.PageSize = &PageSize - return params +func (params *ListMessageParams) SetPageSize(PageSize int) (*ListMessageParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessageParams) SetLimit(Limit int) *ListMessageParams { - params.Limit = &Limit - return params +func (params *ListMessageParams) SetLimit(Limit int) (*ListMessageParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Message records from the API. Request is executed immediately. func (c *ApiService) PageMessage(ServiceSid string, ChannelSid string, params *ListMessageParams, pageToken, pageNumber string) (*ListMessageResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Message records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -287,6 +289,7 @@ func (c *ApiService) StreamMessage(ServiceSid string, ChannelSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMessageParams, recordChannel chan IpMessagingV2Message, errorChannel chan error) { curRecord := 1 @@ -318,114 +321,115 @@ func (c *ApiService) streamMessage(response *ListMessageResponse, params *ListMe } func (c *ApiService) getNextListMessageResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListMessageResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMessage' type UpdateMessageParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - Body *string `json:"Body,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - DateCreated *time.Time `json:"DateCreated,omitempty"` - // - DateUpdated *time.Time `json:"DateUpdated,omitempty"` - // - LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` - // - From *string `json:"From,omitempty"` -} - -func (params *UpdateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateMessageParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params -} -func (params *UpdateMessageParams) SetBody(Body string) *UpdateMessageParams { - params.Body = &Body - return params -} -func (params *UpdateMessageParams) SetAttributes(Attributes string) *UpdateMessageParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateMessageParams) SetDateCreated(DateCreated time.Time) *UpdateMessageParams { - params.DateCreated = &DateCreated - return params -} -func (params *UpdateMessageParams) SetDateUpdated(DateUpdated time.Time) *UpdateMessageParams { - params.DateUpdated = &DateUpdated - return params -} -func (params *UpdateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) *UpdateMessageParams { - params.LastUpdatedBy = &LastUpdatedBy - return params -} -func (params *UpdateMessageParams) SetFrom(From string) *UpdateMessageParams { - params.From = &From - return params -} - -// + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + Body *string `json:"Body,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + DateCreated *time.Time `json:"DateCreated,omitempty"` + // + DateUpdated *time.Time `json:"DateUpdated,omitempty"` + // + LastUpdatedBy *string `json:"LastUpdatedBy,omitempty"` + // + From *string `json:"From,omitempty"` +} + +func (params *UpdateMessageParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateMessageParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params +} +func (params *UpdateMessageParams) SetBody(Body string) (*UpdateMessageParams){ + params.Body = &Body + return params +} +func (params *UpdateMessageParams) SetAttributes(Attributes string) (*UpdateMessageParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateMessageParams) SetDateCreated(DateCreated time.Time) (*UpdateMessageParams){ + params.DateCreated = &DateCreated + return params +} +func (params *UpdateMessageParams) SetDateUpdated(DateUpdated time.Time) (*UpdateMessageParams){ + params.DateUpdated = &DateUpdated + return params +} +func (params *UpdateMessageParams) SetLastUpdatedBy(LastUpdatedBy string) (*UpdateMessageParams){ + params.LastUpdatedBy = &LastUpdatedBy + return params +} +func (params *UpdateMessageParams) SetFrom(From string) (*UpdateMessageParams){ + params.From = &From + return params +} + +// func (c *ApiService) UpdateMessage(ServiceSid string, ChannelSid string, Sid string, params *UpdateMessageParams) (*IpMessagingV2Message, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.DateCreated != nil { + data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) + } + if params != nil && params.DateUpdated != nil { + data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) + } + if params != nil && params.LastUpdatedBy != nil { + data.Set("LastUpdatedBy", *params.LastUpdatedBy) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.DateCreated != nil { - data.Set("DateCreated", fmt.Sprint((*params.DateCreated).Format(time.RFC3339))) - } - if params != nil && params.DateUpdated != nil { - data.Set("DateUpdated", fmt.Sprint((*params.DateUpdated).Format(time.RFC3339))) - } - if params != nil && params.LastUpdatedBy != nil { - data.Set("LastUpdatedBy", *params.LastUpdatedBy) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2Message{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Message{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v2/services_channels_webhooks.go b/rest/ip_messaging/v2/services_channels_webhooks.go index 76535a9e2..99de3dc25 100644 --- a/rest/ip_messaging/v2/services_channels_webhooks.go +++ b/rest/ip_messaging/v2/services_channels_webhooks.go @@ -18,204 +18,209 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChannelWebhook' type CreateChannelWebhookParams struct { - // - Type *string `json:"Type,omitempty"` - // - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` - // - ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` + // + Type *string `json:"Type,omitempty"` + // + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // + ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` } -func (params *CreateChannelWebhookParams) SetType(Type string) *CreateChannelWebhookParams { - params.Type = &Type - return params +func (params *CreateChannelWebhookParams) SetType(Type string) (*CreateChannelWebhookParams){ + params.Type = &Type + return params } -func (params *CreateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *CreateChannelWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *CreateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*CreateChannelWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *CreateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *CreateChannelWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *CreateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*CreateChannelWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *CreateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *CreateChannelWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *CreateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*CreateChannelWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *CreateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *CreateChannelWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *CreateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*CreateChannelWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *CreateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *CreateChannelWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *CreateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*CreateChannelWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } -func (params *CreateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) *CreateChannelWebhookParams { - params.ConfigurationRetryCount = &ConfigurationRetryCount - return params +func (params *CreateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) (*CreateChannelWebhookParams){ + params.ConfigurationRetryCount = &ConfigurationRetryCount + return params } -// +// func (c *ApiService) CreateChannelWebhook(ServiceSid string, ChannelSid string, params *CreateChannelWebhookParams) (*IpMessagingV2ChannelWebhook, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + if params != nil && params.ConfigurationRetryCount != nil { + data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2ChannelWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteChannelWebhook(ServiceSid string, ChannelSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - if params != nil && params.ConfigurationRetryCount != nil { - data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2ChannelWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return ps, err -} + defer resp.Body.Close() -// -func (c *ApiService) DeleteChannelWebhook(ServiceSid string, ChannelSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchChannelWebhook(ServiceSid string, ChannelSid string, Sid string, ) (*IpMessagingV2ChannelWebhook, error) { + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchChannelWebhook(ServiceSid string, ChannelSid string, Sid string) (*IpMessagingV2ChannelWebhook, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV2ChannelWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2ChannelWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListChannelWebhook' type ListChannelWebhookParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelWebhookParams) SetPageSize(PageSize int) *ListChannelWebhookParams { - params.PageSize = &PageSize - return params +func (params *ListChannelWebhookParams) SetPageSize(PageSize int) (*ListChannelWebhookParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelWebhookParams) SetLimit(Limit int) *ListChannelWebhookParams { - params.Limit = &Limit - return params +func (params *ListChannelWebhookParams) SetLimit(Limit int) (*ListChannelWebhookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ChannelWebhook records from the API. Request is executed immediately. func (c *ApiService) PageChannelWebhook(ServiceSid string, ChannelSid string, params *ListChannelWebhookParams, pageToken, pageNumber string) (*ListChannelWebhookResponse, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListChannelWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ChannelWebhook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -256,6 +261,7 @@ func (c *ApiService) StreamChannelWebhook(ServiceSid string, ChannelSid string, return recordChannel, errorChannel } + func (c *ApiService) streamChannelWebhook(response *ListChannelWebhookResponse, params *ListChannelWebhookParams, recordChannel chan IpMessagingV2ChannelWebhook, errorChannel chan error) { curRecord := 1 @@ -287,108 +293,110 @@ func (c *ApiService) streamChannelWebhook(response *ListChannelWebhookResponse, } func (c *ApiService) getNextListChannelWebhookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChannelWebhook' type UpdateChannelWebhookParams struct { - // - ConfigurationUrl *string `json:"Configuration.Url,omitempty"` - // - ConfigurationMethod *string `json:"Configuration.Method,omitempty"` - // - ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` - // - ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` - // - ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` - // - ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` + // + ConfigurationUrl *string `json:"Configuration.Url,omitempty"` + // + ConfigurationMethod *string `json:"Configuration.Method,omitempty"` + // + ConfigurationFilters *[]string `json:"Configuration.Filters,omitempty"` + // + ConfigurationTriggers *[]string `json:"Configuration.Triggers,omitempty"` + // + ConfigurationFlowSid *string `json:"Configuration.FlowSid,omitempty"` + // + ConfigurationRetryCount *int `json:"Configuration.RetryCount,omitempty"` } -func (params *UpdateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) *UpdateChannelWebhookParams { - params.ConfigurationUrl = &ConfigurationUrl - return params +func (params *UpdateChannelWebhookParams) SetConfigurationUrl(ConfigurationUrl string) (*UpdateChannelWebhookParams){ + params.ConfigurationUrl = &ConfigurationUrl + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) *UpdateChannelWebhookParams { - params.ConfigurationMethod = &ConfigurationMethod - return params +func (params *UpdateChannelWebhookParams) SetConfigurationMethod(ConfigurationMethod string) (*UpdateChannelWebhookParams){ + params.ConfigurationMethod = &ConfigurationMethod + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) *UpdateChannelWebhookParams { - params.ConfigurationFilters = &ConfigurationFilters - return params +func (params *UpdateChannelWebhookParams) SetConfigurationFilters(ConfigurationFilters []string) (*UpdateChannelWebhookParams){ + params.ConfigurationFilters = &ConfigurationFilters + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) *UpdateChannelWebhookParams { - params.ConfigurationTriggers = &ConfigurationTriggers - return params +func (params *UpdateChannelWebhookParams) SetConfigurationTriggers(ConfigurationTriggers []string) (*UpdateChannelWebhookParams){ + params.ConfigurationTriggers = &ConfigurationTriggers + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) *UpdateChannelWebhookParams { - params.ConfigurationFlowSid = &ConfigurationFlowSid - return params +func (params *UpdateChannelWebhookParams) SetConfigurationFlowSid(ConfigurationFlowSid string) (*UpdateChannelWebhookParams){ + params.ConfigurationFlowSid = &ConfigurationFlowSid + return params } -func (params *UpdateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) *UpdateChannelWebhookParams { - params.ConfigurationRetryCount = &ConfigurationRetryCount - return params +func (params *UpdateChannelWebhookParams) SetConfigurationRetryCount(ConfigurationRetryCount int) (*UpdateChannelWebhookParams){ + params.ConfigurationRetryCount = &ConfigurationRetryCount + return params } -// +// func (c *ApiService) UpdateChannelWebhook(ServiceSid string, ChannelSid string, Sid string, params *UpdateChannelWebhookParams) (*IpMessagingV2ChannelWebhook, error) { - path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ConfigurationUrl != nil { - data.Set("Configuration.Url", *params.ConfigurationUrl) - } - if params != nil && params.ConfigurationMethod != nil { - data.Set("Configuration.Method", *params.ConfigurationMethod) - } - if params != nil && params.ConfigurationFilters != nil { - for _, item := range *params.ConfigurationFilters { - data.Add("Configuration.Filters", item) - } - } - if params != nil && params.ConfigurationTriggers != nil { - for _, item := range *params.ConfigurationTriggers { - data.Add("Configuration.Triggers", item) - } - } - if params != nil && params.ConfigurationFlowSid != nil { - data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) - } - if params != nil && params.ConfigurationRetryCount != nil { - data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IpMessagingV2ChannelWebhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ConfigurationUrl != nil { + data.Set("Configuration.Url", *params.ConfigurationUrl) + } + if params != nil && params.ConfigurationMethod != nil { + data.Set("Configuration.Method", *params.ConfigurationMethod) + } + if params != nil && params.ConfigurationFilters != nil { + for _, item := range *params.ConfigurationFilters { + data.Add("Configuration.Filters", item) + } + } + if params != nil && params.ConfigurationTriggers != nil { + for _, item := range *params.ConfigurationTriggers { + data.Add("Configuration.Triggers", item) + } + } + if params != nil && params.ConfigurationFlowSid != nil { + data.Set("Configuration.FlowSid", *params.ConfigurationFlowSid) + } + if params != nil && params.ConfigurationRetryCount != nil { + data.Set("Configuration.RetryCount", fmt.Sprint(*params.ConfigurationRetryCount)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2ChannelWebhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/ip_messaging/v2/services_roles.go b/rest/ip_messaging/v2/services_roles.go index 62bc98a4d..f48a76e79 100644 --- a/rest/ip_messaging/v2/services_roles.go +++ b/rest/ip_messaging/v2/services_roles.go @@ -18,162 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRole' type CreateRoleParams struct { - // - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // - Permission *[]string `json:"Permission,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // + Permission *[]string `json:"Permission,omitempty"` } -func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) *CreateRoleParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRoleParams) SetFriendlyName(FriendlyName string) (*CreateRoleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRoleParams) SetType(Type string) *CreateRoleParams { - params.Type = &Type - return params +func (params *CreateRoleParams) SetType(Type string) (*CreateRoleParams){ + params.Type = &Type + return params } -func (params *CreateRoleParams) SetPermission(Permission []string) *CreateRoleParams { - params.Permission = &Permission - return params +func (params *CreateRoleParams) SetPermission(Permission []string) (*CreateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) CreateRole(ServiceSid string, params *CreateRoleParams) (*IpMessagingV2Role, error) { - path := "/v2/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Roles" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteRole(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - ps := &IpMessagingV2Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteRole(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchRole(ServiceSid string, Sid string, ) (*IpMessagingV2Role, error) { + path := "/v2/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchRole(ServiceSid string, Sid string) (*IpMessagingV2Role, error) { - path := "/v2/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV2Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListRole' type ListRoleParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoleParams) SetPageSize(PageSize int) *ListRoleParams { - params.PageSize = &PageSize - return params +func (params *ListRoleParams) SetPageSize(PageSize int) (*ListRoleParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoleParams) SetLimit(Limit int) *ListRoleParams { - params.Limit = &Limit - return params +func (params *ListRoleParams) SetLimit(Limit int) (*ListRoleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Role records from the API. Request is executed immediately. func (c *ApiService) PageRole(ServiceSid string, params *ListRoleParams, pageToken, pageNumber string) (*ListRoleResponse, error) { - path := "/v2/Services/{ServiceSid}/Roles" + path := "/v2/Services/{ServiceSid}/Roles" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Role records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -214,6 +219,7 @@ func (c *ApiService) StreamRole(ServiceSid string, params *ListRoleParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRoleParams, recordChannel chan IpMessagingV2Role, errorChannel chan error) { curRecord := 1 @@ -245,60 +251,62 @@ func (c *ApiService) streamRole(response *ListRoleResponse, params *ListRolePara } func (c *ApiService) getNextListRoleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRole' type UpdateRoleParams struct { - // - Permission *[]string `json:"Permission,omitempty"` + // + Permission *[]string `json:"Permission,omitempty"` } -func (params *UpdateRoleParams) SetPermission(Permission []string) *UpdateRoleParams { - params.Permission = &Permission - return params +func (params *UpdateRoleParams) SetPermission(Permission []string) (*UpdateRoleParams){ + params.Permission = &Permission + return params } -// +// func (c *ApiService) UpdateRole(ServiceSid string, Sid string, params *UpdateRoleParams) (*IpMessagingV2Role, error) { - path := "/v2/Services/{ServiceSid}/Roles/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/Roles/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Permission != nil { - for _, item := range *params.Permission { - data.Add("Permission", item) - } - } + if params != nil && params.Permission != nil { + for _, item := range *params.Permission { + data.Add("Permission", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &IpMessagingV2Role{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &IpMessagingV2Role{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v2/services_users.go b/rest/ip_messaging/v2/services_users.go index 8a490a67e..2b1149b37 100644 --- a/rest/ip_messaging/v2/services_users.go +++ b/rest/ip_messaging/v2/services_users.go @@ -18,179 +18,183 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUser' type CreateUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - Identity *string `json:"Identity,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + Identity *string `json:"Identity,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *CreateUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *CreateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*CreateUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *CreateUserParams) SetIdentity(Identity string) *CreateUserParams { - params.Identity = &Identity - return params +func (params *CreateUserParams) SetIdentity(Identity string) (*CreateUserParams){ + params.Identity = &Identity + return params } -func (params *CreateUserParams) SetRoleSid(RoleSid string) *CreateUserParams { - params.RoleSid = &RoleSid - return params +func (params *CreateUserParams) SetRoleSid(RoleSid string) (*CreateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *CreateUserParams) SetAttributes(Attributes string) *CreateUserParams { - params.Attributes = &Attributes - return params +func (params *CreateUserParams) SetAttributes(Attributes string) (*CreateUserParams){ + params.Attributes = &Attributes + return params } -func (params *CreateUserParams) SetFriendlyName(FriendlyName string) *CreateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateUserParams) SetFriendlyName(FriendlyName string) (*CreateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateUser(ServiceSid string, params *CreateUserParams) (*IpMessagingV2User, error) { - path := "/v2/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Users" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &IpMessagingV2User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteUser(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteUser(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchUser(ServiceSid string, Sid string) (*IpMessagingV2User, error) { - path := "/v2/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchUser(ServiceSid string, Sid string, ) (*IpMessagingV2User, error) { + path := "/v2/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListUser' type ListUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserParams) SetPageSize(PageSize int) *ListUserParams { - params.PageSize = &PageSize - return params +func (params *ListUserParams) SetPageSize(PageSize int) (*ListUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserParams) SetLimit(Limit int) *ListUserParams { - params.Limit = &Limit - return params +func (params *ListUserParams) SetLimit(Limit int) (*ListUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of User records from the API. Request is executed immediately. func (c *ApiService) PageUser(ServiceSid string, params *ListUserParams, pageToken, pageNumber string) (*ListUserResponse, error) { - path := "/v2/Services/{ServiceSid}/Users" + path := "/v2/Services/{ServiceSid}/Users" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists User records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -231,6 +235,7 @@ func (c *ApiService) StreamUser(ServiceSid string, params *ListUserParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserParams, recordChannel chan IpMessagingV2User, errorChannel chan error) { curRecord := 1 @@ -262,86 +267,87 @@ func (c *ApiService) streamUser(response *ListUserResponse, params *ListUserPara } func (c *ApiService) getNextListUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUser' type UpdateUserParams struct { - // The X-Twilio-Webhook-Enabled HTTP request header - XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` - // - RoleSid *string `json:"RoleSid,omitempty"` - // - Attributes *string `json:"Attributes,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // The X-Twilio-Webhook-Enabled HTTP request header + XTwilioWebhookEnabled *string `json:"X-Twilio-Webhook-Enabled,omitempty"` + // + RoleSid *string `json:"RoleSid,omitempty"` + // + Attributes *string `json:"Attributes,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) *UpdateUserParams { - params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled - return params +func (params *UpdateUserParams) SetXTwilioWebhookEnabled(XTwilioWebhookEnabled string) (*UpdateUserParams){ + params.XTwilioWebhookEnabled = &XTwilioWebhookEnabled + return params } -func (params *UpdateUserParams) SetRoleSid(RoleSid string) *UpdateUserParams { - params.RoleSid = &RoleSid - return params +func (params *UpdateUserParams) SetRoleSid(RoleSid string) (*UpdateUserParams){ + params.RoleSid = &RoleSid + return params } -func (params *UpdateUserParams) SetAttributes(Attributes string) *UpdateUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateUserParams) SetAttributes(Attributes string) (*UpdateUserParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) *UpdateUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateUserParams) SetFriendlyName(FriendlyName string) (*UpdateUserParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateUser(ServiceSid string, Sid string, params *UpdateUserParams) (*IpMessagingV2User, error) { - path := "/v2/Services/{ServiceSid}/Users/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/Users/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RoleSid != nil { + data.Set("RoleSid", *params.RoleSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.RoleSid != nil { - data.Set("RoleSid", *params.RoleSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } if params != nil && params.XTwilioWebhookEnabled != nil { headers["X-Twilio-Webhook-Enabled"] = *params.XTwilioWebhookEnabled } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &IpMessagingV2User{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &IpMessagingV2User{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/ip_messaging/v2/services_users_bindings.go b/rest/ip_messaging/v2/services_users_bindings.go index 3ee4e8c86..87a7868c9 100644 --- a/rest/ip_messaging/v2/services_users_bindings.go +++ b/rest/ip_messaging/v2/services_users_bindings.go @@ -18,118 +18,122 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteUserBinding(ServiceSid string, UserSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteUserBinding(ServiceSid string, UserSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchUserBinding(ServiceSid string, UserSid string, Sid string) (*IpMessagingV2UserBinding, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchUserBinding(ServiceSid string, UserSid string, Sid string, ) (*IpMessagingV2UserBinding, error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2UserBinding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &IpMessagingV2UserBinding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUserBinding' type ListUserBindingParams struct { - // - BindingType *[]string `json:"BindingType,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // + BindingType *[]string `json:"BindingType,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserBindingParams) SetBindingType(BindingType []string) *ListUserBindingParams { - params.BindingType = &BindingType - return params +func (params *ListUserBindingParams) SetBindingType(BindingType []string) (*ListUserBindingParams){ + params.BindingType = &BindingType + return params } -func (params *ListUserBindingParams) SetPageSize(PageSize int) *ListUserBindingParams { - params.PageSize = &PageSize - return params +func (params *ListUserBindingParams) SetPageSize(PageSize int) (*ListUserBindingParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserBindingParams) SetLimit(Limit int) *ListUserBindingParams { - params.Limit = &Limit - return params +func (params *ListUserBindingParams) SetLimit(Limit int) (*ListUserBindingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserBinding records from the API. Request is executed immediately. func (c *ApiService) PageUserBinding(ServiceSid string, UserSid string, params *ListUserBindingParams, pageToken, pageNumber string) (*ListUserBindingResponse, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BindingType != nil { - for _, item := range *params.BindingType { - data.Add("BindingType", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Bindings" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BindingType != nil { + for _, item := range *params.BindingType { + data.Add("BindingType", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UserBinding records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -170,6 +174,7 @@ func (c *ApiService) StreamUserBinding(ServiceSid string, UserSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamUserBinding(response *ListUserBindingResponse, params *ListUserBindingParams, recordChannel chan IpMessagingV2UserBinding, errorChannel chan error) { curRecord := 1 @@ -201,19 +206,20 @@ func (c *ApiService) streamUserBinding(response *ListUserBindingResponse, params } func (c *ApiService) getNextListUserBindingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/ip_messaging/v2/services_users_channels.go b/rest/ip_messaging/v2/services_users_channels.go index 08d882ce7..34888ef8a 100644 --- a/rest/ip_messaging/v2/services_users_channels.go +++ b/rest/ip_messaging/v2/services_users_channels.go @@ -18,108 +18,111 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteUserChannel(ServiceSid string, UserSid string, ChannelSid string) error { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteUserChannel(ServiceSid string, UserSid string, ChannelSid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchUserChannel(ServiceSid string, UserSid string, ChannelSid string) (*IpMessagingV2UserChannel, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) +// +func (c *ApiService) FetchUserChannel(ServiceSid string, UserSid string, ChannelSid string, ) (*IpMessagingV2UserChannel, error) { + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &IpMessagingV2UserChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &IpMessagingV2UserChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListUserChannel' type ListUserChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUserChannelParams) SetPageSize(PageSize int) *ListUserChannelParams { - params.PageSize = &PageSize - return params +func (params *ListUserChannelParams) SetPageSize(PageSize int) (*ListUserChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListUserChannelParams) SetLimit(Limit int) *ListUserChannelParams { - params.Limit = &Limit - return params +func (params *ListUserChannelParams) SetLimit(Limit int) (*ListUserChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UserChannel records from the API. Request is executed immediately. func (c *ApiService) PageUserChannel(ServiceSid string, UserSid string, params *ListUserChannelParams, pageToken, pageNumber string) (*ListUserChannelResponse, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels" + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UserChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -160,6 +163,7 @@ func (c *ApiService) StreamUserChannel(ServiceSid string, UserSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params *ListUserChannelParams, recordChannel chan IpMessagingV2UserChannel, errorChannel chan error) { curRecord := 1 @@ -191,77 +195,79 @@ func (c *ApiService) streamUserChannel(response *ListUserChannelResponse, params } func (c *ApiService) getNextListUserChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUserChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUserChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateUserChannel' type UpdateUserChannelParams struct { - // - NotificationLevel *string `json:"NotificationLevel,omitempty"` - // - LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` - // - LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` + // + NotificationLevel *string `json:"NotificationLevel,omitempty"` + // + LastConsumedMessageIndex *int `json:"LastConsumedMessageIndex,omitempty"` + // + LastConsumptionTimestamp *time.Time `json:"LastConsumptionTimestamp,omitempty"` } -func (params *UpdateUserChannelParams) SetNotificationLevel(NotificationLevel string) *UpdateUserChannelParams { - params.NotificationLevel = &NotificationLevel - return params +func (params *UpdateUserChannelParams) SetNotificationLevel(NotificationLevel string) (*UpdateUserChannelParams){ + params.NotificationLevel = &NotificationLevel + return params } -func (params *UpdateUserChannelParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) *UpdateUserChannelParams { - params.LastConsumedMessageIndex = &LastConsumedMessageIndex - return params +func (params *UpdateUserChannelParams) SetLastConsumedMessageIndex(LastConsumedMessageIndex int) (*UpdateUserChannelParams){ + params.LastConsumedMessageIndex = &LastConsumedMessageIndex + return params } -func (params *UpdateUserChannelParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) *UpdateUserChannelParams { - params.LastConsumptionTimestamp = &LastConsumptionTimestamp - return params +func (params *UpdateUserChannelParams) SetLastConsumptionTimestamp(LastConsumptionTimestamp time.Time) (*UpdateUserChannelParams){ + params.LastConsumptionTimestamp = &LastConsumptionTimestamp + return params } -// +// func (c *ApiService) UpdateUserChannel(ServiceSid string, UserSid string, ChannelSid string, params *UpdateUserChannelParams) (*IpMessagingV2UserChannel, error) { - path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) - path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.NotificationLevel != nil { - data.Set("NotificationLevel", *params.NotificationLevel) - } - if params != nil && params.LastConsumedMessageIndex != nil { - data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) - } - if params != nil && params.LastConsumptionTimestamp != nil { - data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &IpMessagingV2UserChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Users/{UserSid}/Channels/{ChannelSid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"UserSid"+"}", UserSid, -1) + path = strings.Replace(path, "{"+"ChannelSid"+"}", ChannelSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.NotificationLevel != nil { + data.Set("NotificationLevel", *params.NotificationLevel) + } + if params != nil && params.LastConsumedMessageIndex != nil { + data.Set("LastConsumedMessageIndex", fmt.Sprint(*params.LastConsumedMessageIndex)) + } + if params != nil && params.LastConsumptionTimestamp != nil { + data.Set("LastConsumptionTimestamp", fmt.Sprint((*params.LastConsumptionTimestamp).Format(time.RFC3339))) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &IpMessagingV2UserChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/lookups/v1/README.md b/rest/lookups/v1/README.md index 77f4851ad..0fe57e708 100644 --- a/rest/lookups/v1/README.md +++ b/rest/lookups/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/lookups/v1/api_service.go b/rest/lookups/v1/api_service.go index a28eaac94..c8a354999 100644 --- a/rest/lookups/v1/api_service.go +++ b/rest/lookups/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://lookups.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/lookups/v1/model_lookups_v1_phone_number.go b/rest/lookups/v1/model_lookups_v1_phone_number.go index fa8028ec8..60d850253 100644 --- a/rest/lookups/v1/model_lookups_v1_phone_number.go +++ b/rest/lookups/v1/model_lookups_v1_phone_number.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // LookupsV1PhoneNumber struct for LookupsV1PhoneNumber type LookupsV1PhoneNumber struct { - // The name of the phone number's owner. If `null`, that information was not available. + // The name of the phone number's owner. If `null`, that information was not available. CallerName *interface{} `json:"caller_name,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number. CountryCode *string `json:"country_code,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The phone number, in national format. + // The phone number, in national format. NationalFormat *string `json:"national_format,omitempty"` - // The telecom company that provides the phone number. + // The telecom company that provides the phone number. Carrier *interface{} `json:"carrier,omitempty"` - // A JSON string with the results of the Add-ons you specified in the `add_ons` parameters. For the format of the object, see [Using Add-ons](https://www.twilio.com/docs/add-ons). + // A JSON string with the results of the Add-ons you specified in the `add_ons` parameters. For the format of the object, see [Using Add-ons](https://www.twilio.com/docs/add-ons). AddOns *interface{} `json:"add_ons,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/lookups/v1/phone_numbers.go b/rest/lookups/v1/phone_numbers.go index 437c00a8f..239fc9a0f 100644 --- a/rest/lookups/v1/phone_numbers.go +++ b/rest/lookups/v1/phone_numbers.go @@ -16,81 +16,85 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchPhoneNumber' type FetchPhoneNumberParams struct { - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. - CountryCode *string `json:"CountryCode,omitempty"` - // The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. - Type *[]string `json:"Type,omitempty"` - // The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). - AddOns *[]string `json:"AddOns,omitempty"` - // Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. - AddOnsData *map[string]interface{} `json:"AddOnsData,omitempty"` + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. + CountryCode *string `json:"CountryCode,omitempty"` + // The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. + Type *[]string `json:"Type,omitempty"` + // The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). + AddOns *[]string `json:"AddOns,omitempty"` + // Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. + AddOnsData *map[string]interface{} `json:"AddOnsData,omitempty"` } -func (params *FetchPhoneNumberParams) SetCountryCode(CountryCode string) *FetchPhoneNumberParams { - params.CountryCode = &CountryCode - return params +func (params *FetchPhoneNumberParams) SetCountryCode(CountryCode string) (*FetchPhoneNumberParams){ + params.CountryCode = &CountryCode + return params } -func (params *FetchPhoneNumberParams) SetType(Type []string) *FetchPhoneNumberParams { - params.Type = &Type - return params +func (params *FetchPhoneNumberParams) SetType(Type []string) (*FetchPhoneNumberParams){ + params.Type = &Type + return params } -func (params *FetchPhoneNumberParams) SetAddOns(AddOns []string) *FetchPhoneNumberParams { - params.AddOns = &AddOns - return params +func (params *FetchPhoneNumberParams) SetAddOns(AddOns []string) (*FetchPhoneNumberParams){ + params.AddOns = &AddOns + return params } -func (params *FetchPhoneNumberParams) SetAddOnsData(AddOnsData map[string]interface{}) *FetchPhoneNumberParams { - params.AddOnsData = &AddOnsData - return params +func (params *FetchPhoneNumberParams) SetAddOnsData(AddOnsData map[string]interface{}) (*FetchPhoneNumberParams){ + params.AddOnsData = &AddOnsData + return params } -// +// func (c *ApiService) FetchPhoneNumber(PhoneNumber string, params *FetchPhoneNumberParams) (*LookupsV1PhoneNumber, error) { - path := "/v1/PhoneNumbers/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CountryCode != nil { - data.Set("CountryCode", *params.CountryCode) - } - if params != nil && params.Type != nil { - for _, item := range *params.Type { - data.Add("Type", item) - } - } - if params != nil && params.AddOns != nil { - for _, item := range *params.AddOns { - data.Add("AddOns", item) - } - } - if params != nil && params.AddOnsData != nil { - v, err := json.Marshal(params.AddOnsData) - - if err != nil { - return nil, err - } - - data.Set("AddOnsData", string(v)) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &LookupsV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/PhoneNumbers/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CountryCode != nil { + data.Set("CountryCode", *params.CountryCode) + } + if params != nil && params.Type != nil { + for _, item := range *params.Type { + data.Add("Type", item) + } + } + if params != nil && params.AddOns != nil { + for _, item := range *params.AddOns { + data.Add("AddOns", item) + } + } + if params != nil && params.AddOnsData != nil { + v, err := json.Marshal(params.AddOnsData) + + if err != nil { + return nil, err + } + + data.Set("AddOnsData", string(v)) + } + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &LookupsV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/lookups/v2/README.md b/rest/lookups/v2/README.md index 5d906ebab..068d2972c 100644 --- a/rest/lookups/v2/README.md +++ b/rest/lookups/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/lookups/v2/api_service.go b/rest/lookups/v2/api_service.go index a28eaac94..c8a354999 100644 --- a/rest/lookups/v2/api_service.go +++ b/rest/lookups/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://lookups.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/lookups/v2/docs/LookupsV2PhoneNumber.md b/rest/lookups/v2/docs/LookupsV2PhoneNumber.md index 4f82d134a..68bf0e002 100644 --- a/rest/lookups/v2/docs/LookupsV2PhoneNumber.md +++ b/rest/lookups/v2/docs/LookupsV2PhoneNumber.md @@ -18,7 +18,7 @@ Name | Type | Description | Notes **IdentityMatch** | Pointer to **interface{}** | An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources | **ReassignedNumber** | Pointer to **interface{}** | An object that contains reassigned number information. Reassigned Numbers will return a phone number's reassignment status given a phone number and date | **SmsPumpingRisk** | Pointer to **interface{}** | An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. | -**PhoneNumberQualityScore** | Pointer to **interface{}** | An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number. | +**DisposablePhoneNumberRisk** | Pointer to **interface{}** | An object that contains information on if a mobile phone number could be a disposable or burner number. | **Url** | Pointer to **string** | The absolute URL of the resource. | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/lookups/v2/model_lookups_v2_phone_number.go b/rest/lookups/v2/model_lookups_v2_phone_number.go index 23bb8715a..016bd1190 100644 --- a/rest/lookups/v2/model_lookups_v2_phone_number.go +++ b/rest/lookups/v2/model_lookups_v2_phone_number.go @@ -13,39 +13,44 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // LookupsV2PhoneNumber struct for LookupsV2PhoneNumber type LookupsV2PhoneNumber struct { - // International dialing prefix of the phone number defined in the E.164 standard. + // International dialing prefix of the phone number defined in the E.164 standard. CallingCountryCode *string `json:"calling_country_code,omitempty"` - // The phone number's [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The phone number's [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). CountryCode *string `json:"country_code,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The phone number in [national format](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers). + // The phone number in [national format](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers). NationalFormat *string `json:"national_format,omitempty"` - // Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user. + // Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user. Valid *bool `json:"valid,omitempty"` - // Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER. + // Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER. ValidationErrors *[]string `json:"validation_errors,omitempty"` - // An object that contains caller name information based on [CNAM](https://support.twilio.com/hc/en-us/articles/360051670533-Getting-Started-with-CNAM-Caller-ID). + // An object that contains caller name information based on [CNAM](https://support.twilio.com/hc/en-us/articles/360051670533-Getting-Started-with-CNAM-Caller-ID). CallerName *interface{} `json:"caller_name,omitempty"` - // An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number. + // An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number. SimSwap *interface{} `json:"sim_swap,omitempty"` - // An object that contains information on the unconditional call forwarding status of mobile phone number. + // An object that contains information on the unconditional call forwarding status of mobile phone number. CallForwarding *interface{} `json:"call_forwarding,omitempty"` - // An object that contains live activity information for a mobile phone number. + // An object that contains live activity information for a mobile phone number. LiveActivity *interface{} `json:"live_activity,omitempty"` - // An object that contains line type information including the carrier name, mobile country code, and mobile network code. + // An object that contains line type information including the carrier name, mobile country code, and mobile network code. LineTypeIntelligence *interface{} `json:"line_type_intelligence,omitempty"` - // An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources + // An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources IdentityMatch *interface{} `json:"identity_match,omitempty"` - // An object that contains reassigned number information. Reassigned Numbers will return a phone number's reassignment status given a phone number and date + // An object that contains reassigned number information. Reassigned Numbers will return a phone number's reassignment status given a phone number and date ReassignedNumber *interface{} `json:"reassigned_number,omitempty"` - // An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. + // An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. SmsPumpingRisk *interface{} `json:"sms_pumping_risk,omitempty"` - // An object that contains information of a mobile phone number quality score. Quality score will return a risk score about the phone number. - PhoneNumberQualityScore *interface{} `json:"phone_number_quality_score,omitempty"` - // The absolute URL of the resource. + // An object that contains information on if a mobile phone number could be a disposable or burner number. + DisposablePhoneNumberRisk *interface{} `json:"disposable_phone_number_risk,omitempty"` + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/lookups/v2/phone_numbers.go b/rest/lookups/v2/phone_numbers.go index 0d293086c..6594a4010 100644 --- a/rest/lookups/v2/phone_numbers.go +++ b/rest/lookups/v2/phone_numbers.go @@ -16,152 +16,156 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchPhoneNumber' type FetchPhoneNumberParams struct { - // A comma-separated list of fields to return. Possible values are caller_name, sim_swap, call_forwarding, live_activity, line_type_intelligence, identity_match, reassigned_number. - Fields *string `json:"Fields,omitempty"` - // The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. - CountryCode *string `json:"CountryCode,omitempty"` - // User’s first name. This query parameter is only used (optionally) for identity_match package requests. - FirstName *string `json:"FirstName,omitempty"` - // User’s last name. This query parameter is only used (optionally) for identity_match package requests. - LastName *string `json:"LastName,omitempty"` - // User’s first address line. This query parameter is only used (optionally) for identity_match package requests. - AddressLine1 *string `json:"AddressLine1,omitempty"` - // User’s second address line. This query parameter is only used (optionally) for identity_match package requests. - AddressLine2 *string `json:"AddressLine2,omitempty"` - // User’s city. This query parameter is only used (optionally) for identity_match package requests. - City *string `json:"City,omitempty"` - // User’s country subdivision, such as state, province, or locality. This query parameter is only used (optionally) for identity_match package requests. - State *string `json:"State,omitempty"` - // User’s postal zip code. This query parameter is only used (optionally) for identity_match package requests. - PostalCode *string `json:"PostalCode,omitempty"` - // User’s country, up to two characters. This query parameter is only used (optionally) for identity_match package requests. - AddressCountryCode *string `json:"AddressCountryCode,omitempty"` - // User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. - NationalId *string `json:"NationalId,omitempty"` - // User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. - DateOfBirth *string `json:"DateOfBirth,omitempty"` - // The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. - LastVerifiedDate *string `json:"LastVerifiedDate,omitempty"` + // A comma-separated list of fields to return. Possible values are caller_name, sim_swap, call_forwarding, live_activity, line_type_intelligence, identity_match, reassigned_number. + Fields *string `json:"Fields,omitempty"` + // The [country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) used if the phone number provided is in national format. + CountryCode *string `json:"CountryCode,omitempty"` + // User’s first name. This query parameter is only used (optionally) for identity_match package requests. + FirstName *string `json:"FirstName,omitempty"` + // User’s last name. This query parameter is only used (optionally) for identity_match package requests. + LastName *string `json:"LastName,omitempty"` + // User’s first address line. This query parameter is only used (optionally) for identity_match package requests. + AddressLine1 *string `json:"AddressLine1,omitempty"` + // User’s second address line. This query parameter is only used (optionally) for identity_match package requests. + AddressLine2 *string `json:"AddressLine2,omitempty"` + // User’s city. This query parameter is only used (optionally) for identity_match package requests. + City *string `json:"City,omitempty"` + // User’s country subdivision, such as state, province, or locality. This query parameter is only used (optionally) for identity_match package requests. + State *string `json:"State,omitempty"` + // User’s postal zip code. This query parameter is only used (optionally) for identity_match package requests. + PostalCode *string `json:"PostalCode,omitempty"` + // User’s country, up to two characters. This query parameter is only used (optionally) for identity_match package requests. + AddressCountryCode *string `json:"AddressCountryCode,omitempty"` + // User’s national ID, such as SSN or Passport ID. This query parameter is only used (optionally) for identity_match package requests. + NationalId *string `json:"NationalId,omitempty"` + // User’s date of birth, in YYYYMMDD format. This query parameter is only used (optionally) for identity_match package requests. + DateOfBirth *string `json:"DateOfBirth,omitempty"` + // The date you obtained consent to call or text the end-user of the phone number or a date on which you are reasonably certain that the end-user could still be reached at that number. This query parameter is only used (optionally) for reassigned_number package requests. + LastVerifiedDate *string `json:"LastVerifiedDate,omitempty"` } -func (params *FetchPhoneNumberParams) SetFields(Fields string) *FetchPhoneNumberParams { - params.Fields = &Fields - return params +func (params *FetchPhoneNumberParams) SetFields(Fields string) (*FetchPhoneNumberParams){ + params.Fields = &Fields + return params } -func (params *FetchPhoneNumberParams) SetCountryCode(CountryCode string) *FetchPhoneNumberParams { - params.CountryCode = &CountryCode - return params +func (params *FetchPhoneNumberParams) SetCountryCode(CountryCode string) (*FetchPhoneNumberParams){ + params.CountryCode = &CountryCode + return params } -func (params *FetchPhoneNumberParams) SetFirstName(FirstName string) *FetchPhoneNumberParams { - params.FirstName = &FirstName - return params +func (params *FetchPhoneNumberParams) SetFirstName(FirstName string) (*FetchPhoneNumberParams){ + params.FirstName = &FirstName + return params } -func (params *FetchPhoneNumberParams) SetLastName(LastName string) *FetchPhoneNumberParams { - params.LastName = &LastName - return params +func (params *FetchPhoneNumberParams) SetLastName(LastName string) (*FetchPhoneNumberParams){ + params.LastName = &LastName + return params } -func (params *FetchPhoneNumberParams) SetAddressLine1(AddressLine1 string) *FetchPhoneNumberParams { - params.AddressLine1 = &AddressLine1 - return params +func (params *FetchPhoneNumberParams) SetAddressLine1(AddressLine1 string) (*FetchPhoneNumberParams){ + params.AddressLine1 = &AddressLine1 + return params } -func (params *FetchPhoneNumberParams) SetAddressLine2(AddressLine2 string) *FetchPhoneNumberParams { - params.AddressLine2 = &AddressLine2 - return params +func (params *FetchPhoneNumberParams) SetAddressLine2(AddressLine2 string) (*FetchPhoneNumberParams){ + params.AddressLine2 = &AddressLine2 + return params } -func (params *FetchPhoneNumberParams) SetCity(City string) *FetchPhoneNumberParams { - params.City = &City - return params +func (params *FetchPhoneNumberParams) SetCity(City string) (*FetchPhoneNumberParams){ + params.City = &City + return params } -func (params *FetchPhoneNumberParams) SetState(State string) *FetchPhoneNumberParams { - params.State = &State - return params +func (params *FetchPhoneNumberParams) SetState(State string) (*FetchPhoneNumberParams){ + params.State = &State + return params } -func (params *FetchPhoneNumberParams) SetPostalCode(PostalCode string) *FetchPhoneNumberParams { - params.PostalCode = &PostalCode - return params +func (params *FetchPhoneNumberParams) SetPostalCode(PostalCode string) (*FetchPhoneNumberParams){ + params.PostalCode = &PostalCode + return params } -func (params *FetchPhoneNumberParams) SetAddressCountryCode(AddressCountryCode string) *FetchPhoneNumberParams { - params.AddressCountryCode = &AddressCountryCode - return params +func (params *FetchPhoneNumberParams) SetAddressCountryCode(AddressCountryCode string) (*FetchPhoneNumberParams){ + params.AddressCountryCode = &AddressCountryCode + return params } -func (params *FetchPhoneNumberParams) SetNationalId(NationalId string) *FetchPhoneNumberParams { - params.NationalId = &NationalId - return params +func (params *FetchPhoneNumberParams) SetNationalId(NationalId string) (*FetchPhoneNumberParams){ + params.NationalId = &NationalId + return params } -func (params *FetchPhoneNumberParams) SetDateOfBirth(DateOfBirth string) *FetchPhoneNumberParams { - params.DateOfBirth = &DateOfBirth - return params +func (params *FetchPhoneNumberParams) SetDateOfBirth(DateOfBirth string) (*FetchPhoneNumberParams){ + params.DateOfBirth = &DateOfBirth + return params } -func (params *FetchPhoneNumberParams) SetLastVerifiedDate(LastVerifiedDate string) *FetchPhoneNumberParams { - params.LastVerifiedDate = &LastVerifiedDate - return params +func (params *FetchPhoneNumberParams) SetLastVerifiedDate(LastVerifiedDate string) (*FetchPhoneNumberParams){ + params.LastVerifiedDate = &LastVerifiedDate + return params } -// +// func (c *ApiService) FetchPhoneNumber(PhoneNumber string, params *FetchPhoneNumberParams) (*LookupsV2PhoneNumber, error) { - path := "/v2/PhoneNumbers/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + path := "/v2/PhoneNumbers/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Fields != nil { + data.Set("Fields", *params.Fields) + } + if params != nil && params.CountryCode != nil { + data.Set("CountryCode", *params.CountryCode) + } + if params != nil && params.FirstName != nil { + data.Set("FirstName", *params.FirstName) + } + if params != nil && params.LastName != nil { + data.Set("LastName", *params.LastName) + } + if params != nil && params.AddressLine1 != nil { + data.Set("AddressLine1", *params.AddressLine1) + } + if params != nil && params.AddressLine2 != nil { + data.Set("AddressLine2", *params.AddressLine2) + } + if params != nil && params.City != nil { + data.Set("City", *params.City) + } + if params != nil && params.State != nil { + data.Set("State", *params.State) + } + if params != nil && params.PostalCode != nil { + data.Set("PostalCode", *params.PostalCode) + } + if params != nil && params.AddressCountryCode != nil { + data.Set("AddressCountryCode", *params.AddressCountryCode) + } + if params != nil && params.NationalId != nil { + data.Set("NationalId", *params.NationalId) + } + if params != nil && params.DateOfBirth != nil { + data.Set("DateOfBirth", *params.DateOfBirth) + } + if params != nil && params.LastVerifiedDate != nil { + data.Set("LastVerifiedDate", *params.LastVerifiedDate) + } - if params != nil && params.Fields != nil { - data.Set("Fields", *params.Fields) - } - if params != nil && params.CountryCode != nil { - data.Set("CountryCode", *params.CountryCode) - } - if params != nil && params.FirstName != nil { - data.Set("FirstName", *params.FirstName) - } - if params != nil && params.LastName != nil { - data.Set("LastName", *params.LastName) - } - if params != nil && params.AddressLine1 != nil { - data.Set("AddressLine1", *params.AddressLine1) - } - if params != nil && params.AddressLine2 != nil { - data.Set("AddressLine2", *params.AddressLine2) - } - if params != nil && params.City != nil { - data.Set("City", *params.City) - } - if params != nil && params.State != nil { - data.Set("State", *params.State) - } - if params != nil && params.PostalCode != nil { - data.Set("PostalCode", *params.PostalCode) - } - if params != nil && params.AddressCountryCode != nil { - data.Set("AddressCountryCode", *params.AddressCountryCode) - } - if params != nil && params.NationalId != nil { - data.Set("NationalId", *params.NationalId) - } - if params != nil && params.DateOfBirth != nil { - data.Set("DateOfBirth", *params.DateOfBirth) - } - if params != nil && params.LastVerifiedDate != nil { - data.Set("LastVerifiedDate", *params.LastVerifiedDate) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &LookupsV2PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &LookupsV2PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/media/v1/README.md b/rest/media/v1/README.md index 3c2050522..6c73a7819 100644 --- a/rest/media/v1/README.md +++ b/rest/media/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/media/v1/api_service.go b/rest/media/v1/api_service.go index 59274da84..bd3bcaa84 100644 --- a/rest/media/v1/api_service.go +++ b/rest/media/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://media.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/media/v1/docs/ListMediaProcessorResponseMeta.md b/rest/media/v1/docs/ListMediaProcessorResponseMeta.md index b978b181b..85fb22ec7 100644 --- a/rest/media/v1/docs/ListMediaProcessorResponseMeta.md +++ b/rest/media/v1/docs/ListMediaProcessorResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/media/v1/media_processors.go b/rest/media/v1/media_processors.go index 90fd7b7f2..7454491aa 100644 --- a/rest/media/v1/media_processors.go +++ b/rest/media/v1/media_processors.go @@ -18,188 +18,192 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMediaProcessor' type CreateMediaProcessorParams struct { - // The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` - Extension *string `json:"Extension,omitempty"` - // The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. - ExtensionContext *string `json:"ExtensionContext,omitempty"` - // User-defined environment variables for the Media Extension, represented as a JSON dictionary of key/value strings. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about whether you need to provide this. - ExtensionEnvironment *interface{} `json:"ExtensionEnvironment,omitempty"` - // The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. - MaxDuration *int `json:"MaxDuration,omitempty"` + // The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` + Extension *string `json:"Extension,omitempty"` + // The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. + ExtensionContext *string `json:"ExtensionContext,omitempty"` + // User-defined environment variables for the Media Extension, represented as a JSON dictionary of key/value strings. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about whether you need to provide this. + ExtensionEnvironment *interface{} `json:"ExtensionEnvironment,omitempty"` + // The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. + MaxDuration *int `json:"MaxDuration,omitempty"` } -func (params *CreateMediaProcessorParams) SetExtension(Extension string) *CreateMediaProcessorParams { - params.Extension = &Extension - return params +func (params *CreateMediaProcessorParams) SetExtension(Extension string) (*CreateMediaProcessorParams){ + params.Extension = &Extension + return params } -func (params *CreateMediaProcessorParams) SetExtensionContext(ExtensionContext string) *CreateMediaProcessorParams { - params.ExtensionContext = &ExtensionContext - return params +func (params *CreateMediaProcessorParams) SetExtensionContext(ExtensionContext string) (*CreateMediaProcessorParams){ + params.ExtensionContext = &ExtensionContext + return params } -func (params *CreateMediaProcessorParams) SetExtensionEnvironment(ExtensionEnvironment interface{}) *CreateMediaProcessorParams { - params.ExtensionEnvironment = &ExtensionEnvironment - return params +func (params *CreateMediaProcessorParams) SetExtensionEnvironment(ExtensionEnvironment interface{}) (*CreateMediaProcessorParams){ + params.ExtensionEnvironment = &ExtensionEnvironment + return params } -func (params *CreateMediaProcessorParams) SetStatusCallback(StatusCallback string) *CreateMediaProcessorParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateMediaProcessorParams) SetStatusCallback(StatusCallback string) (*CreateMediaProcessorParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreateMediaProcessorParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateMediaProcessorParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *CreateMediaProcessorParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateMediaProcessorParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *CreateMediaProcessorParams) SetMaxDuration(MaxDuration int) *CreateMediaProcessorParams { - params.MaxDuration = &MaxDuration - return params +func (params *CreateMediaProcessorParams) SetMaxDuration(MaxDuration int) (*CreateMediaProcessorParams){ + params.MaxDuration = &MaxDuration + return params } -// +// func (c *ApiService) CreateMediaProcessor(params *CreateMediaProcessorParams) (*MediaV1MediaProcessor, error) { - path := "/v1/MediaProcessors" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Extension != nil { - data.Set("Extension", *params.Extension) - } - if params != nil && params.ExtensionContext != nil { - data.Set("ExtensionContext", *params.ExtensionContext) - } - if params != nil && params.ExtensionEnvironment != nil { - v, err := json.Marshal(params.ExtensionEnvironment) - - if err != nil { - return nil, err - } - - data.Set("ExtensionEnvironment", string(v)) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.MaxDuration != nil { - data.Set("MaxDuration", fmt.Sprint(*params.MaxDuration)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MediaV1MediaProcessor{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/MediaProcessors" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Extension != nil { + data.Set("Extension", *params.Extension) + } + if params != nil && params.ExtensionContext != nil { + data.Set("ExtensionContext", *params.ExtensionContext) + } + if params != nil && params.ExtensionEnvironment != nil { + v, err := json.Marshal(params.ExtensionEnvironment) + + if err != nil { + return nil, err + } + + data.Set("ExtensionEnvironment", string(v)) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.MaxDuration != nil { + data.Set("MaxDuration", fmt.Sprint(*params.MaxDuration)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MediaV1MediaProcessor{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Returns a single MediaProcessor resource identified by a SID. -func (c *ApiService) FetchMediaProcessor(Sid string) (*MediaV1MediaProcessor, error) { - path := "/v1/MediaProcessors/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchMediaProcessor(Sid string, ) (*MediaV1MediaProcessor, error) { + path := "/v1/MediaProcessors/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MediaV1MediaProcessor{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &MediaV1MediaProcessor{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMediaProcessor' type ListMediaProcessorParams struct { - // The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - Order *string `json:"Order,omitempty"` - // Status to filter by, with possible values `started`, `ended` or `failed`. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. + Order *string `json:"Order,omitempty"` + // Status to filter by, with possible values `started`, `ended` or `failed`. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMediaProcessorParams) SetOrder(Order string) *ListMediaProcessorParams { - params.Order = &Order - return params +func (params *ListMediaProcessorParams) SetOrder(Order string) (*ListMediaProcessorParams){ + params.Order = &Order + return params } -func (params *ListMediaProcessorParams) SetStatus(Status string) *ListMediaProcessorParams { - params.Status = &Status - return params +func (params *ListMediaProcessorParams) SetStatus(Status string) (*ListMediaProcessorParams){ + params.Status = &Status + return params } -func (params *ListMediaProcessorParams) SetPageSize(PageSize int) *ListMediaProcessorParams { - params.PageSize = &PageSize - return params +func (params *ListMediaProcessorParams) SetPageSize(PageSize int) (*ListMediaProcessorParams){ + params.PageSize = &PageSize + return params } -func (params *ListMediaProcessorParams) SetLimit(Limit int) *ListMediaProcessorParams { - params.Limit = &Limit - return params +func (params *ListMediaProcessorParams) SetLimit(Limit int) (*ListMediaProcessorParams){ + params.Limit = &Limit + return params } // Retrieve a single page of MediaProcessor records from the API. Request is executed immediately. func (c *ApiService) PageMediaProcessor(params *ListMediaProcessorParams, pageToken, pageNumber string) (*ListMediaProcessorResponse, error) { - path := "/v1/MediaProcessors" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMediaProcessorResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/MediaProcessors" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMediaProcessorResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists MediaProcessor records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -240,6 +244,7 @@ func (c *ApiService) StreamMediaProcessor(params *ListMediaProcessorParams) (cha return recordChannel, errorChannel } + func (c *ApiService) streamMediaProcessor(response *ListMediaProcessorResponse, params *ListMediaProcessorParams, recordChannel chan MediaV1MediaProcessor, errorChannel chan error) { curRecord := 1 @@ -271,57 +276,59 @@ func (c *ApiService) streamMediaProcessor(response *ListMediaProcessorResponse, } func (c *ApiService) getNextListMediaProcessorResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMediaProcessorResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMediaProcessorResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMediaProcessor' type UpdateMediaProcessorParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateMediaProcessorParams) SetStatus(Status string) *UpdateMediaProcessorParams { - params.Status = &Status - return params +func (params *UpdateMediaProcessorParams) SetStatus(Status string) (*UpdateMediaProcessorParams){ + params.Status = &Status + return params } // Updates a MediaProcessor resource identified by a SID. func (c *ApiService) UpdateMediaProcessor(Sid string, params *UpdateMediaProcessorParams) (*MediaV1MediaProcessor, error) { - path := "/v1/MediaProcessors/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/MediaProcessors/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MediaV1MediaProcessor{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MediaV1MediaProcessor{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/media/v1/media_recordings.go b/rest/media/v1/media_recordings.go index 631f8a8c2..902cb2971 100644 --- a/rest/media/v1/media_recordings.go +++ b/rest/media/v1/media_recordings.go @@ -18,136 +18,141 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Deletes a MediaRecording resource identified by a SID. -func (c *ApiService) DeleteMediaRecording(Sid string) error { - path := "/v1/MediaRecordings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteMediaRecording(Sid string, ) (error) { + path := "/v1/MediaRecordings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Returns a single MediaRecording resource identified by a SID. -func (c *ApiService) FetchMediaRecording(Sid string) (*MediaV1MediaRecording, error) { - path := "/v1/MediaRecordings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchMediaRecording(Sid string, ) (*MediaV1MediaRecording, error) { + path := "/v1/MediaRecordings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MediaV1MediaRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &MediaV1MediaRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMediaRecording' type ListMediaRecordingParams struct { - // The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - Order *string `json:"Order,omitempty"` - // Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. - Status *string `json:"Status,omitempty"` - // SID of a MediaProcessor to filter by. - ProcessorSid *string `json:"ProcessorSid,omitempty"` - // SID of a MediaRecording source to filter by. - SourceSid *string `json:"SourceSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. + Order *string `json:"Order,omitempty"` + // Status to filter by, with possible values `processing`, `completed`, `deleted`, or `failed`. + Status *string `json:"Status,omitempty"` + // SID of a MediaProcessor to filter by. + ProcessorSid *string `json:"ProcessorSid,omitempty"` + // SID of a MediaRecording source to filter by. + SourceSid *string `json:"SourceSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMediaRecordingParams) SetOrder(Order string) *ListMediaRecordingParams { - params.Order = &Order - return params +func (params *ListMediaRecordingParams) SetOrder(Order string) (*ListMediaRecordingParams){ + params.Order = &Order + return params } -func (params *ListMediaRecordingParams) SetStatus(Status string) *ListMediaRecordingParams { - params.Status = &Status - return params +func (params *ListMediaRecordingParams) SetStatus(Status string) (*ListMediaRecordingParams){ + params.Status = &Status + return params } -func (params *ListMediaRecordingParams) SetProcessorSid(ProcessorSid string) *ListMediaRecordingParams { - params.ProcessorSid = &ProcessorSid - return params +func (params *ListMediaRecordingParams) SetProcessorSid(ProcessorSid string) (*ListMediaRecordingParams){ + params.ProcessorSid = &ProcessorSid + return params } -func (params *ListMediaRecordingParams) SetSourceSid(SourceSid string) *ListMediaRecordingParams { - params.SourceSid = &SourceSid - return params +func (params *ListMediaRecordingParams) SetSourceSid(SourceSid string) (*ListMediaRecordingParams){ + params.SourceSid = &SourceSid + return params } -func (params *ListMediaRecordingParams) SetPageSize(PageSize int) *ListMediaRecordingParams { - params.PageSize = &PageSize - return params +func (params *ListMediaRecordingParams) SetPageSize(PageSize int) (*ListMediaRecordingParams){ + params.PageSize = &PageSize + return params } -func (params *ListMediaRecordingParams) SetLimit(Limit int) *ListMediaRecordingParams { - params.Limit = &Limit - return params +func (params *ListMediaRecordingParams) SetLimit(Limit int) (*ListMediaRecordingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of MediaRecording records from the API. Request is executed immediately. func (c *ApiService) PageMediaRecording(params *ListMediaRecordingParams, pageToken, pageNumber string) (*ListMediaRecordingResponse, error) { - path := "/v1/MediaRecordings" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.ProcessorSid != nil { - data.Set("ProcessorSid", *params.ProcessorSid) - } - if params != nil && params.SourceSid != nil { - data.Set("SourceSid", *params.SourceSid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMediaRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/MediaRecordings" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.ProcessorSid != nil { + data.Set("ProcessorSid", *params.ProcessorSid) + } + if params != nil && params.SourceSid != nil { + data.Set("SourceSid", *params.SourceSid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMediaRecordingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists MediaRecording records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -188,6 +193,7 @@ func (c *ApiService) StreamMediaRecording(params *ListMediaRecordingParams) (cha return recordChannel, errorChannel } + func (c *ApiService) streamMediaRecording(response *ListMediaRecordingResponse, params *ListMediaRecordingParams, recordChannel chan MediaV1MediaRecording, errorChannel chan error) { curRecord := 1 @@ -219,19 +225,20 @@ func (c *ApiService) streamMediaRecording(response *ListMediaRecordingResponse, } func (c *ApiService) getNextListMediaRecordingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMediaRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMediaRecordingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/media/v1/model_list_media_processor_response.go b/rest/media/v1/model_list_media_processor_response.go index bee5083ae..de378be0e 100644 --- a/rest/media/v1/model_list_media_processor_response.go +++ b/rest/media/v1/model_list_media_processor_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMediaProcessorResponse struct for ListMediaProcessorResponse type ListMediaProcessorResponse struct { - MediaProcessors []MediaV1MediaProcessor `json:"media_processors,omitempty"` - Meta ListMediaProcessorResponseMeta `json:"meta,omitempty"` + MediaProcessors []MediaV1MediaProcessor `json:"media_processors,omitempty"` + Meta ListMediaProcessorResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/media/v1/model_list_media_processor_response_meta.go b/rest/media/v1/model_list_media_processor_response_meta.go index 46a4b9cbf..f477a8109 100644 --- a/rest/media/v1/model_list_media_processor_response_meta.go +++ b/rest/media/v1/model_list_media_processor_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMediaProcessorResponseMeta struct for ListMediaProcessorResponseMeta type ListMediaProcessorResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/media/v1/model_list_media_recording_response.go b/rest/media/v1/model_list_media_recording_response.go index 4d2bcee7b..1acea788a 100644 --- a/rest/media/v1/model_list_media_recording_response.go +++ b/rest/media/v1/model_list_media_recording_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMediaRecordingResponse struct for ListMediaRecordingResponse type ListMediaRecordingResponse struct { - MediaRecordings []MediaV1MediaRecording `json:"media_recordings,omitempty"` - Meta ListMediaProcessorResponseMeta `json:"meta,omitempty"` + MediaRecordings []MediaV1MediaRecording `json:"media_recordings,omitempty"` + Meta ListMediaProcessorResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/media/v1/model_list_player_streamer_response.go b/rest/media/v1/model_list_player_streamer_response.go index 6fe094163..5476c34ba 100644 --- a/rest/media/v1/model_list_player_streamer_response.go +++ b/rest/media/v1/model_list_player_streamer_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListPlayerStreamerResponse struct for ListPlayerStreamerResponse type ListPlayerStreamerResponse struct { - PlayerStreamers []MediaV1PlayerStreamer `json:"player_streamers,omitempty"` - Meta ListMediaProcessorResponseMeta `json:"meta,omitempty"` + PlayerStreamers []MediaV1PlayerStreamer `json:"player_streamers,omitempty"` + Meta ListMediaProcessorResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/media/v1/model_media_v1_media_processor.go b/rest/media/v1/model_media_v1_media_processor.go index df058aca7..df95f9679 100644 --- a/rest/media/v1/model_media_v1_media_processor.go +++ b/rest/media/v1/model_media_v1_media_processor.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MediaV1MediaProcessor struct for MediaV1MediaProcessor type MediaV1MediaProcessor struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaProcessor resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaProcessor resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string generated to identify the MediaProcessor resource. + // The unique string generated to identify the MediaProcessor resource. Sid *string `json:"sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` + // The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: `video-composer-v2` Extension *string `json:"extension,omitempty"` - // The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. + // The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send. ExtensionContext *string `json:"extension_context,omitempty"` - Status *string `json:"status,omitempty"` - // The absolute URL of the resource. + Status *string `json:"status,omitempty"` + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be `null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details. + // The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be `null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details. EndedReason *string `json:"ended_reason,omitempty"` - // The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. + // The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. + // The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. MaxDuration *int `json:"max_duration,omitempty"` } + + diff --git a/rest/media/v1/model_media_v1_media_recording.go b/rest/media/v1/model_media_v1_media_recording.go index 163c4d5ef..77692dce7 100644 --- a/rest/media/v1/model_media_v1_media_recording.go +++ b/rest/media/v1/model_media_v1_media_recording.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MediaV1MediaRecording struct for MediaV1MediaRecording type MediaV1MediaRecording struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaRecording resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaRecording resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The duration of the MediaRecording in seconds. - Duration *int `json:"duration,omitempty"` - Format *string `json:"format,omitempty"` - // The URLs of related resources. + // The duration of the MediaRecording in seconds. + Duration *int `json:"duration,omitempty"` + Format *string `json:"format,omitempty"` + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // The SID of the MediaProcessor resource which produced the MediaRecording. + // The SID of the MediaProcessor resource which produced the MediaRecording. ProcessorSid *string `json:"processor_sid,omitempty"` - // The dimensions of the video image in pixels expressed as columns (width) and rows (height). + // The dimensions of the video image in pixels expressed as columns (width) and rows (height). Resolution *string `json:"resolution,omitempty"` - // The SID of the resource that generated the original media track(s) of the MediaRecording. + // The SID of the resource that generated the original media track(s) of the MediaRecording. SourceSid *string `json:"source_sid,omitempty"` - // The unique string generated to identify the MediaRecording resource. + // The unique string generated to identify the MediaRecording resource. Sid *string `json:"sid,omitempty"` - // The size of the recording media in bytes. - MediaSize *int64 `json:"media_size,omitempty"` - Status *string `json:"status,omitempty"` - // The URL to which Twilio will send asynchronous webhook requests for every MediaRecording event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. + // The size of the recording media in bytes. + MediaSize *int64 `json:"media_size,omitempty"` + Status *string `json:"status,omitempty"` + // The URL to which Twilio will send asynchronous webhook requests for every MediaRecording event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/media/v1/model_media_v1_player_streamer.go b/rest/media/v1/model_media_v1_player_streamer.go index 3c40ca5d2..13121ae81 100644 --- a/rest/media/v1/model_media_v1_player_streamer.go +++ b/rest/media/v1/model_media_v1_player_streamer.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MediaV1PlayerStreamer struct for MediaV1PlayerStreamer type MediaV1PlayerStreamer struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PlayerStreamer resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PlayerStreamer resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. + // Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. Video *bool `json:"video,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // The unique string generated to identify the PlayerStreamer resource. - Sid *string `json:"sid,omitempty"` + // The unique string generated to identify the PlayerStreamer resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. + // The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - EndedReason *string `json:"ended_reason,omitempty"` - // The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. + EndedReason *string `json:"ended_reason,omitempty"` + // The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. MaxDuration *int `json:"max_duration,omitempty"` } + + diff --git a/rest/media/v1/model_media_v1_player_streamer_playback_grant.go b/rest/media/v1/model_media_v1_player_streamer_playback_grant.go index d195887b9..f8ae5d20a 100644 --- a/rest/media/v1/model_media_v1_player_streamer_playback_grant.go +++ b/rest/media/v1/model_media_v1_player_streamer_playback_grant.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MediaV1PlayerStreamerPlaybackGrant struct for MediaV1PlayerStreamerPlaybackGrant type MediaV1PlayerStreamerPlaybackGrant struct { - // The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for. + // The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for. Sid *string `json:"sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The grant that authorizes the player sdk to connect to the livestream + // The grant that authorizes the player sdk to connect to the livestream Grant *interface{} `json:"grant,omitempty"` } + + diff --git a/rest/media/v1/player_streamers.go b/rest/media/v1/player_streamers.go index 88938ee7b..4e3529499 100644 --- a/rest/media/v1/player_streamers.go +++ b/rest/media/v1/player_streamers.go @@ -18,164 +18,168 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePlayerStreamer' type CreatePlayerStreamerParams struct { - // Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. - Video *bool `json:"Video,omitempty"` - // The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. - MaxDuration *int `json:"MaxDuration,omitempty"` + // Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. + Video *bool `json:"Video,omitempty"` + // The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/api/status-callbacks) for more details. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. + MaxDuration *int `json:"MaxDuration,omitempty"` } -func (params *CreatePlayerStreamerParams) SetVideo(Video bool) *CreatePlayerStreamerParams { - params.Video = &Video - return params +func (params *CreatePlayerStreamerParams) SetVideo(Video bool) (*CreatePlayerStreamerParams){ + params.Video = &Video + return params } -func (params *CreatePlayerStreamerParams) SetStatusCallback(StatusCallback string) *CreatePlayerStreamerParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreatePlayerStreamerParams) SetStatusCallback(StatusCallback string) (*CreatePlayerStreamerParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreatePlayerStreamerParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreatePlayerStreamerParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *CreatePlayerStreamerParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreatePlayerStreamerParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *CreatePlayerStreamerParams) SetMaxDuration(MaxDuration int) *CreatePlayerStreamerParams { - params.MaxDuration = &MaxDuration - return params +func (params *CreatePlayerStreamerParams) SetMaxDuration(MaxDuration int) (*CreatePlayerStreamerParams){ + params.MaxDuration = &MaxDuration + return params } -// +// func (c *ApiService) CreatePlayerStreamer(params *CreatePlayerStreamerParams) (*MediaV1PlayerStreamer, error) { - path := "/v1/PlayerStreamers" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Video != nil { - data.Set("Video", fmt.Sprint(*params.Video)) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.MaxDuration != nil { - data.Set("MaxDuration", fmt.Sprint(*params.MaxDuration)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MediaV1PlayerStreamer{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/PlayerStreamers" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Video != nil { + data.Set("Video", fmt.Sprint(*params.Video)) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.MaxDuration != nil { + data.Set("MaxDuration", fmt.Sprint(*params.MaxDuration)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MediaV1PlayerStreamer{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Returns a single PlayerStreamer resource identified by a SID. -func (c *ApiService) FetchPlayerStreamer(Sid string) (*MediaV1PlayerStreamer, error) { - path := "/v1/PlayerStreamers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchPlayerStreamer(Sid string, ) (*MediaV1PlayerStreamer, error) { + path := "/v1/PlayerStreamers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MediaV1PlayerStreamer{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &MediaV1PlayerStreamer{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListPlayerStreamer' type ListPlayerStreamerParams struct { - // The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. - Order *string `json:"Order,omitempty"` - // Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. + Order *string `json:"Order,omitempty"` + // Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListPlayerStreamerParams) SetOrder(Order string) *ListPlayerStreamerParams { - params.Order = &Order - return params +func (params *ListPlayerStreamerParams) SetOrder(Order string) (*ListPlayerStreamerParams){ + params.Order = &Order + return params } -func (params *ListPlayerStreamerParams) SetStatus(Status string) *ListPlayerStreamerParams { - params.Status = &Status - return params +func (params *ListPlayerStreamerParams) SetStatus(Status string) (*ListPlayerStreamerParams){ + params.Status = &Status + return params } -func (params *ListPlayerStreamerParams) SetPageSize(PageSize int) *ListPlayerStreamerParams { - params.PageSize = &PageSize - return params +func (params *ListPlayerStreamerParams) SetPageSize(PageSize int) (*ListPlayerStreamerParams){ + params.PageSize = &PageSize + return params } -func (params *ListPlayerStreamerParams) SetLimit(Limit int) *ListPlayerStreamerParams { - params.Limit = &Limit - return params +func (params *ListPlayerStreamerParams) SetLimit(Limit int) (*ListPlayerStreamerParams){ + params.Limit = &Limit + return params } // Retrieve a single page of PlayerStreamer records from the API. Request is executed immediately. func (c *ApiService) PagePlayerStreamer(params *ListPlayerStreamerParams, pageToken, pageNumber string) (*ListPlayerStreamerResponse, error) { - path := "/v1/PlayerStreamers" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPlayerStreamerResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/PlayerStreamers" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPlayerStreamerResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists PlayerStreamer records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -216,6 +220,7 @@ func (c *ApiService) StreamPlayerStreamer(params *ListPlayerStreamerParams) (cha return recordChannel, errorChannel } + func (c *ApiService) streamPlayerStreamer(response *ListPlayerStreamerResponse, params *ListPlayerStreamerParams, recordChannel chan MediaV1PlayerStreamer, errorChannel chan error) { curRecord := 1 @@ -247,57 +252,59 @@ func (c *ApiService) streamPlayerStreamer(response *ListPlayerStreamerResponse, } func (c *ApiService) getNextListPlayerStreamerResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPlayerStreamerResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPlayerStreamerResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdatePlayerStreamer' type UpdatePlayerStreamerParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdatePlayerStreamerParams) SetStatus(Status string) *UpdatePlayerStreamerParams { - params.Status = &Status - return params +func (params *UpdatePlayerStreamerParams) SetStatus(Status string) (*UpdatePlayerStreamerParams){ + params.Status = &Status + return params } // Updates a PlayerStreamer resource identified by a SID. func (c *ApiService) UpdatePlayerStreamer(Sid string, params *UpdatePlayerStreamerParams) (*MediaV1PlayerStreamer, error) { - path := "/v1/PlayerStreamers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/PlayerStreamers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MediaV1PlayerStreamer{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MediaV1PlayerStreamer{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/media/v1/player_streamers_playback_grant.go b/rest/media/v1/player_streamers_playback_grant.go index 9ad55e06a..10a55a746 100644 --- a/rest/media/v1/player_streamers_playback_grant.go +++ b/rest/media/v1/player_streamers_playback_grant.go @@ -18,75 +18,80 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePlayerStreamerPlaybackGrant' type CreatePlayerStreamerPlaybackGrantParams struct { - // The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. - Ttl *int `json:"Ttl,omitempty"` - // The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. - AccessControlAllowOrigin *string `json:"AccessControlAllowOrigin,omitempty"` + // The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. + Ttl *int `json:"Ttl,omitempty"` + // The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. + AccessControlAllowOrigin *string `json:"AccessControlAllowOrigin,omitempty"` } -func (params *CreatePlayerStreamerPlaybackGrantParams) SetTtl(Ttl int) *CreatePlayerStreamerPlaybackGrantParams { - params.Ttl = &Ttl - return params +func (params *CreatePlayerStreamerPlaybackGrantParams) SetTtl(Ttl int) (*CreatePlayerStreamerPlaybackGrantParams){ + params.Ttl = &Ttl + return params } -func (params *CreatePlayerStreamerPlaybackGrantParams) SetAccessControlAllowOrigin(AccessControlAllowOrigin string) *CreatePlayerStreamerPlaybackGrantParams { - params.AccessControlAllowOrigin = &AccessControlAllowOrigin - return params +func (params *CreatePlayerStreamerPlaybackGrantParams) SetAccessControlAllowOrigin(AccessControlAllowOrigin string) (*CreatePlayerStreamerPlaybackGrantParams){ + params.AccessControlAllowOrigin = &AccessControlAllowOrigin + return params } -// +// func (c *ApiService) CreatePlayerStreamerPlaybackGrant(Sid string, params *CreatePlayerStreamerPlaybackGrantParams) (*MediaV1PlayerStreamerPlaybackGrant, error) { - path := "/v1/PlayerStreamers/{Sid}/PlaybackGrant" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/PlayerStreamers/{Sid}/PlaybackGrant" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.AccessControlAllowOrigin != nil { + data.Set("AccessControlAllowOrigin", *params.AccessControlAllowOrigin) + } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.AccessControlAllowOrigin != nil { - data.Set("AccessControlAllowOrigin", *params.AccessControlAllowOrigin) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MediaV1PlayerStreamerPlaybackGrant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MediaV1PlayerStreamerPlaybackGrant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // **This method is not enabled.** Returns a single PlaybackGrant resource identified by a SID. -func (c *ApiService) FetchPlayerStreamerPlaybackGrant(Sid string) (*MediaV1PlayerStreamerPlaybackGrant, error) { - path := "/v1/PlayerStreamers/{Sid}/PlaybackGrant" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchPlayerStreamerPlaybackGrant(Sid string, ) (*MediaV1PlayerStreamerPlaybackGrant, error) { + path := "/v1/PlayerStreamers/{Sid}/PlaybackGrant" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MediaV1PlayerStreamerPlaybackGrant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MediaV1PlayerStreamerPlaybackGrant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/README.md b/rest/messaging/v1/README.md index db110a5a4..df913b1b0 100644 --- a/rest/messaging/v1/README.md +++ b/rest/messaging/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -76,7 +76,6 @@ Class | Method | HTTP request | Description *ServicesShortCodesApi* | [**ListShortCode**](docs/ServicesShortCodesApi.md#listshortcode) | **Get** /v1/Services/{ServiceSid}/ShortCodes | *ServicesUsecasesApi* | [**FetchUsecase**](docs/ServicesUsecasesApi.md#fetchusecase) | **Get** /v1/Services/Usecases | *TollfreeVerificationsApi* | [**CreateTollfreeVerification**](docs/TollfreeVerificationsApi.md#createtollfreeverification) | **Post** /v1/Tollfree/Verifications | -*TollfreeVerificationsApi* | [**DeleteTollfreeVerification**](docs/TollfreeVerificationsApi.md#deletetollfreeverification) | **Delete** /v1/Tollfree/Verifications/{Sid} | *TollfreeVerificationsApi* | [**FetchTollfreeVerification**](docs/TollfreeVerificationsApi.md#fetchtollfreeverification) | **Get** /v1/Tollfree/Verifications/{Sid} | *TollfreeVerificationsApi* | [**ListTollfreeVerification**](docs/TollfreeVerificationsApi.md#listtollfreeverification) | **Get** /v1/Tollfree/Verifications | *TollfreeVerificationsApi* | [**UpdateTollfreeVerification**](docs/TollfreeVerificationsApi.md#updatetollfreeverification) | **Post** /v1/Tollfree/Verifications/{Sid} | diff --git a/rest/messaging/v1/a2p_brand_registrations.go b/rest/messaging/v1/a2p_brand_registrations.go index a6ce88b3f..db5cdb661 100644 --- a/rest/messaging/v1/a2p_brand_registrations.go +++ b/rest/messaging/v1/a2p_brand_registrations.go @@ -18,155 +18,159 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBrandRegistrations' type CreateBrandRegistrationsParams struct { - // Customer Profile Bundle Sid. - CustomerProfileBundleSid *string `json:"CustomerProfileBundleSid,omitempty"` - // A2P Messaging Profile Bundle Sid. - A2PProfileBundleSid *string `json:"A2PProfileBundleSid,omitempty"` - // Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases. - BrandType *string `json:"BrandType,omitempty"` - // A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. - Mock *bool `json:"Mock,omitempty"` - // A flag to disable automatic secondary vetting for brands which it would otherwise be done. - SkipAutomaticSecVet *bool `json:"SkipAutomaticSecVet,omitempty"` + // Customer Profile Bundle Sid. + CustomerProfileBundleSid *string `json:"CustomerProfileBundleSid,omitempty"` + // A2P Messaging Profile Bundle Sid. + A2PProfileBundleSid *string `json:"A2PProfileBundleSid,omitempty"` + // Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases. + BrandType *string `json:"BrandType,omitempty"` + // A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. + Mock *bool `json:"Mock,omitempty"` + // A flag to disable automatic secondary vetting for brands which it would otherwise be done. + SkipAutomaticSecVet *bool `json:"SkipAutomaticSecVet,omitempty"` } -func (params *CreateBrandRegistrationsParams) SetCustomerProfileBundleSid(CustomerProfileBundleSid string) *CreateBrandRegistrationsParams { - params.CustomerProfileBundleSid = &CustomerProfileBundleSid - return params +func (params *CreateBrandRegistrationsParams) SetCustomerProfileBundleSid(CustomerProfileBundleSid string) (*CreateBrandRegistrationsParams){ + params.CustomerProfileBundleSid = &CustomerProfileBundleSid + return params } -func (params *CreateBrandRegistrationsParams) SetA2PProfileBundleSid(A2PProfileBundleSid string) *CreateBrandRegistrationsParams { - params.A2PProfileBundleSid = &A2PProfileBundleSid - return params +func (params *CreateBrandRegistrationsParams) SetA2PProfileBundleSid(A2PProfileBundleSid string) (*CreateBrandRegistrationsParams){ + params.A2PProfileBundleSid = &A2PProfileBundleSid + return params } -func (params *CreateBrandRegistrationsParams) SetBrandType(BrandType string) *CreateBrandRegistrationsParams { - params.BrandType = &BrandType - return params +func (params *CreateBrandRegistrationsParams) SetBrandType(BrandType string) (*CreateBrandRegistrationsParams){ + params.BrandType = &BrandType + return params } -func (params *CreateBrandRegistrationsParams) SetMock(Mock bool) *CreateBrandRegistrationsParams { - params.Mock = &Mock - return params +func (params *CreateBrandRegistrationsParams) SetMock(Mock bool) (*CreateBrandRegistrationsParams){ + params.Mock = &Mock + return params } -func (params *CreateBrandRegistrationsParams) SetSkipAutomaticSecVet(SkipAutomaticSecVet bool) *CreateBrandRegistrationsParams { - params.SkipAutomaticSecVet = &SkipAutomaticSecVet - return params +func (params *CreateBrandRegistrationsParams) SetSkipAutomaticSecVet(SkipAutomaticSecVet bool) (*CreateBrandRegistrationsParams){ + params.SkipAutomaticSecVet = &SkipAutomaticSecVet + return params } -// +// func (c *ApiService) CreateBrandRegistrations(params *CreateBrandRegistrationsParams) (*MessagingV1BrandRegistrations, error) { - path := "/v1/a2p/BrandRegistrations" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CustomerProfileBundleSid != nil { - data.Set("CustomerProfileBundleSid", *params.CustomerProfileBundleSid) - } - if params != nil && params.A2PProfileBundleSid != nil { - data.Set("A2PProfileBundleSid", *params.A2PProfileBundleSid) - } - if params != nil && params.BrandType != nil { - data.Set("BrandType", *params.BrandType) - } - if params != nil && params.Mock != nil { - data.Set("Mock", fmt.Sprint(*params.Mock)) - } - if params != nil && params.SkipAutomaticSecVet != nil { - data.Set("SkipAutomaticSecVet", fmt.Sprint(*params.SkipAutomaticSecVet)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + path := "/v1/a2p/BrandRegistrations" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CustomerProfileBundleSid != nil { + data.Set("CustomerProfileBundleSid", *params.CustomerProfileBundleSid) + } + if params != nil && params.A2PProfileBundleSid != nil { + data.Set("A2PProfileBundleSid", *params.A2PProfileBundleSid) + } + if params != nil && params.BrandType != nil { + data.Set("BrandType", *params.BrandType) + } + if params != nil && params.Mock != nil { + data.Set("Mock", fmt.Sprint(*params.Mock)) + } + if params != nil && params.SkipAutomaticSecVet != nil { + data.Set("SkipAutomaticSecVet", fmt.Sprint(*params.SkipAutomaticSecVet)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1BrandRegistrations{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - defer resp.Body.Close() +// +func (c *ApiService) FetchBrandRegistrations(Sid string, ) (*MessagingV1BrandRegistrations, error) { + path := "/v1/a2p/BrandRegistrations/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - ps := &MessagingV1BrandRegistrations{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - return ps, err -} -// -func (c *ApiService) FetchBrandRegistrations(Sid string) (*MessagingV1BrandRegistrations, error) { - path := "/v1/a2p/BrandRegistrations/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &MessagingV1BrandRegistrations{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &MessagingV1BrandRegistrations{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListBrandRegistrations' type ListBrandRegistrationsParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBrandRegistrationsParams) SetPageSize(PageSize int) *ListBrandRegistrationsParams { - params.PageSize = &PageSize - return params +func (params *ListBrandRegistrationsParams) SetPageSize(PageSize int) (*ListBrandRegistrationsParams){ + params.PageSize = &PageSize + return params } -func (params *ListBrandRegistrationsParams) SetLimit(Limit int) *ListBrandRegistrationsParams { - params.Limit = &Limit - return params +func (params *ListBrandRegistrationsParams) SetLimit(Limit int) (*ListBrandRegistrationsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of BrandRegistrations records from the API. Request is executed immediately. func (c *ApiService) PageBrandRegistrations(params *ListBrandRegistrationsParams, pageToken, pageNumber string) (*ListBrandRegistrationsResponse, error) { - path := "/v1/a2p/BrandRegistrations" + path := "/v1/a2p/BrandRegistrations" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBrandRegistrationsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListBrandRegistrationsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists BrandRegistrations records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +211,7 @@ func (c *ApiService) StreamBrandRegistrations(params *ListBrandRegistrationsPara return recordChannel, errorChannel } + func (c *ApiService) streamBrandRegistrations(response *ListBrandRegistrationsResponse, params *ListBrandRegistrationsParams, recordChannel chan MessagingV1BrandRegistrations, errorChannel chan error) { curRecord := 1 @@ -238,42 +243,45 @@ func (c *ApiService) streamBrandRegistrations(response *ListBrandRegistrationsRe } func (c *ApiService) getNextListBrandRegistrationsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBrandRegistrationsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil +} - defer resp.Body.Close() - ps := &ListBrandRegistrationsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil -} +// +func (c *ApiService) UpdateBrandRegistrations(Sid string, ) (*MessagingV1BrandRegistrations, error) { + path := "/v1/a2p/BrandRegistrations/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) -// -func (c *ApiService) UpdateBrandRegistrations(Sid string) (*MessagingV1BrandRegistrations, error) { - path := "/v1/a2p/BrandRegistrations/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MessagingV1BrandRegistrations{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MessagingV1BrandRegistrations{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/a2p_brand_registrations_sms_otp.go b/rest/messaging/v1/a2p_brand_registrations_sms_otp.go index 17fcb9614..944da31ca 100644 --- a/rest/messaging/v1/a2p_brand_registrations_sms_otp.go +++ b/rest/messaging/v1/a2p_brand_registrations_sms_otp.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) CreateBrandRegistrationOtp(BrandRegistrationSid string) (*MessagingV1BrandRegistrationOtp, error) { - path := "/v1/a2p/BrandRegistrations/{BrandRegistrationSid}/SmsOtp" - path = strings.Replace(path, "{"+"BrandRegistrationSid"+"}", BrandRegistrationSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) CreateBrandRegistrationOtp(BrandRegistrationSid string, ) (*MessagingV1BrandRegistrationOtp, error) { + path := "/v1/a2p/BrandRegistrations/{BrandRegistrationSid}/SmsOtp" + path = strings.Replace(path, "{"+"BrandRegistrationSid"+"}", BrandRegistrationSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1BrandRegistrationOtp{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1BrandRegistrationOtp{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/a2p_brand_registrations_vettings.go b/rest/messaging/v1/a2p_brand_registrations_vettings.go index b7e46cdcd..c8947dee3 100644 --- a/rest/messaging/v1/a2p_brand_registrations_vettings.go +++ b/rest/messaging/v1/a2p_brand_registrations_vettings.go @@ -18,141 +18,144 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBrandVetting' type CreateBrandVettingParams struct { - // - VettingProvider *string `json:"VettingProvider,omitempty"` - // The unique ID of the vetting - VettingId *string `json:"VettingId,omitempty"` + // + VettingProvider *string `json:"VettingProvider,omitempty"` + // The unique ID of the vetting + VettingId *string `json:"VettingId,omitempty"` } -func (params *CreateBrandVettingParams) SetVettingProvider(VettingProvider string) *CreateBrandVettingParams { - params.VettingProvider = &VettingProvider - return params +func (params *CreateBrandVettingParams) SetVettingProvider(VettingProvider string) (*CreateBrandVettingParams){ + params.VettingProvider = &VettingProvider + return params } -func (params *CreateBrandVettingParams) SetVettingId(VettingId string) *CreateBrandVettingParams { - params.VettingId = &VettingId - return params +func (params *CreateBrandVettingParams) SetVettingId(VettingId string) (*CreateBrandVettingParams){ + params.VettingId = &VettingId + return params } -// +// func (c *ApiService) CreateBrandVetting(BrandSid string, params *CreateBrandVettingParams) (*MessagingV1BrandVetting, error) { - path := "/v1/a2p/BrandRegistrations/{BrandSid}/Vettings" - path = strings.Replace(path, "{"+"BrandSid"+"}", BrandSid, -1) + path := "/v1/a2p/BrandRegistrations/{BrandSid}/Vettings" + path = strings.Replace(path, "{"+"BrandSid"+"}", BrandSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.VettingProvider != nil { - data.Set("VettingProvider", *params.VettingProvider) - } - if params != nil && params.VettingId != nil { - data.Set("VettingId", *params.VettingId) - } + if params != nil && params.VettingProvider != nil { + data.Set("VettingProvider", *params.VettingProvider) + } + if params != nil && params.VettingId != nil { + data.Set("VettingId", *params.VettingId) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MessagingV1BrandVetting{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MessagingV1BrandVetting{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) FetchBrandVetting(BrandSid string, BrandVettingSid string) (*MessagingV1BrandVetting, error) { - path := "/v1/a2p/BrandRegistrations/{BrandSid}/Vettings/{BrandVettingSid}" - path = strings.Replace(path, "{"+"BrandSid"+"}", BrandSid, -1) - path = strings.Replace(path, "{"+"BrandVettingSid"+"}", BrandVettingSid, -1) +// +func (c *ApiService) FetchBrandVetting(BrandSid string, BrandVettingSid string, ) (*MessagingV1BrandVetting, error) { + path := "/v1/a2p/BrandRegistrations/{BrandSid}/Vettings/{BrandVettingSid}" + path = strings.Replace(path, "{"+"BrandSid"+"}", BrandSid, -1) + path = strings.Replace(path, "{"+"BrandVettingSid"+"}", BrandVettingSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MessagingV1BrandVetting{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MessagingV1BrandVetting{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListBrandVetting' type ListBrandVettingParams struct { - // The third-party provider of the vettings to read - VettingProvider *string `json:"VettingProvider,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The third-party provider of the vettings to read + VettingProvider *string `json:"VettingProvider,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBrandVettingParams) SetVettingProvider(VettingProvider string) *ListBrandVettingParams { - params.VettingProvider = &VettingProvider - return params +func (params *ListBrandVettingParams) SetVettingProvider(VettingProvider string) (*ListBrandVettingParams){ + params.VettingProvider = &VettingProvider + return params } -func (params *ListBrandVettingParams) SetPageSize(PageSize int) *ListBrandVettingParams { - params.PageSize = &PageSize - return params +func (params *ListBrandVettingParams) SetPageSize(PageSize int) (*ListBrandVettingParams){ + params.PageSize = &PageSize + return params } -func (params *ListBrandVettingParams) SetLimit(Limit int) *ListBrandVettingParams { - params.Limit = &Limit - return params +func (params *ListBrandVettingParams) SetLimit(Limit int) (*ListBrandVettingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of BrandVetting records from the API. Request is executed immediately. func (c *ApiService) PageBrandVetting(BrandSid string, params *ListBrandVettingParams, pageToken, pageNumber string) (*ListBrandVettingResponse, error) { - path := "/v1/a2p/BrandRegistrations/{BrandSid}/Vettings" + path := "/v1/a2p/BrandRegistrations/{BrandSid}/Vettings" - path = strings.Replace(path, "{"+"BrandSid"+"}", BrandSid, -1) + path = strings.Replace(path, "{"+"BrandSid"+"}", BrandSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.VettingProvider != nil { - data.Set("VettingProvider", *params.VettingProvider) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.VettingProvider != nil { + data.Set("VettingProvider", *params.VettingProvider) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBrandVettingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListBrandVettingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists BrandVetting records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -193,6 +196,7 @@ func (c *ApiService) StreamBrandVetting(BrandSid string, params *ListBrandVettin return recordChannel, errorChannel } + func (c *ApiService) streamBrandVetting(response *ListBrandVettingResponse, params *ListBrandVettingParams, recordChannel chan MessagingV1BrandVetting, errorChannel chan error) { curRecord := 1 @@ -224,19 +228,20 @@ func (c *ApiService) streamBrandVetting(response *ListBrandVettingResponse, para } func (c *ApiService) getNextListBrandVettingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBrandVettingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBrandVettingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/messaging/v1/api_service.go b/rest/messaging/v1/api_service.go index 434465673..3f7f1a7fc 100644 --- a/rest/messaging/v1/api_service.go +++ b/rest/messaging/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://messaging.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/messaging/v1/deactivations.go b/rest/messaging/v1/deactivations.go index 198672a9f..68e2cf5e6 100644 --- a/rest/messaging/v1/deactivations.go +++ b/rest/messaging/v1/deactivations.go @@ -18,41 +18,45 @@ import ( "encoding/json" "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchDeactivation' type FetchDeactivationParams struct { - // The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format. - Date *string `json:"Date,omitempty"` + // The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format. + Date *string `json:"Date,omitempty"` } -func (params *FetchDeactivationParams) SetDate(Date string) *FetchDeactivationParams { - params.Date = &Date - return params +func (params *FetchDeactivationParams) SetDate(Date string) (*FetchDeactivationParams){ + params.Date = &Date + return params } // Fetch a list of all United States numbers that have been deactivated on a specific date. func (c *ApiService) FetchDeactivation(params *FetchDeactivationParams) (*MessagingV1Deactivation, error) { - path := "/v1/Deactivations" + path := "/v1/Deactivations" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Date != nil { + data.Set("Date", fmt.Sprint(*params.Date)) + } - if params != nil && params.Date != nil { - data.Set("Date", fmt.Sprint(*params.Date)) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1Deactivation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1Deactivation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/docs/ListAlphaSenderResponseMeta.md b/rest/messaging/v1/docs/ListAlphaSenderResponseMeta.md index 81405dccd..2b8f0b215 100644 --- a/rest/messaging/v1/docs/ListAlphaSenderResponseMeta.md +++ b/rest/messaging/v1/docs/ListAlphaSenderResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/messaging/v1/docs/MessagingV1UsAppToPerson.md b/rest/messaging/v1/docs/MessagingV1UsAppToPerson.md index 4ae92d77e..44d416565 100644 --- a/rest/messaging/v1/docs/MessagingV1UsAppToPerson.md +++ b/rest/messaging/v1/docs/MessagingV1UsAppToPerson.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **BrandRegistrationSid** | Pointer to **string** | The unique string to identify the A2P brand. | **MessagingServiceSid** | Pointer to **string** | The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. | **Description** | Pointer to **string** | A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. | -**MessageSamples** | Pointer to **[]string** | An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. | +**MessageSamples** | Pointer to **[]string** | Message samples, at least 1 and up to 5 sample messages (at least 2 for starter/sole proprietor), >=20 chars, <=1024 chars each. | **UsAppToPersonUsecase** | Pointer to **string** | A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand. | **HasEmbeddedLinks** | Pointer to **bool** | Indicate that this SMS campaign will send messages that contain links. | **HasEmbeddedPhone** | Pointer to **bool** | Indicates that this SMS campaign will send messages that contain phone numbers. | diff --git a/rest/messaging/v1/docs/ServicesComplianceUsa2pApi.md b/rest/messaging/v1/docs/ServicesComplianceUsa2pApi.md index 5b2fce16b..919df8024 100644 --- a/rest/messaging/v1/docs/ServicesComplianceUsa2pApi.md +++ b/rest/messaging/v1/docs/ServicesComplianceUsa2pApi.md @@ -37,7 +37,7 @@ Name | Type | Description **BrandRegistrationSid** | **string** | A2P Brand Registration SID **Description** | **string** | A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. **MessageFlow** | **string** | Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. -**MessageSamples** | **[]string** | An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. +**MessageSamples** | **[]string** | Message samples, at least 1 and up to 5 sample messages (at least 2 for sole proprietor), >=20 chars, <=1024 chars each. **UsAppToPersonUsecase** | **string** | A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] **HasEmbeddedLinks** | **bool** | Indicates that this SMS campaign will send messages that contain links. **HasEmbeddedPhone** | **bool** | Indicates that this SMS campaign will send messages that contain phone numbers. diff --git a/rest/messaging/v1/docs/TollfreeVerificationsApi.md b/rest/messaging/v1/docs/TollfreeVerificationsApi.md index 6f110ad8a..6ea1f9b3c 100644 --- a/rest/messaging/v1/docs/TollfreeVerificationsApi.md +++ b/rest/messaging/v1/docs/TollfreeVerificationsApi.md @@ -5,7 +5,6 @@ All URIs are relative to *https://messaging.twilio.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**CreateTollfreeVerification**](TollfreeVerificationsApi.md#CreateTollfreeVerification) | **Post** /v1/Tollfree/Verifications | -[**DeleteTollfreeVerification**](TollfreeVerificationsApi.md#DeleteTollfreeVerification) | **Delete** /v1/Tollfree/Verifications/{Sid} | [**FetchTollfreeVerification**](TollfreeVerificationsApi.md#FetchTollfreeVerification) | **Get** /v1/Tollfree/Verifications/{Sid} | [**ListTollfreeVerification**](TollfreeVerificationsApi.md#ListTollfreeVerification) | **Get** /v1/Tollfree/Verifications | [**UpdateTollfreeVerification**](TollfreeVerificationsApi.md#UpdateTollfreeVerification) | **Post** /v1/Tollfree/Verifications/{Sid} | @@ -73,48 +72,6 @@ Name | Type | Description [[Back to README]](../README.md) -## DeleteTollfreeVerification - -> DeleteTollfreeVerification(ctx, Sid) - - - - - -### Path Parameters - - -Name | Type | Description -------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**Sid** | **string** | The unique string to identify Tollfree Verification. - -### Other Parameters - -Other parameters are passed through a pointer to a DeleteTollfreeVerificationParams struct - - -Name | Type | Description -------------- | ------------- | ------------- - -### Return type - - (empty response body) - -### Authorization - -[accountSid_authToken](../README.md#accountSid_authToken) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - ## FetchTollfreeVerification > MessagingV1TollfreeVerification FetchTollfreeVerification(ctx, Sid) diff --git a/rest/messaging/v1/link_shortening_domains_certificate.go b/rest/messaging/v1/link_shortening_domains_certificate.go index 8447978d3..4357e20ba 100644 --- a/rest/messaging/v1/link_shortening_domains_certificate.go +++ b/rest/messaging/v1/link_shortening_domains_certificate.go @@ -16,85 +16,93 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteDomainCertV4(DomainSid string) error { - path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteDomainCertV4(DomainSid string, ) (error) { + path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchDomainCertV4(DomainSid string) (*MessagingV1DomainCertV4, error) { - path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) +// +func (c *ApiService) FetchDomainCertV4(DomainSid string, ) (*MessagingV1DomainCertV4, error) { + path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MessagingV1DomainCertV4{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MessagingV1DomainCertV4{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateDomainCertV4' type UpdateDomainCertV4Params struct { - // Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain. - TlsCert *string `json:"TlsCert,omitempty"` + // Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain. + TlsCert *string `json:"TlsCert,omitempty"` } -func (params *UpdateDomainCertV4Params) SetTlsCert(TlsCert string) *UpdateDomainCertV4Params { - params.TlsCert = &TlsCert - return params +func (params *UpdateDomainCertV4Params) SetTlsCert(TlsCert string) (*UpdateDomainCertV4Params){ + params.TlsCert = &TlsCert + return params } -// +// func (c *ApiService) UpdateDomainCertV4(DomainSid string, params *UpdateDomainCertV4Params) (*MessagingV1DomainCertV4, error) { - path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TlsCert != nil { + data.Set("TlsCert", *params.TlsCert) + } - if params != nil && params.TlsCert != nil { - data.Set("TlsCert", *params.TlsCert) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1DomainCertV4{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1DomainCertV4{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/link_shortening_domains_config.go b/rest/messaging/v1/link_shortening_domains_config.go index 04e34b090..7beb182e1 100644 --- a/rest/messaging/v1/link_shortening_domains_config.go +++ b/rest/messaging/v1/link_shortening_domains_config.go @@ -18,93 +18,98 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchDomainConfig(DomainSid string) (*MessagingV1DomainConfig, error) { - path := "/v1/LinkShortening/Domains/{DomainSid}/Config" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchDomainConfig(DomainSid string, ) (*MessagingV1DomainConfig, error) { + path := "/v1/LinkShortening/Domains/{DomainSid}/Config" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1DomainConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1DomainConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateDomainConfig' type UpdateDomainConfigParams struct { - // Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. - FallbackUrl *string `json:"FallbackUrl,omitempty"` - // URL to receive click events to your webhook whenever the recipients click on the shortened links - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // Boolean field to set customer delivery preference when there is a failure in linkShortening service - ContinueOnFailure *bool `json:"ContinueOnFailure,omitempty"` - // Customer's choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. - DisableHttps *bool `json:"DisableHttps,omitempty"` + // Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. + FallbackUrl *string `json:"FallbackUrl,omitempty"` + // URL to receive click events to your webhook whenever the recipients click on the shortened links + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // Boolean field to set customer delivery preference when there is a failure in linkShortening service + ContinueOnFailure *bool `json:"ContinueOnFailure,omitempty"` + // Customer's choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. + DisableHttps *bool `json:"DisableHttps,omitempty"` } -func (params *UpdateDomainConfigParams) SetFallbackUrl(FallbackUrl string) *UpdateDomainConfigParams { - params.FallbackUrl = &FallbackUrl - return params +func (params *UpdateDomainConfigParams) SetFallbackUrl(FallbackUrl string) (*UpdateDomainConfigParams){ + params.FallbackUrl = &FallbackUrl + return params } -func (params *UpdateDomainConfigParams) SetCallbackUrl(CallbackUrl string) *UpdateDomainConfigParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *UpdateDomainConfigParams) SetCallbackUrl(CallbackUrl string) (*UpdateDomainConfigParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *UpdateDomainConfigParams) SetContinueOnFailure(ContinueOnFailure bool) *UpdateDomainConfigParams { - params.ContinueOnFailure = &ContinueOnFailure - return params +func (params *UpdateDomainConfigParams) SetContinueOnFailure(ContinueOnFailure bool) (*UpdateDomainConfigParams){ + params.ContinueOnFailure = &ContinueOnFailure + return params } -func (params *UpdateDomainConfigParams) SetDisableHttps(DisableHttps bool) *UpdateDomainConfigParams { - params.DisableHttps = &DisableHttps - return params +func (params *UpdateDomainConfigParams) SetDisableHttps(DisableHttps bool) (*UpdateDomainConfigParams){ + params.DisableHttps = &DisableHttps + return params } -// +// func (c *ApiService) UpdateDomainConfig(DomainSid string, params *UpdateDomainConfigParams) (*MessagingV1DomainConfig, error) { - path := "/v1/LinkShortening/Domains/{DomainSid}/Config" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FallbackUrl != nil { - data.Set("FallbackUrl", *params.FallbackUrl) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.ContinueOnFailure != nil { - data.Set("ContinueOnFailure", fmt.Sprint(*params.ContinueOnFailure)) - } - if params != nil && params.DisableHttps != nil { - data.Set("DisableHttps", fmt.Sprint(*params.DisableHttps)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1DomainConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/LinkShortening/Domains/{DomainSid}/Config" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FallbackUrl != nil { + data.Set("FallbackUrl", *params.FallbackUrl) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.ContinueOnFailure != nil { + data.Set("ContinueOnFailure", fmt.Sprint(*params.ContinueOnFailure)) + } + if params != nil && params.DisableHttps != nil { + data.Set("DisableHttps", fmt.Sprint(*params.DisableHttps)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1DomainConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/messaging/v1/link_shortening_domains_messaging_services.go b/rest/messaging/v1/link_shortening_domains_messaging_services.go index 44f94e76f..660adde4d 100644 --- a/rest/messaging/v1/link_shortening_domains_messaging_services.go +++ b/rest/messaging/v1/link_shortening_domains_messaging_services.go @@ -16,49 +16,56 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) CreateLinkshorteningMessagingService(DomainSid string, MessagingServiceSid string) (*MessagingV1LinkshorteningMessagingService, error) { - path := "/v1/LinkShortening/Domains/{DomainSid}/MessagingServices/{MessagingServiceSid}" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) CreateLinkshorteningMessagingService(DomainSid string, MessagingServiceSid string, ) (*MessagingV1LinkshorteningMessagingService, error) { + path := "/v1/LinkShortening/Domains/{DomainSid}/MessagingServices/{MessagingServiceSid}" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MessagingV1LinkshorteningMessagingService{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &MessagingV1LinkshorteningMessagingService{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteLinkshorteningMessagingService(DomainSid string, MessagingServiceSid string) error { - path := "/v1/LinkShortening/Domains/{DomainSid}/MessagingServices/{MessagingServiceSid}" - path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) +// +func (c *ApiService) DeleteLinkshorteningMessagingService(DomainSid string, MessagingServiceSid string, ) (error) { + path := "/v1/LinkShortening/Domains/{DomainSid}/MessagingServices/{MessagingServiceSid}" + path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } diff --git a/rest/messaging/v1/link_shortening_messaging_service_domain_config.go b/rest/messaging/v1/link_shortening_messaging_service_domain_config.go index 9d2291f27..77ca4aec2 100644 --- a/rest/messaging/v1/link_shortening_messaging_service_domain_config.go +++ b/rest/messaging/v1/link_shortening_messaging_service_domain_config.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchDomainConfigMessagingService(MessagingServiceSid string) (*MessagingV1DomainConfigMessagingService, error) { - path := "/v1/LinkShortening/MessagingService/{MessagingServiceSid}/DomainConfig" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchDomainConfigMessagingService(MessagingServiceSid string, ) (*MessagingV1DomainConfigMessagingService, error) { + path := "/v1/LinkShortening/MessagingService/{MessagingServiceSid}/DomainConfig" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1DomainConfigMessagingService{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1DomainConfigMessagingService{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/link_shortening_messaging_services_domain.go b/rest/messaging/v1/link_shortening_messaging_services_domain.go index 5d23d2737..b33106f51 100644 --- a/rest/messaging/v1/link_shortening_messaging_services_domain.go +++ b/rest/messaging/v1/link_shortening_messaging_services_domain.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchLinkshorteningMessagingServiceDomainAssociation(MessagingServiceSid string) (*MessagingV1LinkshorteningMessagingServiceDomainAssociation, error) { - path := "/v1/LinkShortening/MessagingServices/{MessagingServiceSid}/Domain" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchLinkshorteningMessagingServiceDomainAssociation(MessagingServiceSid string, ) (*MessagingV1LinkshorteningMessagingServiceDomainAssociation, error) { + path := "/v1/LinkShortening/MessagingServices/{MessagingServiceSid}/Domain" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1LinkshorteningMessagingServiceDomainAssociation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1LinkshorteningMessagingServiceDomainAssociation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/model_list_alpha_sender_response.go b/rest/messaging/v1/model_list_alpha_sender_response.go index b2517b96c..b22e8e428 100644 --- a/rest/messaging/v1/model_list_alpha_sender_response.go +++ b/rest/messaging/v1/model_list_alpha_sender_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAlphaSenderResponse struct for ListAlphaSenderResponse type ListAlphaSenderResponse struct { - AlphaSenders []MessagingV1AlphaSender `json:"alpha_senders,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + AlphaSenders []MessagingV1AlphaSender `json:"alpha_senders,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_alpha_sender_response_meta.go b/rest/messaging/v1/model_list_alpha_sender_response_meta.go index 0e16d9067..f04aa4601 100644 --- a/rest/messaging/v1/model_list_alpha_sender_response_meta.go +++ b/rest/messaging/v1/model_list_alpha_sender_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAlphaSenderResponseMeta struct for ListAlphaSenderResponseMeta type ListAlphaSenderResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_brand_registrations_response.go b/rest/messaging/v1/model_list_brand_registrations_response.go index 68aa56cf1..54ce9d27b 100644 --- a/rest/messaging/v1/model_list_brand_registrations_response.go +++ b/rest/messaging/v1/model_list_brand_registrations_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBrandRegistrationsResponse struct for ListBrandRegistrationsResponse type ListBrandRegistrationsResponse struct { Data []MessagingV1BrandRegistrations `json:"data,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_brand_vetting_response.go b/rest/messaging/v1/model_list_brand_vetting_response.go index e36b590fb..aa954245f 100644 --- a/rest/messaging/v1/model_list_brand_vetting_response.go +++ b/rest/messaging/v1/model_list_brand_vetting_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBrandVettingResponse struct for ListBrandVettingResponse type ListBrandVettingResponse struct { - Data []MessagingV1BrandVetting `json:"data,omitempty"` + Data []MessagingV1BrandVetting `json:"data,omitempty"` Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_channel_sender_response.go b/rest/messaging/v1/model_list_channel_sender_response.go index 0184c2548..ea6485720 100644 --- a/rest/messaging/v1/model_list_channel_sender_response.go +++ b/rest/messaging/v1/model_list_channel_sender_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChannelSenderResponse struct for ListChannelSenderResponse type ListChannelSenderResponse struct { - Senders []MessagingV1ChannelSender `json:"senders,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + Senders []MessagingV1ChannelSender `json:"senders,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_phone_number_response.go b/rest/messaging/v1/model_list_phone_number_response.go index 511da6487..8e16f75b9 100644 --- a/rest/messaging/v1/model_list_phone_number_response.go +++ b/rest/messaging/v1/model_list_phone_number_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListPhoneNumberResponse struct for ListPhoneNumberResponse type ListPhoneNumberResponse struct { - PhoneNumbers []MessagingV1PhoneNumber `json:"phone_numbers,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + PhoneNumbers []MessagingV1PhoneNumber `json:"phone_numbers,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_service_response.go b/rest/messaging/v1/model_list_service_response.go index 3bf7b3042..feee735be 100644 --- a/rest/messaging/v1/model_list_service_response.go +++ b/rest/messaging/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []MessagingV1Service `json:"services,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + Services []MessagingV1Service `json:"services,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_short_code_response.go b/rest/messaging/v1/model_list_short_code_response.go index 39b38393e..c3ca37232 100644 --- a/rest/messaging/v1/model_list_short_code_response.go +++ b/rest/messaging/v1/model_list_short_code_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListShortCodeResponse struct for ListShortCodeResponse type ListShortCodeResponse struct { - ShortCodes []MessagingV1ShortCode `json:"short_codes,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + ShortCodes []MessagingV1ShortCode `json:"short_codes,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_tollfree_verification_response.go b/rest/messaging/v1/model_list_tollfree_verification_response.go index 652ed7538..081485c3f 100644 --- a/rest/messaging/v1/model_list_tollfree_verification_response.go +++ b/rest/messaging/v1/model_list_tollfree_verification_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTollfreeVerificationResponse struct for ListTollfreeVerificationResponse type ListTollfreeVerificationResponse struct { Verifications []MessagingV1TollfreeVerification `json:"verifications,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_list_us_app_to_person_response.go b/rest/messaging/v1/model_list_us_app_to_person_response.go index 59053b2dc..a30dad649 100644 --- a/rest/messaging/v1/model_list_us_app_to_person_response.go +++ b/rest/messaging/v1/model_list_us_app_to_person_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsAppToPersonResponse struct for ListUsAppToPersonResponse type ListUsAppToPersonResponse struct { - Compliance []MessagingV1UsAppToPerson `json:"compliance,omitempty"` - Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` + Compliance []MessagingV1UsAppToPerson `json:"compliance,omitempty"` + Meta ListAlphaSenderResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_alpha_sender.go b/rest/messaging/v1/model_messaging_v1_alpha_sender.go index 851451f99..3db56640b 100644 --- a/rest/messaging/v1/model_messaging_v1_alpha_sender.go +++ b/rest/messaging/v1/model_messaging_v1_alpha_sender.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1AlphaSender struct for MessagingV1AlphaSender type MessagingV1AlphaSender struct { - // The unique string that we created to identify the AlphaSender resource. + // The unique string that we created to identify the AlphaSender resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The Alphanumeric Sender ID string. + // The Alphanumeric Sender ID string. AlphaSender *string `json:"alpha_sender,omitempty"` - // An array of values that describe whether the number can receive calls or messages. Can be: `SMS`. + // An array of values that describe whether the number can receive calls or messages. Can be: `SMS`. Capabilities *[]string `json:"capabilities,omitempty"` - // The absolute URL of the AlphaSender resource. + // The absolute URL of the AlphaSender resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_brand_registration_otp.go b/rest/messaging/v1/model_messaging_v1_brand_registration_otp.go index 6ec8b4ed9..a0a06903c 100644 --- a/rest/messaging/v1/model_messaging_v1_brand_registration_otp.go +++ b/rest/messaging/v1/model_messaging_v1_brand_registration_otp.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MessagingV1BrandRegistrationOtp struct for MessagingV1BrandRegistrationOtp type MessagingV1BrandRegistrationOtp struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string to identify Brand Registration of Sole Proprietor Brand + // The unique string to identify Brand Registration of Sole Proprietor Brand BrandRegistrationSid *string `json:"brand_registration_sid,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_brand_registrations.go b/rest/messaging/v1/model_messaging_v1_brand_registrations.go index 3fef6d4b3..a02122970 100644 --- a/rest/messaging/v1/model_messaging_v1_brand_registrations.go +++ b/rest/messaging/v1/model_messaging_v1_brand_registrations.go @@ -13,48 +13,50 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1BrandRegistrations struct for MessagingV1BrandRegistrations type MessagingV1BrandRegistrations struct { - // The unique string to identify Brand Registration. + // The unique string to identify Brand Registration. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. AccountSid *string `json:"account_sid,omitempty"` - // A2P Messaging Profile Bundle BundleSid. + // A2P Messaging Profile Bundle BundleSid. CustomerProfileBundleSid *string `json:"customer_profile_bundle_sid,omitempty"` - // A2P Messaging Profile Bundle BundleSid. + // A2P Messaging Profile Bundle BundleSid. A2pProfileBundleSid *string `json:"a2p_profile_bundle_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. + // Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. BrandType *string `json:"brand_type,omitempty"` - Status *string `json:"status,omitempty"` - // Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration. + Status *string `json:"status,omitempty"` + // Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration. TcrId *string `json:"tcr_id,omitempty"` - // A reason why brand registration has failed. Only applicable when status is FAILED. + // A reason why brand registration has failed. Only applicable when status is FAILED. FailureReason *string `json:"failure_reason,omitempty"` - // The absolute URL of the Brand Registration resource. + // The absolute URL of the Brand Registration resource. Url *string `json:"url,omitempty"` - // The secondary vetting score if it was done. Otherwise, it will be the brand score if it's returned from TCR. It may be null if no score is available. + // The secondary vetting score if it was done. Otherwise, it will be the brand score if it's returned from TCR. It may be null if no score is available. BrandScore *int `json:"brand_score,omitempty"` - // Feedback on how to improve brand score - BrandFeedback *[]string `json:"brand_feedback,omitempty"` - IdentityStatus *string `json:"identity_status,omitempty"` - // Publicly traded company identified in the Russell 3000 Index + // Feedback on how to improve brand score + BrandFeedback *[]string `json:"brand_feedback,omitempty"` + IdentityStatus *string `json:"identity_status,omitempty"` + // Publicly traded company identified in the Russell 3000 Index Russell3000 *bool `json:"russell_3000,omitempty"` - // Identified as a government entity + // Identified as a government entity GovernmentEntity *bool `json:"government_entity,omitempty"` - // Nonprofit organization tax-exempt status per section 501 of the U.S. tax code. + // Nonprofit organization tax-exempt status per section 501 of the U.S. tax code. TaxExemptStatus *string `json:"tax_exempt_status,omitempty"` - // A flag to disable automatic secondary vetting for brands which it would otherwise be done. + // A flag to disable automatic secondary vetting for brands which it would otherwise be done. SkipAutomaticSecVet *bool `json:"skip_automatic_sec_vet,omitempty"` - // A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. - Mock *bool `json:"mock,omitempty"` + // A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. + Mock *bool `json:"mock,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_brand_vetting.go b/rest/messaging/v1/model_messaging_v1_brand_vetting.go index 93b941623..bc578361a 100644 --- a/rest/messaging/v1/model_messaging_v1_brand_vetting.go +++ b/rest/messaging/v1/model_messaging_v1_brand_vetting.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1BrandVetting struct for MessagingV1BrandVetting type MessagingV1BrandVetting struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record. AccountSid *string `json:"account_sid,omitempty"` - // The unique string to identify Brand Registration. + // The unique string to identify Brand Registration. BrandSid *string `json:"brand_sid,omitempty"` - // The Twilio SID of the third-party vetting record. + // The Twilio SID of the third-party vetting record. BrandVettingSid *string `json:"brand_vetting_sid,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The unique identifier of the vetting from the third-party provider. + // The unique identifier of the vetting from the third-party provider. VettingId *string `json:"vetting_id,omitempty"` - // The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify). + // The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify). VettingClass *string `json:"vetting_class,omitempty"` - // The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”. - VettingStatus *string `json:"vetting_status,omitempty"` + // The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”. + VettingStatus *string `json:"vetting_status,omitempty"` VettingProvider *string `json:"vetting_provider,omitempty"` - // The absolute URL of the Brand Vetting resource. + // The absolute URL of the Brand Vetting resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_channel_sender.go b/rest/messaging/v1/model_messaging_v1_channel_sender.go index 319e44d36..0ee01ad4a 100644 --- a/rest/messaging/v1/model_messaging_v1_channel_sender.go +++ b/rest/messaging/v1/model_messaging_v1_channel_sender.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1ChannelSender struct for MessagingV1ChannelSender type MessagingV1ChannelSender struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // The unique string that we created to identify the ChannelSender resource. + // The unique string that we created to identify the ChannelSender resource. Sid *string `json:"sid,omitempty"` - // The unique string that identifies the sender e.g whatsapp:+123456XXXX. + // The unique string that identifies the sender e.g whatsapp:+123456XXXX. Sender *string `json:"sender,omitempty"` - // A string value that identifies the sender type e.g WhatsApp, Messenger. + // A string value that identifies the sender type e.g WhatsApp, Messenger. SenderType *string `json:"sender_type,omitempty"` - // The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. + // The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. CountryCode *string `json:"country_code,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_deactivation.go b/rest/messaging/v1/model_messaging_v1_deactivation.go index b718e33e5..38be8845a 100644 --- a/rest/messaging/v1/model_messaging_v1_deactivation.go +++ b/rest/messaging/v1/model_messaging_v1_deactivation.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MessagingV1Deactivation struct for MessagingV1Deactivation type MessagingV1Deactivation struct { - // Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes. + // Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes. RedirectTo *string `json:"redirect_to,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_domain_cert_v4.go b/rest/messaging/v1/model_messaging_v1_domain_cert_v4.go index 370df0f4b..4171473d2 100644 --- a/rest/messaging/v1/model_messaging_v1_domain_cert_v4.go +++ b/rest/messaging/v1/model_messaging_v1_domain_cert_v4.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1DomainCertV4 struct for MessagingV1DomainCertV4 type MessagingV1DomainCertV4 struct { - // The unique string that we created to identify the Domain resource. + // The unique string that we created to identify the Domain resource. DomainSid *string `json:"domain_sid,omitempty"` - // Date that this Domain was last updated. + // Date that this Domain was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work. + // Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work. DateExpires *time.Time `json:"date_expires,omitempty"` - // Date that this Domain was registered to the Twilio platform to create a new Domain object. + // Date that this Domain was registered to the Twilio platform to create a new Domain object. DateCreated *time.Time `json:"date_created,omitempty"` - // Full url path for this domain. + // Full url path for this domain. DomainName *string `json:"domain_name,omitempty"` - // The unique string that we created to identify this Certificate resource. + // The unique string that we created to identify this Certificate resource. CertificateSid *string `json:"certificate_sid,omitempty"` - Url *string `json:"url,omitempty"` - // Optional JSON field describing the status and upload date of a new certificate in the process of validation + Url *string `json:"url,omitempty"` + // Optional JSON field describing the status and upload date of a new certificate in the process of validation CertInValidation *interface{} `json:"cert_in_validation,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_domain_config.go b/rest/messaging/v1/model_messaging_v1_domain_config.go index e75bc0b9d..8e268af07 100644 --- a/rest/messaging/v1/model_messaging_v1_domain_config.go +++ b/rest/messaging/v1/model_messaging_v1_domain_config.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1DomainConfig struct for MessagingV1DomainConfig type MessagingV1DomainConfig struct { - // The unique string that we created to identify the Domain resource. + // The unique string that we created to identify the Domain resource. DomainSid *string `json:"domain_sid,omitempty"` - // The unique string that we created to identify the Domain config (prefix ZK). + // The unique string that we created to identify the Domain config (prefix ZK). ConfigSid *string `json:"config_sid,omitempty"` - // Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. + // Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. FallbackUrl *string `json:"fallback_url,omitempty"` - // URL to receive click events to your webhook whenever the recipients click on the shortened links. + // URL to receive click events to your webhook whenever the recipients click on the shortened links. CallbackUrl *string `json:"callback_url,omitempty"` - // Boolean field to set customer delivery preference when there is a failure in linkShortening service + // Boolean field to set customer delivery preference when there is a failure in linkShortening service ContinueOnFailure *bool `json:"continue_on_failure,omitempty"` - // Date this Domain Config was created. + // Date this Domain Config was created. DateCreated *time.Time `json:"date_created,omitempty"` - // Date that this Domain Config was last updated. + // Date that this Domain Config was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` - // Customer's choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. + Url *string `json:"url,omitempty"` + // Customer's choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified. DisableHttps *bool `json:"disable_https,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_domain_config_messaging_service.go b/rest/messaging/v1/model_messaging_v1_domain_config_messaging_service.go index c0cccae9f..cf077e056 100644 --- a/rest/messaging/v1/model_messaging_v1_domain_config_messaging_service.go +++ b/rest/messaging/v1/model_messaging_v1_domain_config_messaging_service.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1DomainConfigMessagingService struct for MessagingV1DomainConfigMessagingService type MessagingV1DomainConfigMessagingService struct { - // The unique string that we created to identify the Domain resource. + // The unique string that we created to identify the Domain resource. DomainSid *string `json:"domain_sid,omitempty"` - // The unique string that we created to identify the Domain config (prefix ZK). + // The unique string that we created to identify the Domain config (prefix ZK). ConfigSid *string `json:"config_sid,omitempty"` - // The unique string that identifies the messaging service + // The unique string that identifies the messaging service MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. + // Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. FallbackUrl *string `json:"fallback_url,omitempty"` - // URL to receive click events to your webhook whenever the recipients click on the shortened links. + // URL to receive click events to your webhook whenever the recipients click on the shortened links. CallbackUrl *string `json:"callback_url,omitempty"` - // Boolean field to set customer delivery preference when there is a failure in linkShortening service + // Boolean field to set customer delivery preference when there is a failure in linkShortening service ContinueOnFailure *bool `json:"continue_on_failure,omitempty"` - // Date this Domain Config was created. + // Date this Domain Config was created. DateCreated *time.Time `json:"date_created,omitempty"` - // Date that this Domain Config was last updated. + // Date that this Domain Config was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_external_campaign.go b/rest/messaging/v1/model_messaging_v1_external_campaign.go index 0c4aba528..1590f0596 100644 --- a/rest/messaging/v1/model_messaging_v1_external_campaign.go +++ b/rest/messaging/v1/model_messaging_v1_external_campaign.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1ExternalCampaign struct for MessagingV1ExternalCampaign type MessagingV1ExternalCampaign struct { - // The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. + // The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. AccountSid *string `json:"account_sid,omitempty"` - // ID of the preregistered campaign. + // ID of the preregistered campaign. CampaignId *string `json:"campaign_id,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service.go b/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service.go index efc7be12a..e7c707fd7 100644 --- a/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service.go +++ b/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service.go @@ -13,12 +13,17 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MessagingV1LinkshorteningMessagingService struct for MessagingV1LinkshorteningMessagingService type MessagingV1LinkshorteningMessagingService struct { - // The unique string identifies the domain resource + // The unique string identifies the domain resource DomainSid *string `json:"domain_sid,omitempty"` - // The unique string that identifies the messaging service + // The unique string that identifies the messaging service MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service_domain_association.go b/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service_domain_association.go index 9746083a6..e6560ffc7 100644 --- a/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service_domain_association.go +++ b/rest/messaging/v1/model_messaging_v1_linkshortening_messaging_service_domain_association.go @@ -13,12 +13,17 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MessagingV1LinkshorteningMessagingServiceDomainAssociation struct for MessagingV1LinkshorteningMessagingServiceDomainAssociation type MessagingV1LinkshorteningMessagingServiceDomainAssociation struct { - // The unique string that we created to identify the Domain resource. + // The unique string that we created to identify the Domain resource. DomainSid *string `json:"domain_sid,omitempty"` - // The unique string that identifies the messaging service + // The unique string that identifies the messaging service MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_phone_number.go b/rest/messaging/v1/model_messaging_v1_phone_number.go index 9e7c9abe4..b5f2aeefc 100644 --- a/rest/messaging/v1/model_messaging_v1_phone_number.go +++ b/rest/messaging/v1/model_messaging_v1_phone_number.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1PhoneNumber struct for MessagingV1PhoneNumber type MessagingV1PhoneNumber struct { - // The unique string that we created to identify the PhoneNumber resource. + // The unique string that we created to identify the PhoneNumber resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. + // The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. CountryCode *string `json:"country_code,omitempty"` - // An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`. + // An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`. Capabilities *[]string `json:"capabilities,omitempty"` - // The absolute URL of the PhoneNumber resource. + // The absolute URL of the PhoneNumber resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_service.go b/rest/messaging/v1/model_messaging_v1_service.go index 95346397c..1b8ea56b9 100644 --- a/rest/messaging/v1/model_messaging_v1_service.go +++ b/rest/messaging/v1/model_messaging_v1_service.go @@ -13,56 +13,58 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1Service struct for MessagingV1Service type MessagingV1Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. + // The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. InboundRequestUrl *string `json:"inbound_request_url,omitempty"` - // The HTTP method we use to call `inbound_request_url`. Can be `GET` or `POST`. + // The HTTP method we use to call `inbound_request_url`. Can be `GET` or `POST`. InboundMethod *string `json:"inbound_method,omitempty"` - // The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. + // The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. FallbackUrl *string `json:"fallback_url,omitempty"` - // The HTTP method we use to call `fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `fallback_url`. Can be: `GET` or `POST`. FallbackMethod *string `json:"fallback_method,omitempty"` - // The URL we call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. + // The URL we call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. StatusCallback *string `json:"status_callback,omitempty"` - // Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. + // Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. StickySender *bool `json:"sticky_sender,omitempty"` - // Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. + // Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. MmsConverter *bool `json:"mms_converter,omitempty"` - // Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. - SmartEncoding *bool `json:"smart_encoding,omitempty"` + // Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. + SmartEncoding *bool `json:"smart_encoding,omitempty"` ScanMessageContent *string `json:"scan_message_content,omitempty"` - // [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. + // [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. FallbackToLongCode *bool `json:"fallback_to_long_code,omitempty"` - // Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. + // Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. AreaCodeGeomatch *bool `json:"area_code_geomatch,omitempty"` - // Reserved. + // Reserved. SynchronousValidation *bool `json:"synchronous_validation,omitempty"` - // How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + // How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. ValidityPeriod *int `json:"validity_period,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The absolute URLs of related resources. + // The absolute URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. + // A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. Usecase *string `json:"usecase,omitempty"` - // Whether US A2P campaign is registered for this Service. + // Whether US A2P campaign is registered for this Service. UsAppToPersonRegistered *bool `json:"us_app_to_person_registered,omitempty"` - // A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. + // A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. UseInboundWebhookOnNumber *bool `json:"use_inbound_webhook_on_number,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_short_code.go b/rest/messaging/v1/model_messaging_v1_short_code.go index 50131a757..8e9ecfa42 100644 --- a/rest/messaging/v1/model_messaging_v1_short_code.go +++ b/rest/messaging/v1/model_messaging_v1_short_code.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1ShortCode struct for MessagingV1ShortCode type MessagingV1ShortCode struct { - // The unique string that we created to identify the ShortCode resource. + // The unique string that we created to identify the ShortCode resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code. + // The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code. ShortCode *string `json:"short_code,omitempty"` - // The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. + // The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. CountryCode *string `json:"country_code,omitempty"` - // An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`. + // An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`. Capabilities *[]string `json:"capabilities,omitempty"` - // The absolute URL of the ShortCode resource. + // The absolute URL of the ShortCode resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_tollfree_verification.go b/rest/messaging/v1/model_messaging_v1_tollfree_verification.go index cde23ebdc..4505990ab 100644 --- a/rest/messaging/v1/model_messaging_v1_tollfree_verification.go +++ b/rest/messaging/v1/model_messaging_v1_tollfree_verification.go @@ -13,79 +13,81 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1TollfreeVerification struct for MessagingV1TollfreeVerification type MessagingV1TollfreeVerification struct { - // The unique string to identify Tollfree Verification. + // The unique string to identify Tollfree Verification. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tollfree Verification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tollfree Verification resource. AccountSid *string `json:"account_sid,omitempty"` - // Customer's Profile Bundle BundleSid. + // Customer's Profile Bundle BundleSid. CustomerProfileSid *string `json:"customer_profile_sid,omitempty"` - // Tollfree TrustProduct Bundle BundleSid. + // Tollfree TrustProduct Bundle BundleSid. TrustProductSid *string `json:"trust_product_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the Regulated Item. + // The SID of the Regulated Item. RegulatedItemSid *string `json:"regulated_item_sid,omitempty"` - // The name of the business or organization using the Tollfree number. + // The name of the business or organization using the Tollfree number. BusinessName *string `json:"business_name,omitempty"` - // The address of the business or organization using the Tollfree number. + // The address of the business or organization using the Tollfree number. BusinessStreetAddress *string `json:"business_street_address,omitempty"` - // The address of the business or organization using the Tollfree number. + // The address of the business or organization using the Tollfree number. BusinessStreetAddress2 *string `json:"business_street_address2,omitempty"` - // The city of the business or organization using the Tollfree number. + // The city of the business or organization using the Tollfree number. BusinessCity *string `json:"business_city,omitempty"` - // The state/province/region of the business or organization using the Tollfree number. + // The state/province/region of the business or organization using the Tollfree number. BusinessStateProvinceRegion *string `json:"business_state_province_region,omitempty"` - // The postal code of the business or organization using the Tollfree number. + // The postal code of the business or organization using the Tollfree number. BusinessPostalCode *string `json:"business_postal_code,omitempty"` - // The country of the business or organization using the Tollfree number. + // The country of the business or organization using the Tollfree number. BusinessCountry *string `json:"business_country,omitempty"` - // The website of the business or organization using the Tollfree number. + // The website of the business or organization using the Tollfree number. BusinessWebsite *string `json:"business_website,omitempty"` - // The first name of the contact for the business or organization using the Tollfree number. + // The first name of the contact for the business or organization using the Tollfree number. BusinessContactFirstName *string `json:"business_contact_first_name,omitempty"` - // The last name of the contact for the business or organization using the Tollfree number. + // The last name of the contact for the business or organization using the Tollfree number. BusinessContactLastName *string `json:"business_contact_last_name,omitempty"` - // The email address of the contact for the business or organization using the Tollfree number. + // The email address of the contact for the business or organization using the Tollfree number. BusinessContactEmail *string `json:"business_contact_email,omitempty"` - // The phone number of the contact for the business or organization using the Tollfree number. + // The phone number of the contact for the business or organization using the Tollfree number. BusinessContactPhone *string `json:"business_contact_phone,omitempty"` - // The email address to receive the notification about the verification result. . + // The email address to receive the notification about the verification result. . NotificationEmail *string `json:"notification_email,omitempty"` - // The category of the use case for the Tollfree Number. List as many are applicable.. + // The category of the use case for the Tollfree Number. List as many are applicable.. UseCaseCategories *[]string `json:"use_case_categories,omitempty"` - // Use this to further explain how messaging is used by the business or organization. + // Use this to further explain how messaging is used by the business or organization. UseCaseSummary *string `json:"use_case_summary,omitempty"` - // An example of message content, i.e. a sample message. + // An example of message content, i.e. a sample message. ProductionMessageSample *string `json:"production_message_sample,omitempty"` - // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. + // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. OptInImageUrls *[]string `json:"opt_in_image_urls,omitempty"` - OptInType *string `json:"opt_in_type,omitempty"` - // Estimate monthly volume of messages from the Tollfree Number. + OptInType *string `json:"opt_in_type,omitempty"` + // Estimate monthly volume of messages from the Tollfree Number. MessageVolume *string `json:"message_volume,omitempty"` - // Additional information to be provided for verification. + // Additional information to be provided for verification. AdditionalInformation *string `json:"additional_information,omitempty"` - // The SID of the Phone Number associated with the Tollfree Verification. + // The SID of the Phone Number associated with the Tollfree Verification. TollfreePhoneNumberSid *string `json:"tollfree_phone_number_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The absolute URL of the Tollfree Verification resource. + Status *string `json:"status,omitempty"` + // The absolute URL of the Tollfree Verification resource. Url *string `json:"url,omitempty"` - // The rejection reason given when a Tollfree Verification has been rejected. + // The rejection reason given when a Tollfree Verification has been rejected. RejectionReason *string `json:"rejection_reason,omitempty"` - // The error code given when a Tollfree Verification has been rejected. + // The error code given when a Tollfree Verification has been rejected. ErrorCode *int `json:"error_code,omitempty"` - // The date and time when the ability to edit a rejected verification expires. + // The date and time when the ability to edit a rejected verification expires. EditExpiration *time.Time `json:"edit_expiration,omitempty"` - // The URLs of the documents associated with the Tollfree Verification resource. + // The URLs of the documents associated with the Tollfree Verification resource. ResourceLinks *interface{} `json:"resource_links,omitempty"` - // An optional external reference ID supplied by customer and echoed back on status retrieval. + // An optional external reference ID supplied by customer and echoed back on status retrieval. ExternalReferenceId *string `json:"external_reference_id,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_us_app_to_person.go b/rest/messaging/v1/model_messaging_v1_us_app_to_person.go index 9303cbd48..05cd0e048 100644 --- a/rest/messaging/v1/model_messaging_v1_us_app_to_person.go +++ b/rest/messaging/v1/model_messaging_v1_us_app_to_person.go @@ -13,61 +13,63 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MessagingV1UsAppToPerson struct for MessagingV1UsAppToPerson type MessagingV1UsAppToPerson struct { - // The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. + // The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. AccountSid *string `json:"account_sid,omitempty"` - // The unique string to identify the A2P brand. + // The unique string to identify the A2P brand. BrandRegistrationSid *string `json:"brand_registration_sid,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + // A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. Description *string `json:"description,omitempty"` - // An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. + // Message samples, at least 1 and up to 5 sample messages (at least 2 for starter/sole proprietor), >=20 chars, <=1024 chars each. MessageSamples *[]string `json:"message_samples,omitempty"` - // A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand. + // A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand. UsAppToPersonUsecase *string `json:"us_app_to_person_usecase,omitempty"` - // Indicate that this SMS campaign will send messages that contain links. + // Indicate that this SMS campaign will send messages that contain links. HasEmbeddedLinks *bool `json:"has_embedded_links,omitempty"` - // Indicates that this SMS campaign will send messages that contain phone numbers. + // Indicates that this SMS campaign will send messages that contain phone numbers. HasEmbeddedPhone *bool `json:"has_embedded_phone,omitempty"` - // Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED. + // Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED. CampaignStatus *string `json:"campaign_status,omitempty"` - // The Campaign Registry (TCR) Campaign ID. + // The Campaign Registry (TCR) Campaign ID. CampaignId *string `json:"campaign_id,omitempty"` - // Indicates whether the campaign was registered externally or not. + // Indicates whether the campaign was registered externally or not. IsExternallyRegistered *bool `json:"is_externally_registered,omitempty"` - // Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile. + // Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile. RateLimits *interface{} `json:"rate_limits,omitempty"` - // Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + // Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. MessageFlow *string `json:"message_flow,omitempty"` - // If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. + // If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. OptInMessage *string `json:"opt_in_message,omitempty"` - // Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. + // Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. OptOutMessage *string `json:"opt_out_message,omitempty"` - // When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. + // When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. HelpMessage *string `json:"help_message,omitempty"` - // If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. + // If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. OptInKeywords *[]string `json:"opt_in_keywords,omitempty"` - // End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + // End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. OptOutKeywords *[]string `json:"opt_out_keywords,omitempty"` - // End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + // End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. HelpKeywords *[]string `json:"help_keywords,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the US App to Person resource. + // The absolute URL of the US App to Person resource. Url *string `json:"url,omitempty"` - // A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes. + // A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes. Mock *bool `json:"mock,omitempty"` - // Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements. + // Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements. Errors *[]interface{} `json:"errors,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_us_app_to_person_usecase.go b/rest/messaging/v1/model_messaging_v1_us_app_to_person_usecase.go index 5b80529aa..14ecfa6a1 100644 --- a/rest/messaging/v1/model_messaging_v1_us_app_to_person_usecase.go +++ b/rest/messaging/v1/model_messaging_v1_us_app_to_person_usecase.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MessagingV1UsAppToPersonUsecase struct for MessagingV1UsAppToPersonUsecase type MessagingV1UsAppToPersonUsecase struct { - // Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases. + // Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases. UsAppToPersonUsecases *[]interface{} `json:"us_app_to_person_usecases,omitempty"` } + + diff --git a/rest/messaging/v1/model_messaging_v1_usecase.go b/rest/messaging/v1/model_messaging_v1_usecase.go index de5313f1c..8ab806b23 100644 --- a/rest/messaging/v1/model_messaging_v1_usecase.go +++ b/rest/messaging/v1/model_messaging_v1_usecase.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MessagingV1Usecase struct for MessagingV1Usecase type MessagingV1Usecase struct { - // Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases. + // Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases. Usecases *[]interface{} `json:"usecases,omitempty"` } + + diff --git a/rest/messaging/v1/services.go b/rest/messaging/v1/services.go index df8bfbe4a..c046782db 100644 --- a/rest/messaging/v1/services.go +++ b/rest/messaging/v1/services.go @@ -18,272 +18,278 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. - InboundRequestUrl *string `json:"InboundRequestUrl,omitempty"` - // The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. - InboundMethod *string `json:"InboundMethod,omitempty"` - // The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. - FallbackUrl *string `json:"FallbackUrl,omitempty"` - // The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. - FallbackMethod *string `json:"FallbackMethod,omitempty"` - // The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. - StatusCallback *string `json:"StatusCallback,omitempty"` - // Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. - StickySender *bool `json:"StickySender,omitempty"` - // Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. - MmsConverter *bool `json:"MmsConverter,omitempty"` - // Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. - SmartEncoding *bool `json:"SmartEncoding,omitempty"` - // - ScanMessageContent *string `json:"ScanMessageContent,omitempty"` - // [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. - FallbackToLongCode *bool `json:"FallbackToLongCode,omitempty"` - // Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - AreaCodeGeomatch *bool `json:"AreaCodeGeomatch,omitempty"` - // How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. - ValidityPeriod *int `json:"ValidityPeriod,omitempty"` - // Reserved. - SynchronousValidation *bool `json:"SynchronousValidation,omitempty"` - // A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. - Usecase *string `json:"Usecase,omitempty"` - // A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. - UseInboundWebhookOnNumber *bool `json:"UseInboundWebhookOnNumber,omitempty"` -} - -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateServiceParams) SetInboundRequestUrl(InboundRequestUrl string) *CreateServiceParams { - params.InboundRequestUrl = &InboundRequestUrl - return params -} -func (params *CreateServiceParams) SetInboundMethod(InboundMethod string) *CreateServiceParams { - params.InboundMethod = &InboundMethod - return params -} -func (params *CreateServiceParams) SetFallbackUrl(FallbackUrl string) *CreateServiceParams { - params.FallbackUrl = &FallbackUrl - return params -} -func (params *CreateServiceParams) SetFallbackMethod(FallbackMethod string) *CreateServiceParams { - params.FallbackMethod = &FallbackMethod - return params -} -func (params *CreateServiceParams) SetStatusCallback(StatusCallback string) *CreateServiceParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateServiceParams) SetStickySender(StickySender bool) *CreateServiceParams { - params.StickySender = &StickySender - return params -} -func (params *CreateServiceParams) SetMmsConverter(MmsConverter bool) *CreateServiceParams { - params.MmsConverter = &MmsConverter - return params -} -func (params *CreateServiceParams) SetSmartEncoding(SmartEncoding bool) *CreateServiceParams { - params.SmartEncoding = &SmartEncoding - return params -} -func (params *CreateServiceParams) SetScanMessageContent(ScanMessageContent string) *CreateServiceParams { - params.ScanMessageContent = &ScanMessageContent - return params -} -func (params *CreateServiceParams) SetFallbackToLongCode(FallbackToLongCode bool) *CreateServiceParams { - params.FallbackToLongCode = &FallbackToLongCode - return params -} -func (params *CreateServiceParams) SetAreaCodeGeomatch(AreaCodeGeomatch bool) *CreateServiceParams { - params.AreaCodeGeomatch = &AreaCodeGeomatch - return params -} -func (params *CreateServiceParams) SetValidityPeriod(ValidityPeriod int) *CreateServiceParams { - params.ValidityPeriod = &ValidityPeriod - return params -} -func (params *CreateServiceParams) SetSynchronousValidation(SynchronousValidation bool) *CreateServiceParams { - params.SynchronousValidation = &SynchronousValidation - return params -} -func (params *CreateServiceParams) SetUsecase(Usecase string) *CreateServiceParams { - params.Usecase = &Usecase - return params -} -func (params *CreateServiceParams) SetUseInboundWebhookOnNumber(UseInboundWebhookOnNumber bool) *CreateServiceParams { - params.UseInboundWebhookOnNumber = &UseInboundWebhookOnNumber - return params -} - -// + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. + InboundRequestUrl *string `json:"InboundRequestUrl,omitempty"` + // The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. + InboundMethod *string `json:"InboundMethod,omitempty"` + // The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. + FallbackUrl *string `json:"FallbackUrl,omitempty"` + // The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. + FallbackMethod *string `json:"FallbackMethod,omitempty"` + // The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. + StatusCallback *string `json:"StatusCallback,omitempty"` + // Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. + StickySender *bool `json:"StickySender,omitempty"` + // Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. + MmsConverter *bool `json:"MmsConverter,omitempty"` + // Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. + SmartEncoding *bool `json:"SmartEncoding,omitempty"` + // + ScanMessageContent *string `json:"ScanMessageContent,omitempty"` + // [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. + FallbackToLongCode *bool `json:"FallbackToLongCode,omitempty"` + // Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. + AreaCodeGeomatch *bool `json:"AreaCodeGeomatch,omitempty"` + // How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + ValidityPeriod *int `json:"ValidityPeriod,omitempty"` + // Reserved. + SynchronousValidation *bool `json:"SynchronousValidation,omitempty"` + // A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. + Usecase *string `json:"Usecase,omitempty"` + // A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. + UseInboundWebhookOnNumber *bool `json:"UseInboundWebhookOnNumber,omitempty"` +} + +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateServiceParams) SetInboundRequestUrl(InboundRequestUrl string) (*CreateServiceParams){ + params.InboundRequestUrl = &InboundRequestUrl + return params +} +func (params *CreateServiceParams) SetInboundMethod(InboundMethod string) (*CreateServiceParams){ + params.InboundMethod = &InboundMethod + return params +} +func (params *CreateServiceParams) SetFallbackUrl(FallbackUrl string) (*CreateServiceParams){ + params.FallbackUrl = &FallbackUrl + return params +} +func (params *CreateServiceParams) SetFallbackMethod(FallbackMethod string) (*CreateServiceParams){ + params.FallbackMethod = &FallbackMethod + return params +} +func (params *CreateServiceParams) SetStatusCallback(StatusCallback string) (*CreateServiceParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateServiceParams) SetStickySender(StickySender bool) (*CreateServiceParams){ + params.StickySender = &StickySender + return params +} +func (params *CreateServiceParams) SetMmsConverter(MmsConverter bool) (*CreateServiceParams){ + params.MmsConverter = &MmsConverter + return params +} +func (params *CreateServiceParams) SetSmartEncoding(SmartEncoding bool) (*CreateServiceParams){ + params.SmartEncoding = &SmartEncoding + return params +} +func (params *CreateServiceParams) SetScanMessageContent(ScanMessageContent string) (*CreateServiceParams){ + params.ScanMessageContent = &ScanMessageContent + return params +} +func (params *CreateServiceParams) SetFallbackToLongCode(FallbackToLongCode bool) (*CreateServiceParams){ + params.FallbackToLongCode = &FallbackToLongCode + return params +} +func (params *CreateServiceParams) SetAreaCodeGeomatch(AreaCodeGeomatch bool) (*CreateServiceParams){ + params.AreaCodeGeomatch = &AreaCodeGeomatch + return params +} +func (params *CreateServiceParams) SetValidityPeriod(ValidityPeriod int) (*CreateServiceParams){ + params.ValidityPeriod = &ValidityPeriod + return params +} +func (params *CreateServiceParams) SetSynchronousValidation(SynchronousValidation bool) (*CreateServiceParams){ + params.SynchronousValidation = &SynchronousValidation + return params +} +func (params *CreateServiceParams) SetUsecase(Usecase string) (*CreateServiceParams){ + params.Usecase = &Usecase + return params +} +func (params *CreateServiceParams) SetUseInboundWebhookOnNumber(UseInboundWebhookOnNumber bool) (*CreateServiceParams){ + params.UseInboundWebhookOnNumber = &UseInboundWebhookOnNumber + return params +} + +// func (c *ApiService) CreateService(params *CreateServiceParams) (*MessagingV1Service, error) { - path := "/v1/Services" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.InboundRequestUrl != nil { - data.Set("InboundRequestUrl", *params.InboundRequestUrl) - } - if params != nil && params.InboundMethod != nil { - data.Set("InboundMethod", *params.InboundMethod) - } - if params != nil && params.FallbackUrl != nil { - data.Set("FallbackUrl", *params.FallbackUrl) - } - if params != nil && params.FallbackMethod != nil { - data.Set("FallbackMethod", *params.FallbackMethod) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StickySender != nil { - data.Set("StickySender", fmt.Sprint(*params.StickySender)) - } - if params != nil && params.MmsConverter != nil { - data.Set("MmsConverter", fmt.Sprint(*params.MmsConverter)) - } - if params != nil && params.SmartEncoding != nil { - data.Set("SmartEncoding", fmt.Sprint(*params.SmartEncoding)) - } - if params != nil && params.ScanMessageContent != nil { - data.Set("ScanMessageContent", *params.ScanMessageContent) - } - if params != nil && params.FallbackToLongCode != nil { - data.Set("FallbackToLongCode", fmt.Sprint(*params.FallbackToLongCode)) - } - if params != nil && params.AreaCodeGeomatch != nil { - data.Set("AreaCodeGeomatch", fmt.Sprint(*params.AreaCodeGeomatch)) - } - if params != nil && params.ValidityPeriod != nil { - data.Set("ValidityPeriod", fmt.Sprint(*params.ValidityPeriod)) - } - if params != nil && params.SynchronousValidation != nil { - data.Set("SynchronousValidation", fmt.Sprint(*params.SynchronousValidation)) - } - if params != nil && params.Usecase != nil { - data.Set("Usecase", *params.Usecase) - } - if params != nil && params.UseInboundWebhookOnNumber != nil { - data.Set("UseInboundWebhookOnNumber", fmt.Sprint(*params.UseInboundWebhookOnNumber)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err -} - -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() - - return nil -} - -// -func (c *ApiService) FetchService(Sid string) (*MessagingV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.InboundRequestUrl != nil { + data.Set("InboundRequestUrl", *params.InboundRequestUrl) + } + if params != nil && params.InboundMethod != nil { + data.Set("InboundMethod", *params.InboundMethod) + } + if params != nil && params.FallbackUrl != nil { + data.Set("FallbackUrl", *params.FallbackUrl) + } + if params != nil && params.FallbackMethod != nil { + data.Set("FallbackMethod", *params.FallbackMethod) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StickySender != nil { + data.Set("StickySender", fmt.Sprint(*params.StickySender)) + } + if params != nil && params.MmsConverter != nil { + data.Set("MmsConverter", fmt.Sprint(*params.MmsConverter)) + } + if params != nil && params.SmartEncoding != nil { + data.Set("SmartEncoding", fmt.Sprint(*params.SmartEncoding)) + } + if params != nil && params.ScanMessageContent != nil { + data.Set("ScanMessageContent", *params.ScanMessageContent) + } + if params != nil && params.FallbackToLongCode != nil { + data.Set("FallbackToLongCode", fmt.Sprint(*params.FallbackToLongCode)) + } + if params != nil && params.AreaCodeGeomatch != nil { + data.Set("AreaCodeGeomatch", fmt.Sprint(*params.AreaCodeGeomatch)) + } + if params != nil && params.ValidityPeriod != nil { + data.Set("ValidityPeriod", fmt.Sprint(*params.ValidityPeriod)) + } + if params != nil && params.SynchronousValidation != nil { + data.Set("SynchronousValidation", fmt.Sprint(*params.SynchronousValidation)) + } + if params != nil && params.Usecase != nil { + data.Set("Usecase", *params.Usecase) + } + if params != nil && params.UseInboundWebhookOnNumber != nil { + data.Set("UseInboundWebhookOnNumber", fmt.Sprint(*params.UseInboundWebhookOnNumber)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// +func (c *ApiService) FetchService(Sid string, ) (*MessagingV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -324,6 +330,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan MessagingV1S return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan MessagingV1Service, errorChannel chan error) { curRecord := 1 @@ -355,192 +362,194 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. - InboundRequestUrl *string `json:"InboundRequestUrl,omitempty"` - // The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. - InboundMethod *string `json:"InboundMethod,omitempty"` - // The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. - FallbackUrl *string `json:"FallbackUrl,omitempty"` - // The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. - FallbackMethod *string `json:"FallbackMethod,omitempty"` - // The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. - StatusCallback *string `json:"StatusCallback,omitempty"` - // Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. - StickySender *bool `json:"StickySender,omitempty"` - // Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. - MmsConverter *bool `json:"MmsConverter,omitempty"` - // Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. - SmartEncoding *bool `json:"SmartEncoding,omitempty"` - // - ScanMessageContent *string `json:"ScanMessageContent,omitempty"` - // [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. - FallbackToLongCode *bool `json:"FallbackToLongCode,omitempty"` - // Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. - AreaCodeGeomatch *bool `json:"AreaCodeGeomatch,omitempty"` - // How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. - ValidityPeriod *int `json:"ValidityPeriod,omitempty"` - // Reserved. - SynchronousValidation *bool `json:"SynchronousValidation,omitempty"` - // A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. - Usecase *string `json:"Usecase,omitempty"` - // A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. - UseInboundWebhookOnNumber *bool `json:"UseInboundWebhookOnNumber,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetInboundRequestUrl(InboundRequestUrl string) *UpdateServiceParams { - params.InboundRequestUrl = &InboundRequestUrl - return params -} -func (params *UpdateServiceParams) SetInboundMethod(InboundMethod string) *UpdateServiceParams { - params.InboundMethod = &InboundMethod - return params -} -func (params *UpdateServiceParams) SetFallbackUrl(FallbackUrl string) *UpdateServiceParams { - params.FallbackUrl = &FallbackUrl - return params -} -func (params *UpdateServiceParams) SetFallbackMethod(FallbackMethod string) *UpdateServiceParams { - params.FallbackMethod = &FallbackMethod - return params -} -func (params *UpdateServiceParams) SetStatusCallback(StatusCallback string) *UpdateServiceParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *UpdateServiceParams) SetStickySender(StickySender bool) *UpdateServiceParams { - params.StickySender = &StickySender - return params -} -func (params *UpdateServiceParams) SetMmsConverter(MmsConverter bool) *UpdateServiceParams { - params.MmsConverter = &MmsConverter - return params -} -func (params *UpdateServiceParams) SetSmartEncoding(SmartEncoding bool) *UpdateServiceParams { - params.SmartEncoding = &SmartEncoding - return params -} -func (params *UpdateServiceParams) SetScanMessageContent(ScanMessageContent string) *UpdateServiceParams { - params.ScanMessageContent = &ScanMessageContent - return params -} -func (params *UpdateServiceParams) SetFallbackToLongCode(FallbackToLongCode bool) *UpdateServiceParams { - params.FallbackToLongCode = &FallbackToLongCode - return params -} -func (params *UpdateServiceParams) SetAreaCodeGeomatch(AreaCodeGeomatch bool) *UpdateServiceParams { - params.AreaCodeGeomatch = &AreaCodeGeomatch - return params -} -func (params *UpdateServiceParams) SetValidityPeriod(ValidityPeriod int) *UpdateServiceParams { - params.ValidityPeriod = &ValidityPeriod - return params -} -func (params *UpdateServiceParams) SetSynchronousValidation(SynchronousValidation bool) *UpdateServiceParams { - params.SynchronousValidation = &SynchronousValidation - return params -} -func (params *UpdateServiceParams) SetUsecase(Usecase string) *UpdateServiceParams { - params.Usecase = &Usecase - return params -} -func (params *UpdateServiceParams) SetUseInboundWebhookOnNumber(UseInboundWebhookOnNumber bool) *UpdateServiceParams { - params.UseInboundWebhookOnNumber = &UseInboundWebhookOnNumber - return params -} - -// + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. + InboundRequestUrl *string `json:"InboundRequestUrl,omitempty"` + // The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. + InboundMethod *string `json:"InboundMethod,omitempty"` + // The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. + FallbackUrl *string `json:"FallbackUrl,omitempty"` + // The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. + FallbackMethod *string `json:"FallbackMethod,omitempty"` + // The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. + StatusCallback *string `json:"StatusCallback,omitempty"` + // Whether to enable [Sticky Sender](https://www.twilio.com/docs/messaging/services#sticky-sender) on the Service instance. + StickySender *bool `json:"StickySender,omitempty"` + // Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance. + MmsConverter *bool `json:"MmsConverter,omitempty"` + // Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance. + SmartEncoding *bool `json:"SmartEncoding,omitempty"` + // + ScanMessageContent *string `json:"ScanMessageContent,omitempty"` + // [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures. + FallbackToLongCode *bool `json:"FallbackToLongCode,omitempty"` + // Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance. + AreaCodeGeomatch *bool `json:"AreaCodeGeomatch,omitempty"` + // How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + ValidityPeriod *int `json:"ValidityPeriod,omitempty"` + // Reserved. + SynchronousValidation *bool `json:"SynchronousValidation,omitempty"` + // A string that describes the scenario in which the Messaging Service will be used. Possible values are `notifications`, `marketing`, `verification`, `discussion`, `poll`, `undeclared`. + Usecase *string `json:"Usecase,omitempty"` + // A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. + UseInboundWebhookOnNumber *bool `json:"UseInboundWebhookOnNumber,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetInboundRequestUrl(InboundRequestUrl string) (*UpdateServiceParams){ + params.InboundRequestUrl = &InboundRequestUrl + return params +} +func (params *UpdateServiceParams) SetInboundMethod(InboundMethod string) (*UpdateServiceParams){ + params.InboundMethod = &InboundMethod + return params +} +func (params *UpdateServiceParams) SetFallbackUrl(FallbackUrl string) (*UpdateServiceParams){ + params.FallbackUrl = &FallbackUrl + return params +} +func (params *UpdateServiceParams) SetFallbackMethod(FallbackMethod string) (*UpdateServiceParams){ + params.FallbackMethod = &FallbackMethod + return params +} +func (params *UpdateServiceParams) SetStatusCallback(StatusCallback string) (*UpdateServiceParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *UpdateServiceParams) SetStickySender(StickySender bool) (*UpdateServiceParams){ + params.StickySender = &StickySender + return params +} +func (params *UpdateServiceParams) SetMmsConverter(MmsConverter bool) (*UpdateServiceParams){ + params.MmsConverter = &MmsConverter + return params +} +func (params *UpdateServiceParams) SetSmartEncoding(SmartEncoding bool) (*UpdateServiceParams){ + params.SmartEncoding = &SmartEncoding + return params +} +func (params *UpdateServiceParams) SetScanMessageContent(ScanMessageContent string) (*UpdateServiceParams){ + params.ScanMessageContent = &ScanMessageContent + return params +} +func (params *UpdateServiceParams) SetFallbackToLongCode(FallbackToLongCode bool) (*UpdateServiceParams){ + params.FallbackToLongCode = &FallbackToLongCode + return params +} +func (params *UpdateServiceParams) SetAreaCodeGeomatch(AreaCodeGeomatch bool) (*UpdateServiceParams){ + params.AreaCodeGeomatch = &AreaCodeGeomatch + return params +} +func (params *UpdateServiceParams) SetValidityPeriod(ValidityPeriod int) (*UpdateServiceParams){ + params.ValidityPeriod = &ValidityPeriod + return params +} +func (params *UpdateServiceParams) SetSynchronousValidation(SynchronousValidation bool) (*UpdateServiceParams){ + params.SynchronousValidation = &SynchronousValidation + return params +} +func (params *UpdateServiceParams) SetUsecase(Usecase string) (*UpdateServiceParams){ + params.Usecase = &Usecase + return params +} +func (params *UpdateServiceParams) SetUseInboundWebhookOnNumber(UseInboundWebhookOnNumber bool) (*UpdateServiceParams){ + params.UseInboundWebhookOnNumber = &UseInboundWebhookOnNumber + return params +} + +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*MessagingV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.InboundRequestUrl != nil { - data.Set("InboundRequestUrl", *params.InboundRequestUrl) - } - if params != nil && params.InboundMethod != nil { - data.Set("InboundMethod", *params.InboundMethod) - } - if params != nil && params.FallbackUrl != nil { - data.Set("FallbackUrl", *params.FallbackUrl) - } - if params != nil && params.FallbackMethod != nil { - data.Set("FallbackMethod", *params.FallbackMethod) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StickySender != nil { - data.Set("StickySender", fmt.Sprint(*params.StickySender)) - } - if params != nil && params.MmsConverter != nil { - data.Set("MmsConverter", fmt.Sprint(*params.MmsConverter)) - } - if params != nil && params.SmartEncoding != nil { - data.Set("SmartEncoding", fmt.Sprint(*params.SmartEncoding)) - } - if params != nil && params.ScanMessageContent != nil { - data.Set("ScanMessageContent", *params.ScanMessageContent) - } - if params != nil && params.FallbackToLongCode != nil { - data.Set("FallbackToLongCode", fmt.Sprint(*params.FallbackToLongCode)) - } - if params != nil && params.AreaCodeGeomatch != nil { - data.Set("AreaCodeGeomatch", fmt.Sprint(*params.AreaCodeGeomatch)) - } - if params != nil && params.ValidityPeriod != nil { - data.Set("ValidityPeriod", fmt.Sprint(*params.ValidityPeriod)) - } - if params != nil && params.SynchronousValidation != nil { - data.Set("SynchronousValidation", fmt.Sprint(*params.SynchronousValidation)) - } - if params != nil && params.Usecase != nil { - data.Set("Usecase", *params.Usecase) - } - if params != nil && params.UseInboundWebhookOnNumber != nil { - data.Set("UseInboundWebhookOnNumber", fmt.Sprint(*params.UseInboundWebhookOnNumber)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.InboundRequestUrl != nil { + data.Set("InboundRequestUrl", *params.InboundRequestUrl) + } + if params != nil && params.InboundMethod != nil { + data.Set("InboundMethod", *params.InboundMethod) + } + if params != nil && params.FallbackUrl != nil { + data.Set("FallbackUrl", *params.FallbackUrl) + } + if params != nil && params.FallbackMethod != nil { + data.Set("FallbackMethod", *params.FallbackMethod) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StickySender != nil { + data.Set("StickySender", fmt.Sprint(*params.StickySender)) + } + if params != nil && params.MmsConverter != nil { + data.Set("MmsConverter", fmt.Sprint(*params.MmsConverter)) + } + if params != nil && params.SmartEncoding != nil { + data.Set("SmartEncoding", fmt.Sprint(*params.SmartEncoding)) + } + if params != nil && params.ScanMessageContent != nil { + data.Set("ScanMessageContent", *params.ScanMessageContent) + } + if params != nil && params.FallbackToLongCode != nil { + data.Set("FallbackToLongCode", fmt.Sprint(*params.FallbackToLongCode)) + } + if params != nil && params.AreaCodeGeomatch != nil { + data.Set("AreaCodeGeomatch", fmt.Sprint(*params.AreaCodeGeomatch)) + } + if params != nil && params.ValidityPeriod != nil { + data.Set("ValidityPeriod", fmt.Sprint(*params.ValidityPeriod)) + } + if params != nil && params.SynchronousValidation != nil { + data.Set("SynchronousValidation", fmt.Sprint(*params.SynchronousValidation)) + } + if params != nil && params.Usecase != nil { + data.Set("Usecase", *params.Usecase) + } + if params != nil && params.UseInboundWebhookOnNumber != nil { + data.Set("UseInboundWebhookOnNumber", fmt.Sprint(*params.UseInboundWebhookOnNumber)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/messaging/v1/services_alpha_senders.go b/rest/messaging/v1/services_alpha_senders.go index c8a5639cb..10619661c 100644 --- a/rest/messaging/v1/services_alpha_senders.go +++ b/rest/messaging/v1/services_alpha_senders.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAlphaSender' type CreateAlphaSenderParams struct { - // The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. - AlphaSender *string `json:"AlphaSender,omitempty"` + // The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers. + AlphaSender *string `json:"AlphaSender,omitempty"` } -func (params *CreateAlphaSenderParams) SetAlphaSender(AlphaSender string) *CreateAlphaSenderParams { - params.AlphaSender = &AlphaSender - return params +func (params *CreateAlphaSenderParams) SetAlphaSender(AlphaSender string) (*CreateAlphaSenderParams){ + params.AlphaSender = &AlphaSender + return params } -// +// func (c *ApiService) CreateAlphaSender(ServiceSid string, params *CreateAlphaSenderParams) (*MessagingV1AlphaSender, error) { - path := "/v1/Services/{ServiceSid}/AlphaSenders" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/AlphaSenders" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AlphaSender != nil { - data.Set("AlphaSender", *params.AlphaSender) - } + if params != nil && params.AlphaSender != nil { + data.Set("AlphaSender", *params.AlphaSender) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MessagingV1AlphaSender{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MessagingV1AlphaSender{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteAlphaSender(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/AlphaSenders/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteAlphaSender(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/AlphaSenders/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchAlphaSender(ServiceSid string, Sid string) (*MessagingV1AlphaSender, error) { - path := "/v1/Services/{ServiceSid}/AlphaSenders/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchAlphaSender(ServiceSid string, Sid string, ) (*MessagingV1AlphaSender, error) { + path := "/v1/Services/{ServiceSid}/AlphaSenders/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MessagingV1AlphaSender{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1AlphaSender{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListAlphaSender' type ListAlphaSenderParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAlphaSenderParams) SetPageSize(PageSize int) *ListAlphaSenderParams { - params.PageSize = &PageSize - return params +func (params *ListAlphaSenderParams) SetPageSize(PageSize int) (*ListAlphaSenderParams){ + params.PageSize = &PageSize + return params } -func (params *ListAlphaSenderParams) SetLimit(Limit int) *ListAlphaSenderParams { - params.Limit = &Limit - return params +func (params *ListAlphaSenderParams) SetLimit(Limit int) (*ListAlphaSenderParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AlphaSender records from the API. Request is executed immediately. func (c *ApiService) PageAlphaSender(ServiceSid string, params *ListAlphaSenderParams, pageToken, pageNumber string) (*ListAlphaSenderResponse, error) { - path := "/v1/Services/{ServiceSid}/AlphaSenders" + path := "/v1/Services/{ServiceSid}/AlphaSenders" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAlphaSenderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAlphaSenderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AlphaSender records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamAlphaSender(ServiceSid string, params *ListAlphaSende return recordChannel, errorChannel } + func (c *ApiService) streamAlphaSender(response *ListAlphaSenderResponse, params *ListAlphaSenderParams, recordChannel chan MessagingV1AlphaSender, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamAlphaSender(response *ListAlphaSenderResponse, params } func (c *ApiService) getNextListAlphaSenderResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAlphaSenderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAlphaSenderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/messaging/v1/services_channel_senders.go b/rest/messaging/v1/services_channel_senders.go index 27408c83d..8c96ec585 100644 --- a/rest/messaging/v1/services_channel_senders.go +++ b/rest/messaging/v1/services_channel_senders.go @@ -18,85 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchChannelSender(MessagingServiceSid string, Sid string) (*MessagingV1ChannelSender, error) { - path := "/v1/Services/{MessagingServiceSid}/ChannelSenders/{Sid}" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchChannelSender(MessagingServiceSid string, Sid string, ) (*MessagingV1ChannelSender, error) { + path := "/v1/Services/{MessagingServiceSid}/ChannelSenders/{Sid}" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &MessagingV1ChannelSender{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1ChannelSender{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListChannelSender' type ListChannelSenderParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChannelSenderParams) SetPageSize(PageSize int) *ListChannelSenderParams { - params.PageSize = &PageSize - return params +func (params *ListChannelSenderParams) SetPageSize(PageSize int) (*ListChannelSenderParams){ + params.PageSize = &PageSize + return params } -func (params *ListChannelSenderParams) SetLimit(Limit int) *ListChannelSenderParams { - params.Limit = &Limit - return params +func (params *ListChannelSenderParams) SetLimit(Limit int) (*ListChannelSenderParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ChannelSender records from the API. Request is executed immediately. func (c *ApiService) PageChannelSender(MessagingServiceSid string, params *ListChannelSenderParams, pageToken, pageNumber string) (*ListChannelSenderResponse, error) { - path := "/v1/Services/{MessagingServiceSid}/ChannelSenders" + path := "/v1/Services/{MessagingServiceSid}/ChannelSenders" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListChannelSenderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListChannelSenderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ChannelSender records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -137,6 +139,7 @@ func (c *ApiService) StreamChannelSender(MessagingServiceSid string, params *Lis return recordChannel, errorChannel } + func (c *ApiService) streamChannelSender(response *ListChannelSenderResponse, params *ListChannelSenderParams, recordChannel chan MessagingV1ChannelSender, errorChannel chan error) { curRecord := 1 @@ -168,19 +171,20 @@ func (c *ApiService) streamChannelSender(response *ListChannelSenderResponse, pa } func (c *ApiService) getNextListChannelSenderResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChannelSenderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChannelSenderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/messaging/v1/services_compliance_usa2p.go b/rest/messaging/v1/services_compliance_usa2p.go index 5f71d6804..10185f907 100644 --- a/rest/messaging/v1/services_compliance_usa2p.go +++ b/rest/messaging/v1/services_compliance_usa2p.go @@ -18,258 +18,263 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateUsAppToPerson' type CreateUsAppToPersonParams struct { - // A2P Brand Registration SID - BrandRegistrationSid *string `json:"BrandRegistrationSid,omitempty"` - // A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. - Description *string `json:"Description,omitempty"` - // Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. - MessageFlow *string `json:"MessageFlow,omitempty"` - // An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars. - MessageSamples *[]string `json:"MessageSamples,omitempty"` - // A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] - UsAppToPersonUsecase *string `json:"UsAppToPersonUsecase,omitempty"` - // Indicates that this SMS campaign will send messages that contain links. - HasEmbeddedLinks *bool `json:"HasEmbeddedLinks,omitempty"` - // Indicates that this SMS campaign will send messages that contain phone numbers. - HasEmbeddedPhone *bool `json:"HasEmbeddedPhone,omitempty"` - // If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. - OptInMessage *string `json:"OptInMessage,omitempty"` - // Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. - OptOutMessage *string `json:"OptOutMessage,omitempty"` - // When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. - HelpMessage *string `json:"HelpMessage,omitempty"` - // If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. - OptInKeywords *[]string `json:"OptInKeywords,omitempty"` - // End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. - OptOutKeywords *[]string `json:"OptOutKeywords,omitempty"` - // End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. - HelpKeywords *[]string `json:"HelpKeywords,omitempty"` + // A2P Brand Registration SID + BrandRegistrationSid *string `json:"BrandRegistrationSid,omitempty"` + // A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + Description *string `json:"Description,omitempty"` + // Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + MessageFlow *string `json:"MessageFlow,omitempty"` + // Message samples, at least 1 and up to 5 sample messages (at least 2 for sole proprietor), >=20 chars, <=1024 chars each. + MessageSamples *[]string `json:"MessageSamples,omitempty"` + // A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..] + UsAppToPersonUsecase *string `json:"UsAppToPersonUsecase,omitempty"` + // Indicates that this SMS campaign will send messages that contain links. + HasEmbeddedLinks *bool `json:"HasEmbeddedLinks,omitempty"` + // Indicates that this SMS campaign will send messages that contain phone numbers. + HasEmbeddedPhone *bool `json:"HasEmbeddedPhone,omitempty"` + // If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. + OptInMessage *string `json:"OptInMessage,omitempty"` + // Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. + OptOutMessage *string `json:"OptOutMessage,omitempty"` + // When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. + HelpMessage *string `json:"HelpMessage,omitempty"` + // If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. + OptInKeywords *[]string `json:"OptInKeywords,omitempty"` + // End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + OptOutKeywords *[]string `json:"OptOutKeywords,omitempty"` + // End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + HelpKeywords *[]string `json:"HelpKeywords,omitempty"` } -func (params *CreateUsAppToPersonParams) SetBrandRegistrationSid(BrandRegistrationSid string) *CreateUsAppToPersonParams { - params.BrandRegistrationSid = &BrandRegistrationSid - return params +func (params *CreateUsAppToPersonParams) SetBrandRegistrationSid(BrandRegistrationSid string) (*CreateUsAppToPersonParams){ + params.BrandRegistrationSid = &BrandRegistrationSid + return params } -func (params *CreateUsAppToPersonParams) SetDescription(Description string) *CreateUsAppToPersonParams { - params.Description = &Description - return params +func (params *CreateUsAppToPersonParams) SetDescription(Description string) (*CreateUsAppToPersonParams){ + params.Description = &Description + return params } -func (params *CreateUsAppToPersonParams) SetMessageFlow(MessageFlow string) *CreateUsAppToPersonParams { - params.MessageFlow = &MessageFlow - return params +func (params *CreateUsAppToPersonParams) SetMessageFlow(MessageFlow string) (*CreateUsAppToPersonParams){ + params.MessageFlow = &MessageFlow + return params } -func (params *CreateUsAppToPersonParams) SetMessageSamples(MessageSamples []string) *CreateUsAppToPersonParams { - params.MessageSamples = &MessageSamples - return params +func (params *CreateUsAppToPersonParams) SetMessageSamples(MessageSamples []string) (*CreateUsAppToPersonParams){ + params.MessageSamples = &MessageSamples + return params } -func (params *CreateUsAppToPersonParams) SetUsAppToPersonUsecase(UsAppToPersonUsecase string) *CreateUsAppToPersonParams { - params.UsAppToPersonUsecase = &UsAppToPersonUsecase - return params +func (params *CreateUsAppToPersonParams) SetUsAppToPersonUsecase(UsAppToPersonUsecase string) (*CreateUsAppToPersonParams){ + params.UsAppToPersonUsecase = &UsAppToPersonUsecase + return params } -func (params *CreateUsAppToPersonParams) SetHasEmbeddedLinks(HasEmbeddedLinks bool) *CreateUsAppToPersonParams { - params.HasEmbeddedLinks = &HasEmbeddedLinks - return params +func (params *CreateUsAppToPersonParams) SetHasEmbeddedLinks(HasEmbeddedLinks bool) (*CreateUsAppToPersonParams){ + params.HasEmbeddedLinks = &HasEmbeddedLinks + return params } -func (params *CreateUsAppToPersonParams) SetHasEmbeddedPhone(HasEmbeddedPhone bool) *CreateUsAppToPersonParams { - params.HasEmbeddedPhone = &HasEmbeddedPhone - return params +func (params *CreateUsAppToPersonParams) SetHasEmbeddedPhone(HasEmbeddedPhone bool) (*CreateUsAppToPersonParams){ + params.HasEmbeddedPhone = &HasEmbeddedPhone + return params } -func (params *CreateUsAppToPersonParams) SetOptInMessage(OptInMessage string) *CreateUsAppToPersonParams { - params.OptInMessage = &OptInMessage - return params +func (params *CreateUsAppToPersonParams) SetOptInMessage(OptInMessage string) (*CreateUsAppToPersonParams){ + params.OptInMessage = &OptInMessage + return params } -func (params *CreateUsAppToPersonParams) SetOptOutMessage(OptOutMessage string) *CreateUsAppToPersonParams { - params.OptOutMessage = &OptOutMessage - return params +func (params *CreateUsAppToPersonParams) SetOptOutMessage(OptOutMessage string) (*CreateUsAppToPersonParams){ + params.OptOutMessage = &OptOutMessage + return params } -func (params *CreateUsAppToPersonParams) SetHelpMessage(HelpMessage string) *CreateUsAppToPersonParams { - params.HelpMessage = &HelpMessage - return params +func (params *CreateUsAppToPersonParams) SetHelpMessage(HelpMessage string) (*CreateUsAppToPersonParams){ + params.HelpMessage = &HelpMessage + return params } -func (params *CreateUsAppToPersonParams) SetOptInKeywords(OptInKeywords []string) *CreateUsAppToPersonParams { - params.OptInKeywords = &OptInKeywords - return params +func (params *CreateUsAppToPersonParams) SetOptInKeywords(OptInKeywords []string) (*CreateUsAppToPersonParams){ + params.OptInKeywords = &OptInKeywords + return params } -func (params *CreateUsAppToPersonParams) SetOptOutKeywords(OptOutKeywords []string) *CreateUsAppToPersonParams { - params.OptOutKeywords = &OptOutKeywords - return params +func (params *CreateUsAppToPersonParams) SetOptOutKeywords(OptOutKeywords []string) (*CreateUsAppToPersonParams){ + params.OptOutKeywords = &OptOutKeywords + return params } -func (params *CreateUsAppToPersonParams) SetHelpKeywords(HelpKeywords []string) *CreateUsAppToPersonParams { - params.HelpKeywords = &HelpKeywords - return params +func (params *CreateUsAppToPersonParams) SetHelpKeywords(HelpKeywords []string) (*CreateUsAppToPersonParams){ + params.HelpKeywords = &HelpKeywords + return params } -// +// func (c *ApiService) CreateUsAppToPerson(MessagingServiceSid string, params *CreateUsAppToPersonParams) (*MessagingV1UsAppToPerson, error) { - path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BrandRegistrationSid != nil { - data.Set("BrandRegistrationSid", *params.BrandRegistrationSid) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } - if params != nil && params.MessageFlow != nil { - data.Set("MessageFlow", *params.MessageFlow) - } - if params != nil && params.MessageSamples != nil { - for _, item := range *params.MessageSamples { - data.Add("MessageSamples", item) - } - } - if params != nil && params.UsAppToPersonUsecase != nil { - data.Set("UsAppToPersonUsecase", *params.UsAppToPersonUsecase) - } - if params != nil && params.HasEmbeddedLinks != nil { - data.Set("HasEmbeddedLinks", fmt.Sprint(*params.HasEmbeddedLinks)) - } - if params != nil && params.HasEmbeddedPhone != nil { - data.Set("HasEmbeddedPhone", fmt.Sprint(*params.HasEmbeddedPhone)) - } - if params != nil && params.OptInMessage != nil { - data.Set("OptInMessage", *params.OptInMessage) - } - if params != nil && params.OptOutMessage != nil { - data.Set("OptOutMessage", *params.OptOutMessage) - } - if params != nil && params.HelpMessage != nil { - data.Set("HelpMessage", *params.HelpMessage) - } - if params != nil && params.OptInKeywords != nil { - for _, item := range *params.OptInKeywords { - data.Add("OptInKeywords", item) - } - } - if params != nil && params.OptOutKeywords != nil { - for _, item := range *params.OptOutKeywords { - data.Add("OptOutKeywords", item) - } - } - if params != nil && params.HelpKeywords != nil { - for _, item := range *params.HelpKeywords { - data.Add("HelpKeywords", item) - } - } + path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BrandRegistrationSid != nil { + data.Set("BrandRegistrationSid", *params.BrandRegistrationSid) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } + if params != nil && params.MessageFlow != nil { + data.Set("MessageFlow", *params.MessageFlow) + } + if params != nil && params.MessageSamples != nil { + for _, item := range *params.MessageSamples { + data.Add("MessageSamples", item) + } + } + if params != nil && params.UsAppToPersonUsecase != nil { + data.Set("UsAppToPersonUsecase", *params.UsAppToPersonUsecase) + } + if params != nil && params.HasEmbeddedLinks != nil { + data.Set("HasEmbeddedLinks", fmt.Sprint(*params.HasEmbeddedLinks)) + } + if params != nil && params.HasEmbeddedPhone != nil { + data.Set("HasEmbeddedPhone", fmt.Sprint(*params.HasEmbeddedPhone)) + } + if params != nil && params.OptInMessage != nil { + data.Set("OptInMessage", *params.OptInMessage) + } + if params != nil && params.OptOutMessage != nil { + data.Set("OptOutMessage", *params.OptOutMessage) + } + if params != nil && params.HelpMessage != nil { + data.Set("HelpMessage", *params.HelpMessage) + } + if params != nil && params.OptInKeywords != nil { + for _, item := range *params.OptInKeywords { + data.Add("OptInKeywords", item) + } + } + if params != nil && params.OptOutKeywords != nil { + for _, item := range *params.OptOutKeywords { + data.Add("OptOutKeywords", item) + } + } + if params != nil && params.HelpKeywords != nil { + for _, item := range *params.HelpKeywords { + data.Add("HelpKeywords", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1UsAppToPerson{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteUsAppToPerson(MessagingServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p/{Sid}" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &MessagingV1UsAppToPerson{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteUsAppToPerson(MessagingServiceSid string, Sid string) error { - path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p/{Sid}" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchUsAppToPerson(MessagingServiceSid string, Sid string, ) (*MessagingV1UsAppToPerson, error) { + path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p/{Sid}" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchUsAppToPerson(MessagingServiceSid string, Sid string) (*MessagingV1UsAppToPerson, error) { - path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p/{Sid}" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1UsAppToPerson{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1UsAppToPerson{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListUsAppToPerson' type ListUsAppToPersonParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsAppToPersonParams) SetPageSize(PageSize int) *ListUsAppToPersonParams { - params.PageSize = &PageSize - return params +func (params *ListUsAppToPersonParams) SetPageSize(PageSize int) (*ListUsAppToPersonParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsAppToPersonParams) SetLimit(Limit int) *ListUsAppToPersonParams { - params.Limit = &Limit - return params +func (params *ListUsAppToPersonParams) SetLimit(Limit int) (*ListUsAppToPersonParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsAppToPerson records from the API. Request is executed immediately. func (c *ApiService) PageUsAppToPerson(MessagingServiceSid string, params *ListUsAppToPersonParams, pageToken, pageNumber string) (*ListUsAppToPersonResponse, error) { - path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p" + path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUsAppToPersonResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListUsAppToPersonResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists UsAppToPerson records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -310,6 +315,7 @@ func (c *ApiService) StreamUsAppToPerson(MessagingServiceSid string, params *Lis return recordChannel, errorChannel } + func (c *ApiService) streamUsAppToPerson(response *ListUsAppToPersonResponse, params *ListUsAppToPersonParams, recordChannel chan MessagingV1UsAppToPerson, errorChannel chan error) { curRecord := 1 @@ -341,19 +347,20 @@ func (c *ApiService) streamUsAppToPerson(response *ListUsAppToPersonResponse, pa } func (c *ApiService) getNextListUsAppToPersonResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsAppToPersonResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUsAppToPersonResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/messaging/v1/services_compliance_usa2p_usecases.go b/rest/messaging/v1/services_compliance_usa2p_usecases.go index 93a7586c0..bd12e045d 100644 --- a/rest/messaging/v1/services_compliance_usa2p_usecases.go +++ b/rest/messaging/v1/services_compliance_usa2p_usecases.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchUsAppToPersonUsecase' type FetchUsAppToPersonUsecaseParams struct { - // The unique string to identify the A2P brand. - BrandRegistrationSid *string `json:"BrandRegistrationSid,omitempty"` + // The unique string to identify the A2P brand. + BrandRegistrationSid *string `json:"BrandRegistrationSid,omitempty"` } -func (params *FetchUsAppToPersonUsecaseParams) SetBrandRegistrationSid(BrandRegistrationSid string) *FetchUsAppToPersonUsecaseParams { - params.BrandRegistrationSid = &BrandRegistrationSid - return params +func (params *FetchUsAppToPersonUsecaseParams) SetBrandRegistrationSid(BrandRegistrationSid string) (*FetchUsAppToPersonUsecaseParams){ + params.BrandRegistrationSid = &BrandRegistrationSid + return params } -// +// func (c *ApiService) FetchUsAppToPersonUsecase(MessagingServiceSid string, params *FetchUsAppToPersonUsecaseParams) (*MessagingV1UsAppToPersonUsecase, error) { - path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p/Usecases" - path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + path := "/v1/Services/{MessagingServiceSid}/Compliance/Usa2p/Usecases" + path = strings.Replace(path, "{"+"MessagingServiceSid"+"}", MessagingServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.BrandRegistrationSid != nil { + data.Set("BrandRegistrationSid", *params.BrandRegistrationSid) + } - if params != nil && params.BrandRegistrationSid != nil { - data.Set("BrandRegistrationSid", *params.BrandRegistrationSid) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1UsAppToPersonUsecase{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1UsAppToPersonUsecase{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/services_phone_numbers.go b/rest/messaging/v1/services_phone_numbers.go index 1f2f48fbb..61f86c588 100644 --- a/rest/messaging/v1/services_phone_numbers.go +++ b/rest/messaging/v1/services_phone_numbers.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePhoneNumber' type CreatePhoneNumberParams struct { - // The SID of the Phone Number being added to the Service. - PhoneNumberSid *string `json:"PhoneNumberSid,omitempty"` + // The SID of the Phone Number being added to the Service. + PhoneNumberSid *string `json:"PhoneNumberSid,omitempty"` } -func (params *CreatePhoneNumberParams) SetPhoneNumberSid(PhoneNumberSid string) *CreatePhoneNumberParams { - params.PhoneNumberSid = &PhoneNumberSid - return params +func (params *CreatePhoneNumberParams) SetPhoneNumberSid(PhoneNumberSid string) (*CreatePhoneNumberParams){ + params.PhoneNumberSid = &PhoneNumberSid + return params } -// +// func (c *ApiService) CreatePhoneNumber(ServiceSid string, params *CreatePhoneNumberParams) (*MessagingV1PhoneNumber, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/PhoneNumbers" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PhoneNumberSid != nil { - data.Set("PhoneNumberSid", *params.PhoneNumberSid) - } + if params != nil && params.PhoneNumberSid != nil { + data.Set("PhoneNumberSid", *params.PhoneNumberSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MessagingV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MessagingV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeletePhoneNumber(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeletePhoneNumber(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchPhoneNumber(ServiceSid string, Sid string) (*MessagingV1PhoneNumber, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchPhoneNumber(ServiceSid string, Sid string, ) (*MessagingV1PhoneNumber, error) { + path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MessagingV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListPhoneNumber' type ListPhoneNumberParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListPhoneNumberParams) SetPageSize(PageSize int) *ListPhoneNumberParams { - params.PageSize = &PageSize - return params +func (params *ListPhoneNumberParams) SetPageSize(PageSize int) (*ListPhoneNumberParams){ + params.PageSize = &PageSize + return params } -func (params *ListPhoneNumberParams) SetLimit(Limit int) *ListPhoneNumberParams { - params.Limit = &Limit - return params +func (params *ListPhoneNumberParams) SetLimit(Limit int) (*ListPhoneNumberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of PhoneNumber records from the API. Request is executed immediately. func (c *ApiService) PagePhoneNumber(ServiceSid string, params *ListPhoneNumberParams, pageToken, pageNumber string) (*ListPhoneNumberResponse, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers" + path := "/v1/Services/{ServiceSid}/PhoneNumbers" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListPhoneNumberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists PhoneNumber records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamPhoneNumber(ServiceSid string, params *ListPhoneNumbe return recordChannel, errorChannel } + func (c *ApiService) streamPhoneNumber(response *ListPhoneNumberResponse, params *ListPhoneNumberParams, recordChannel chan MessagingV1PhoneNumber, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamPhoneNumber(response *ListPhoneNumberResponse, params } func (c *ApiService) getNextListPhoneNumberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPhoneNumberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/messaging/v1/services_preregistered_usa2p.go b/rest/messaging/v1/services_preregistered_usa2p.go index f188b45af..8cb1e40e0 100644 --- a/rest/messaging/v1/services_preregistered_usa2p.go +++ b/rest/messaging/v1/services_preregistered_usa2p.go @@ -16,51 +16,56 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateExternalCampaign' type CreateExternalCampaignParams struct { - // ID of the preregistered campaign. - CampaignId *string `json:"CampaignId,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // ID of the preregistered campaign. + CampaignId *string `json:"CampaignId,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` } -func (params *CreateExternalCampaignParams) SetCampaignId(CampaignId string) *CreateExternalCampaignParams { - params.CampaignId = &CampaignId - return params +func (params *CreateExternalCampaignParams) SetCampaignId(CampaignId string) (*CreateExternalCampaignParams){ + params.CampaignId = &CampaignId + return params } -func (params *CreateExternalCampaignParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateExternalCampaignParams { - params.MessagingServiceSid = &MessagingServiceSid - return params +func (params *CreateExternalCampaignParams) SetMessagingServiceSid(MessagingServiceSid string) (*CreateExternalCampaignParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params } -// +// func (c *ApiService) CreateExternalCampaign(params *CreateExternalCampaignParams) (*MessagingV1ExternalCampaign, error) { - path := "/v1/Services/PreregisteredUsa2p" + path := "/v1/Services/PreregisteredUsa2p" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.CampaignId != nil { + data.Set("CampaignId", *params.CampaignId) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } - if params != nil && params.CampaignId != nil { - data.Set("CampaignId", *params.CampaignId) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1ExternalCampaign{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1ExternalCampaign{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/services_short_codes.go b/rest/messaging/v1/services_short_codes.go index 19745e3d4..95de239f7 100644 --- a/rest/messaging/v1/services_short_codes.go +++ b/rest/messaging/v1/services_short_codes.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateShortCode' type CreateShortCodeParams struct { - // The SID of the ShortCode resource being added to the Service. - ShortCodeSid *string `json:"ShortCodeSid,omitempty"` + // The SID of the ShortCode resource being added to the Service. + ShortCodeSid *string `json:"ShortCodeSid,omitempty"` } -func (params *CreateShortCodeParams) SetShortCodeSid(ShortCodeSid string) *CreateShortCodeParams { - params.ShortCodeSid = &ShortCodeSid - return params +func (params *CreateShortCodeParams) SetShortCodeSid(ShortCodeSid string) (*CreateShortCodeParams){ + params.ShortCodeSid = &ShortCodeSid + return params } -// +// func (c *ApiService) CreateShortCode(ServiceSid string, params *CreateShortCodeParams) (*MessagingV1ShortCode, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/ShortCodes" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ShortCodeSid != nil { - data.Set("ShortCodeSid", *params.ShortCodeSid) - } + if params != nil && params.ShortCodeSid != nil { + data.Set("ShortCodeSid", *params.ShortCodeSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MessagingV1ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MessagingV1ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteShortCode(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteShortCode(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchShortCode(ServiceSid string, Sid string) (*MessagingV1ShortCode, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchShortCode(ServiceSid string, Sid string, ) (*MessagingV1ShortCode, error) { + path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MessagingV1ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListShortCode' type ListShortCodeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListShortCodeParams) SetPageSize(PageSize int) *ListShortCodeParams { - params.PageSize = &PageSize - return params +func (params *ListShortCodeParams) SetPageSize(PageSize int) (*ListShortCodeParams){ + params.PageSize = &PageSize + return params } -func (params *ListShortCodeParams) SetLimit(Limit int) *ListShortCodeParams { - params.Limit = &Limit - return params +func (params *ListShortCodeParams) SetLimit(Limit int) (*ListShortCodeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ShortCode records from the API. Request is executed immediately. func (c *ApiService) PageShortCode(ServiceSid string, params *ListShortCodeParams, pageToken, pageNumber string) (*ListShortCodeResponse, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes" + path := "/v1/Services/{ServiceSid}/ShortCodes" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListShortCodeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListShortCodeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ShortCode records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamShortCode(ServiceSid string, params *ListShortCodePar return recordChannel, errorChannel } + func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *ListShortCodeParams, recordChannel chan MessagingV1ShortCode, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *Li } func (c *ApiService) getNextListShortCodeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListShortCodeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListShortCodeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/messaging/v1/services_usecases.go b/rest/messaging/v1/services_usecases.go index 6fd408723..70a25e6ba 100644 --- a/rest/messaging/v1/services_usecases.go +++ b/rest/messaging/v1/services_usecases.go @@ -16,27 +16,33 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) -// + +// func (c *ApiService) FetchUsecase() (*MessagingV1Usecase, error) { - path := "/v1/Services/Usecases" + path := "/v1/Services/Usecases" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MessagingV1Usecase{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MessagingV1Usecase{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/messaging/v1/tollfree_verifications.go b/rest/messaging/v1/tollfree_verifications.go index 11d0736dc..53283de16 100644 --- a/rest/messaging/v1/tollfree_verifications.go +++ b/rest/messaging/v1/tollfree_verifications.go @@ -18,357 +18,343 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTollfreeVerification' type CreateTollfreeVerificationParams struct { - // The name of the business or organization using the Tollfree number. - BusinessName *string `json:"BusinessName,omitempty"` - // The website of the business or organization using the Tollfree number. - BusinessWebsite *string `json:"BusinessWebsite,omitempty"` - // The email address to receive the notification about the verification result. . - NotificationEmail *string `json:"NotificationEmail,omitempty"` - // The category of the use case for the Tollfree Number. List as many are applicable.. - UseCaseCategories *[]string `json:"UseCaseCategories,omitempty"` - // Use this to further explain how messaging is used by the business or organization. - UseCaseSummary *string `json:"UseCaseSummary,omitempty"` - // An example of message content, i.e. a sample message. - ProductionMessageSample *string `json:"ProductionMessageSample,omitempty"` - // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. - OptInImageUrls *[]string `json:"OptInImageUrls,omitempty"` - // - OptInType *string `json:"OptInType,omitempty"` - // Estimate monthly volume of messages from the Tollfree Number. - MessageVolume *string `json:"MessageVolume,omitempty"` - // The SID of the Phone Number associated with the Tollfree Verification. - TollfreePhoneNumberSid *string `json:"TollfreePhoneNumberSid,omitempty"` - // Customer's Profile Bundle BundleSid. - CustomerProfileSid *string `json:"CustomerProfileSid,omitempty"` - // The address of the business or organization using the Tollfree number. - BusinessStreetAddress *string `json:"BusinessStreetAddress,omitempty"` - // The address of the business or organization using the Tollfree number. - BusinessStreetAddress2 *string `json:"BusinessStreetAddress2,omitempty"` - // The city of the business or organization using the Tollfree number. - BusinessCity *string `json:"BusinessCity,omitempty"` - // The state/province/region of the business or organization using the Tollfree number. - BusinessStateProvinceRegion *string `json:"BusinessStateProvinceRegion,omitempty"` - // The postal code of the business or organization using the Tollfree number. - BusinessPostalCode *string `json:"BusinessPostalCode,omitempty"` - // The country of the business or organization using the Tollfree number. - BusinessCountry *string `json:"BusinessCountry,omitempty"` - // Additional information to be provided for verification. - AdditionalInformation *string `json:"AdditionalInformation,omitempty"` - // The first name of the contact for the business or organization using the Tollfree number. - BusinessContactFirstName *string `json:"BusinessContactFirstName,omitempty"` - // The last name of the contact for the business or organization using the Tollfree number. - BusinessContactLastName *string `json:"BusinessContactLastName,omitempty"` - // The email address of the contact for the business or organization using the Tollfree number. - BusinessContactEmail *string `json:"BusinessContactEmail,omitempty"` - // The phone number of the contact for the business or organization using the Tollfree number. - BusinessContactPhone *string `json:"BusinessContactPhone,omitempty"` - // An optional external reference ID supplied by customer and echoed back on status retrieval. - ExternalReferenceId *string `json:"ExternalReferenceId,omitempty"` -} - -func (params *CreateTollfreeVerificationParams) SetBusinessName(BusinessName string) *CreateTollfreeVerificationParams { - params.BusinessName = &BusinessName - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessWebsite(BusinessWebsite string) *CreateTollfreeVerificationParams { - params.BusinessWebsite = &BusinessWebsite - return params -} -func (params *CreateTollfreeVerificationParams) SetNotificationEmail(NotificationEmail string) *CreateTollfreeVerificationParams { - params.NotificationEmail = &NotificationEmail - return params -} -func (params *CreateTollfreeVerificationParams) SetUseCaseCategories(UseCaseCategories []string) *CreateTollfreeVerificationParams { - params.UseCaseCategories = &UseCaseCategories - return params -} -func (params *CreateTollfreeVerificationParams) SetUseCaseSummary(UseCaseSummary string) *CreateTollfreeVerificationParams { - params.UseCaseSummary = &UseCaseSummary - return params -} -func (params *CreateTollfreeVerificationParams) SetProductionMessageSample(ProductionMessageSample string) *CreateTollfreeVerificationParams { - params.ProductionMessageSample = &ProductionMessageSample - return params -} -func (params *CreateTollfreeVerificationParams) SetOptInImageUrls(OptInImageUrls []string) *CreateTollfreeVerificationParams { - params.OptInImageUrls = &OptInImageUrls - return params -} -func (params *CreateTollfreeVerificationParams) SetOptInType(OptInType string) *CreateTollfreeVerificationParams { - params.OptInType = &OptInType - return params -} -func (params *CreateTollfreeVerificationParams) SetMessageVolume(MessageVolume string) *CreateTollfreeVerificationParams { - params.MessageVolume = &MessageVolume - return params -} -func (params *CreateTollfreeVerificationParams) SetTollfreePhoneNumberSid(TollfreePhoneNumberSid string) *CreateTollfreeVerificationParams { - params.TollfreePhoneNumberSid = &TollfreePhoneNumberSid - return params -} -func (params *CreateTollfreeVerificationParams) SetCustomerProfileSid(CustomerProfileSid string) *CreateTollfreeVerificationParams { - params.CustomerProfileSid = &CustomerProfileSid - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessStreetAddress(BusinessStreetAddress string) *CreateTollfreeVerificationParams { - params.BusinessStreetAddress = &BusinessStreetAddress - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessStreetAddress2(BusinessStreetAddress2 string) *CreateTollfreeVerificationParams { - params.BusinessStreetAddress2 = &BusinessStreetAddress2 - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessCity(BusinessCity string) *CreateTollfreeVerificationParams { - params.BusinessCity = &BusinessCity - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessStateProvinceRegion(BusinessStateProvinceRegion string) *CreateTollfreeVerificationParams { - params.BusinessStateProvinceRegion = &BusinessStateProvinceRegion - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessPostalCode(BusinessPostalCode string) *CreateTollfreeVerificationParams { - params.BusinessPostalCode = &BusinessPostalCode - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessCountry(BusinessCountry string) *CreateTollfreeVerificationParams { - params.BusinessCountry = &BusinessCountry - return params -} -func (params *CreateTollfreeVerificationParams) SetAdditionalInformation(AdditionalInformation string) *CreateTollfreeVerificationParams { - params.AdditionalInformation = &AdditionalInformation - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessContactFirstName(BusinessContactFirstName string) *CreateTollfreeVerificationParams { - params.BusinessContactFirstName = &BusinessContactFirstName - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessContactLastName(BusinessContactLastName string) *CreateTollfreeVerificationParams { - params.BusinessContactLastName = &BusinessContactLastName - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessContactEmail(BusinessContactEmail string) *CreateTollfreeVerificationParams { - params.BusinessContactEmail = &BusinessContactEmail - return params -} -func (params *CreateTollfreeVerificationParams) SetBusinessContactPhone(BusinessContactPhone string) *CreateTollfreeVerificationParams { - params.BusinessContactPhone = &BusinessContactPhone - return params + // The name of the business or organization using the Tollfree number. + BusinessName *string `json:"BusinessName,omitempty"` + // The website of the business or organization using the Tollfree number. + BusinessWebsite *string `json:"BusinessWebsite,omitempty"` + // The email address to receive the notification about the verification result. . + NotificationEmail *string `json:"NotificationEmail,omitempty"` + // The category of the use case for the Tollfree Number. List as many are applicable.. + UseCaseCategories *[]string `json:"UseCaseCategories,omitempty"` + // Use this to further explain how messaging is used by the business or organization. + UseCaseSummary *string `json:"UseCaseSummary,omitempty"` + // An example of message content, i.e. a sample message. + ProductionMessageSample *string `json:"ProductionMessageSample,omitempty"` + // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. + OptInImageUrls *[]string `json:"OptInImageUrls,omitempty"` + // + OptInType *string `json:"OptInType,omitempty"` + // Estimate monthly volume of messages from the Tollfree Number. + MessageVolume *string `json:"MessageVolume,omitempty"` + // The SID of the Phone Number associated with the Tollfree Verification. + TollfreePhoneNumberSid *string `json:"TollfreePhoneNumberSid,omitempty"` + // Customer's Profile Bundle BundleSid. + CustomerProfileSid *string `json:"CustomerProfileSid,omitempty"` + // The address of the business or organization using the Tollfree number. + BusinessStreetAddress *string `json:"BusinessStreetAddress,omitempty"` + // The address of the business or organization using the Tollfree number. + BusinessStreetAddress2 *string `json:"BusinessStreetAddress2,omitempty"` + // The city of the business or organization using the Tollfree number. + BusinessCity *string `json:"BusinessCity,omitempty"` + // The state/province/region of the business or organization using the Tollfree number. + BusinessStateProvinceRegion *string `json:"BusinessStateProvinceRegion,omitempty"` + // The postal code of the business or organization using the Tollfree number. + BusinessPostalCode *string `json:"BusinessPostalCode,omitempty"` + // The country of the business or organization using the Tollfree number. + BusinessCountry *string `json:"BusinessCountry,omitempty"` + // Additional information to be provided for verification. + AdditionalInformation *string `json:"AdditionalInformation,omitempty"` + // The first name of the contact for the business or organization using the Tollfree number. + BusinessContactFirstName *string `json:"BusinessContactFirstName,omitempty"` + // The last name of the contact for the business or organization using the Tollfree number. + BusinessContactLastName *string `json:"BusinessContactLastName,omitempty"` + // The email address of the contact for the business or organization using the Tollfree number. + BusinessContactEmail *string `json:"BusinessContactEmail,omitempty"` + // The phone number of the contact for the business or organization using the Tollfree number. + BusinessContactPhone *string `json:"BusinessContactPhone,omitempty"` + // An optional external reference ID supplied by customer and echoed back on status retrieval. + ExternalReferenceId *string `json:"ExternalReferenceId,omitempty"` +} + +func (params *CreateTollfreeVerificationParams) SetBusinessName(BusinessName string) (*CreateTollfreeVerificationParams){ + params.BusinessName = &BusinessName + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessWebsite(BusinessWebsite string) (*CreateTollfreeVerificationParams){ + params.BusinessWebsite = &BusinessWebsite + return params +} +func (params *CreateTollfreeVerificationParams) SetNotificationEmail(NotificationEmail string) (*CreateTollfreeVerificationParams){ + params.NotificationEmail = &NotificationEmail + return params +} +func (params *CreateTollfreeVerificationParams) SetUseCaseCategories(UseCaseCategories []string) (*CreateTollfreeVerificationParams){ + params.UseCaseCategories = &UseCaseCategories + return params +} +func (params *CreateTollfreeVerificationParams) SetUseCaseSummary(UseCaseSummary string) (*CreateTollfreeVerificationParams){ + params.UseCaseSummary = &UseCaseSummary + return params +} +func (params *CreateTollfreeVerificationParams) SetProductionMessageSample(ProductionMessageSample string) (*CreateTollfreeVerificationParams){ + params.ProductionMessageSample = &ProductionMessageSample + return params +} +func (params *CreateTollfreeVerificationParams) SetOptInImageUrls(OptInImageUrls []string) (*CreateTollfreeVerificationParams){ + params.OptInImageUrls = &OptInImageUrls + return params +} +func (params *CreateTollfreeVerificationParams) SetOptInType(OptInType string) (*CreateTollfreeVerificationParams){ + params.OptInType = &OptInType + return params +} +func (params *CreateTollfreeVerificationParams) SetMessageVolume(MessageVolume string) (*CreateTollfreeVerificationParams){ + params.MessageVolume = &MessageVolume + return params +} +func (params *CreateTollfreeVerificationParams) SetTollfreePhoneNumberSid(TollfreePhoneNumberSid string) (*CreateTollfreeVerificationParams){ + params.TollfreePhoneNumberSid = &TollfreePhoneNumberSid + return params +} +func (params *CreateTollfreeVerificationParams) SetCustomerProfileSid(CustomerProfileSid string) (*CreateTollfreeVerificationParams){ + params.CustomerProfileSid = &CustomerProfileSid + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessStreetAddress(BusinessStreetAddress string) (*CreateTollfreeVerificationParams){ + params.BusinessStreetAddress = &BusinessStreetAddress + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessStreetAddress2(BusinessStreetAddress2 string) (*CreateTollfreeVerificationParams){ + params.BusinessStreetAddress2 = &BusinessStreetAddress2 + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessCity(BusinessCity string) (*CreateTollfreeVerificationParams){ + params.BusinessCity = &BusinessCity + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessStateProvinceRegion(BusinessStateProvinceRegion string) (*CreateTollfreeVerificationParams){ + params.BusinessStateProvinceRegion = &BusinessStateProvinceRegion + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessPostalCode(BusinessPostalCode string) (*CreateTollfreeVerificationParams){ + params.BusinessPostalCode = &BusinessPostalCode + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessCountry(BusinessCountry string) (*CreateTollfreeVerificationParams){ + params.BusinessCountry = &BusinessCountry + return params +} +func (params *CreateTollfreeVerificationParams) SetAdditionalInformation(AdditionalInformation string) (*CreateTollfreeVerificationParams){ + params.AdditionalInformation = &AdditionalInformation + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessContactFirstName(BusinessContactFirstName string) (*CreateTollfreeVerificationParams){ + params.BusinessContactFirstName = &BusinessContactFirstName + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessContactLastName(BusinessContactLastName string) (*CreateTollfreeVerificationParams){ + params.BusinessContactLastName = &BusinessContactLastName + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessContactEmail(BusinessContactEmail string) (*CreateTollfreeVerificationParams){ + params.BusinessContactEmail = &BusinessContactEmail + return params +} +func (params *CreateTollfreeVerificationParams) SetBusinessContactPhone(BusinessContactPhone string) (*CreateTollfreeVerificationParams){ + params.BusinessContactPhone = &BusinessContactPhone + return params } -func (params *CreateTollfreeVerificationParams) SetExternalReferenceId(ExternalReferenceId string) *CreateTollfreeVerificationParams { - params.ExternalReferenceId = &ExternalReferenceId - return params +func (params *CreateTollfreeVerificationParams) SetExternalReferenceId(ExternalReferenceId string) (*CreateTollfreeVerificationParams){ + params.ExternalReferenceId = &ExternalReferenceId + return params } -// +// func (c *ApiService) CreateTollfreeVerification(params *CreateTollfreeVerificationParams) (*MessagingV1TollfreeVerification, error) { - path := "/v1/Tollfree/Verifications" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BusinessName != nil { - data.Set("BusinessName", *params.BusinessName) - } - if params != nil && params.BusinessWebsite != nil { - data.Set("BusinessWebsite", *params.BusinessWebsite) - } - if params != nil && params.NotificationEmail != nil { - data.Set("NotificationEmail", *params.NotificationEmail) - } - if params != nil && params.UseCaseCategories != nil { - for _, item := range *params.UseCaseCategories { - data.Add("UseCaseCategories", item) - } - } - if params != nil && params.UseCaseSummary != nil { - data.Set("UseCaseSummary", *params.UseCaseSummary) - } - if params != nil && params.ProductionMessageSample != nil { - data.Set("ProductionMessageSample", *params.ProductionMessageSample) - } - if params != nil && params.OptInImageUrls != nil { - for _, item := range *params.OptInImageUrls { - data.Add("OptInImageUrls", item) - } - } - if params != nil && params.OptInType != nil { - data.Set("OptInType", *params.OptInType) - } - if params != nil && params.MessageVolume != nil { - data.Set("MessageVolume", *params.MessageVolume) - } - if params != nil && params.TollfreePhoneNumberSid != nil { - data.Set("TollfreePhoneNumberSid", *params.TollfreePhoneNumberSid) - } - if params != nil && params.CustomerProfileSid != nil { - data.Set("CustomerProfileSid", *params.CustomerProfileSid) - } - if params != nil && params.BusinessStreetAddress != nil { - data.Set("BusinessStreetAddress", *params.BusinessStreetAddress) - } - if params != nil && params.BusinessStreetAddress2 != nil { - data.Set("BusinessStreetAddress2", *params.BusinessStreetAddress2) - } - if params != nil && params.BusinessCity != nil { - data.Set("BusinessCity", *params.BusinessCity) - } - if params != nil && params.BusinessStateProvinceRegion != nil { - data.Set("BusinessStateProvinceRegion", *params.BusinessStateProvinceRegion) - } - if params != nil && params.BusinessPostalCode != nil { - data.Set("BusinessPostalCode", *params.BusinessPostalCode) - } - if params != nil && params.BusinessCountry != nil { - data.Set("BusinessCountry", *params.BusinessCountry) - } - if params != nil && params.AdditionalInformation != nil { - data.Set("AdditionalInformation", *params.AdditionalInformation) - } - if params != nil && params.BusinessContactFirstName != nil { - data.Set("BusinessContactFirstName", *params.BusinessContactFirstName) - } - if params != nil && params.BusinessContactLastName != nil { - data.Set("BusinessContactLastName", *params.BusinessContactLastName) - } - if params != nil && params.BusinessContactEmail != nil { - data.Set("BusinessContactEmail", *params.BusinessContactEmail) - } - if params != nil && params.BusinessContactPhone != nil { - data.Set("BusinessContactPhone", *params.BusinessContactPhone) - } - if params != nil && params.ExternalReferenceId != nil { - data.Set("ExternalReferenceId", *params.ExternalReferenceId) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1TollfreeVerification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err -} - -// -func (c *ApiService) DeleteTollfreeVerification(Sid string) error { - path := "/v1/Tollfree/Verifications/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() - - return nil -} - -// -func (c *ApiService) FetchTollfreeVerification(Sid string) (*MessagingV1TollfreeVerification, error) { - path := "/v1/Tollfree/Verifications/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1TollfreeVerification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Tollfree/Verifications" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BusinessName != nil { + data.Set("BusinessName", *params.BusinessName) + } + if params != nil && params.BusinessWebsite != nil { + data.Set("BusinessWebsite", *params.BusinessWebsite) + } + if params != nil && params.NotificationEmail != nil { + data.Set("NotificationEmail", *params.NotificationEmail) + } + if params != nil && params.UseCaseCategories != nil { + for _, item := range *params.UseCaseCategories { + data.Add("UseCaseCategories", item) + } + } + if params != nil && params.UseCaseSummary != nil { + data.Set("UseCaseSummary", *params.UseCaseSummary) + } + if params != nil && params.ProductionMessageSample != nil { + data.Set("ProductionMessageSample", *params.ProductionMessageSample) + } + if params != nil && params.OptInImageUrls != nil { + for _, item := range *params.OptInImageUrls { + data.Add("OptInImageUrls", item) + } + } + if params != nil && params.OptInType != nil { + data.Set("OptInType", *params.OptInType) + } + if params != nil && params.MessageVolume != nil { + data.Set("MessageVolume", *params.MessageVolume) + } + if params != nil && params.TollfreePhoneNumberSid != nil { + data.Set("TollfreePhoneNumberSid", *params.TollfreePhoneNumberSid) + } + if params != nil && params.CustomerProfileSid != nil { + data.Set("CustomerProfileSid", *params.CustomerProfileSid) + } + if params != nil && params.BusinessStreetAddress != nil { + data.Set("BusinessStreetAddress", *params.BusinessStreetAddress) + } + if params != nil && params.BusinessStreetAddress2 != nil { + data.Set("BusinessStreetAddress2", *params.BusinessStreetAddress2) + } + if params != nil && params.BusinessCity != nil { + data.Set("BusinessCity", *params.BusinessCity) + } + if params != nil && params.BusinessStateProvinceRegion != nil { + data.Set("BusinessStateProvinceRegion", *params.BusinessStateProvinceRegion) + } + if params != nil && params.BusinessPostalCode != nil { + data.Set("BusinessPostalCode", *params.BusinessPostalCode) + } + if params != nil && params.BusinessCountry != nil { + data.Set("BusinessCountry", *params.BusinessCountry) + } + if params != nil && params.AdditionalInformation != nil { + data.Set("AdditionalInformation", *params.AdditionalInformation) + } + if params != nil && params.BusinessContactFirstName != nil { + data.Set("BusinessContactFirstName", *params.BusinessContactFirstName) + } + if params != nil && params.BusinessContactLastName != nil { + data.Set("BusinessContactLastName", *params.BusinessContactLastName) + } + if params != nil && params.BusinessContactEmail != nil { + data.Set("BusinessContactEmail", *params.BusinessContactEmail) + } + if params != nil && params.BusinessContactPhone != nil { + data.Set("BusinessContactPhone", *params.BusinessContactPhone) + } + if params != nil && params.ExternalReferenceId != nil { + data.Set("ExternalReferenceId", *params.ExternalReferenceId) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1TollfreeVerification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// +func (c *ApiService) FetchTollfreeVerification(Sid string, ) (*MessagingV1TollfreeVerification, error) { + path := "/v1/Tollfree/Verifications/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1TollfreeVerification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTollfreeVerification' type ListTollfreeVerificationParams struct { - // The SID of the Phone Number associated with the Tollfree Verification. - TollfreePhoneNumberSid *string `json:"TollfreePhoneNumberSid,omitempty"` - // The compliance status of the Tollfree Verification record. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the Phone Number associated with the Tollfree Verification. + TollfreePhoneNumberSid *string `json:"TollfreePhoneNumberSid,omitempty"` + // The compliance status of the Tollfree Verification record. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTollfreeVerificationParams) SetTollfreePhoneNumberSid(TollfreePhoneNumberSid string) *ListTollfreeVerificationParams { - params.TollfreePhoneNumberSid = &TollfreePhoneNumberSid - return params +func (params *ListTollfreeVerificationParams) SetTollfreePhoneNumberSid(TollfreePhoneNumberSid string) (*ListTollfreeVerificationParams){ + params.TollfreePhoneNumberSid = &TollfreePhoneNumberSid + return params } -func (params *ListTollfreeVerificationParams) SetStatus(Status string) *ListTollfreeVerificationParams { - params.Status = &Status - return params +func (params *ListTollfreeVerificationParams) SetStatus(Status string) (*ListTollfreeVerificationParams){ + params.Status = &Status + return params } -func (params *ListTollfreeVerificationParams) SetPageSize(PageSize int) *ListTollfreeVerificationParams { - params.PageSize = &PageSize - return params +func (params *ListTollfreeVerificationParams) SetPageSize(PageSize int) (*ListTollfreeVerificationParams){ + params.PageSize = &PageSize + return params } -func (params *ListTollfreeVerificationParams) SetLimit(Limit int) *ListTollfreeVerificationParams { - params.Limit = &Limit - return params +func (params *ListTollfreeVerificationParams) SetLimit(Limit int) (*ListTollfreeVerificationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TollfreeVerification records from the API. Request is executed immediately. func (c *ApiService) PageTollfreeVerification(params *ListTollfreeVerificationParams, pageToken, pageNumber string) (*ListTollfreeVerificationResponse, error) { - path := "/v1/Tollfree/Verifications" + path := "/v1/Tollfree/Verifications" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.TollfreePhoneNumberSid != nil { - data.Set("TollfreePhoneNumberSid", *params.TollfreePhoneNumberSid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.TollfreePhoneNumberSid != nil { + data.Set("TollfreePhoneNumberSid", *params.TollfreePhoneNumberSid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTollfreeVerificationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTollfreeVerificationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists TollfreeVerification records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -409,6 +395,7 @@ func (c *ApiService) StreamTollfreeVerification(params *ListTollfreeVerification return recordChannel, errorChannel } + func (c *ApiService) streamTollfreeVerification(response *ListTollfreeVerificationResponse, params *ListTollfreeVerificationParams, recordChannel chan MessagingV1TollfreeVerification, errorChannel chan error) { curRecord := 1 @@ -440,232 +427,234 @@ func (c *ApiService) streamTollfreeVerification(response *ListTollfreeVerificati } func (c *ApiService) getNextListTollfreeVerificationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTollfreeVerificationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListTollfreeVerificationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTollfreeVerification' type UpdateTollfreeVerificationParams struct { - // The name of the business or organization using the Tollfree number. - BusinessName *string `json:"BusinessName,omitempty"` - // The website of the business or organization using the Tollfree number. - BusinessWebsite *string `json:"BusinessWebsite,omitempty"` - // The email address to receive the notification about the verification result. . - NotificationEmail *string `json:"NotificationEmail,omitempty"` - // The category of the use case for the Tollfree Number. List as many are applicable.. - UseCaseCategories *[]string `json:"UseCaseCategories,omitempty"` - // Use this to further explain how messaging is used by the business or organization. - UseCaseSummary *string `json:"UseCaseSummary,omitempty"` - // An example of message content, i.e. a sample message. - ProductionMessageSample *string `json:"ProductionMessageSample,omitempty"` - // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. - OptInImageUrls *[]string `json:"OptInImageUrls,omitempty"` - // - OptInType *string `json:"OptInType,omitempty"` - // Estimate monthly volume of messages from the Tollfree Number. - MessageVolume *string `json:"MessageVolume,omitempty"` - // The address of the business or organization using the Tollfree number. - BusinessStreetAddress *string `json:"BusinessStreetAddress,omitempty"` - // The address of the business or organization using the Tollfree number. - BusinessStreetAddress2 *string `json:"BusinessStreetAddress2,omitempty"` - // The city of the business or organization using the Tollfree number. - BusinessCity *string `json:"BusinessCity,omitempty"` - // The state/province/region of the business or organization using the Tollfree number. - BusinessStateProvinceRegion *string `json:"BusinessStateProvinceRegion,omitempty"` - // The postal code of the business or organization using the Tollfree number. - BusinessPostalCode *string `json:"BusinessPostalCode,omitempty"` - // The country of the business or organization using the Tollfree number. - BusinessCountry *string `json:"BusinessCountry,omitempty"` - // Additional information to be provided for verification. - AdditionalInformation *string `json:"AdditionalInformation,omitempty"` - // The first name of the contact for the business or organization using the Tollfree number. - BusinessContactFirstName *string `json:"BusinessContactFirstName,omitempty"` - // The last name of the contact for the business or organization using the Tollfree number. - BusinessContactLastName *string `json:"BusinessContactLastName,omitempty"` - // The email address of the contact for the business or organization using the Tollfree number. - BusinessContactEmail *string `json:"BusinessContactEmail,omitempty"` - // The phone number of the contact for the business or organization using the Tollfree number. - BusinessContactPhone *string `json:"BusinessContactPhone,omitempty"` -} - -func (params *UpdateTollfreeVerificationParams) SetBusinessName(BusinessName string) *UpdateTollfreeVerificationParams { - params.BusinessName = &BusinessName - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessWebsite(BusinessWebsite string) *UpdateTollfreeVerificationParams { - params.BusinessWebsite = &BusinessWebsite - return params -} -func (params *UpdateTollfreeVerificationParams) SetNotificationEmail(NotificationEmail string) *UpdateTollfreeVerificationParams { - params.NotificationEmail = &NotificationEmail - return params -} -func (params *UpdateTollfreeVerificationParams) SetUseCaseCategories(UseCaseCategories []string) *UpdateTollfreeVerificationParams { - params.UseCaseCategories = &UseCaseCategories - return params -} -func (params *UpdateTollfreeVerificationParams) SetUseCaseSummary(UseCaseSummary string) *UpdateTollfreeVerificationParams { - params.UseCaseSummary = &UseCaseSummary - return params -} -func (params *UpdateTollfreeVerificationParams) SetProductionMessageSample(ProductionMessageSample string) *UpdateTollfreeVerificationParams { - params.ProductionMessageSample = &ProductionMessageSample - return params -} -func (params *UpdateTollfreeVerificationParams) SetOptInImageUrls(OptInImageUrls []string) *UpdateTollfreeVerificationParams { - params.OptInImageUrls = &OptInImageUrls - return params -} -func (params *UpdateTollfreeVerificationParams) SetOptInType(OptInType string) *UpdateTollfreeVerificationParams { - params.OptInType = &OptInType - return params -} -func (params *UpdateTollfreeVerificationParams) SetMessageVolume(MessageVolume string) *UpdateTollfreeVerificationParams { - params.MessageVolume = &MessageVolume - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessStreetAddress(BusinessStreetAddress string) *UpdateTollfreeVerificationParams { - params.BusinessStreetAddress = &BusinessStreetAddress - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessStreetAddress2(BusinessStreetAddress2 string) *UpdateTollfreeVerificationParams { - params.BusinessStreetAddress2 = &BusinessStreetAddress2 - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessCity(BusinessCity string) *UpdateTollfreeVerificationParams { - params.BusinessCity = &BusinessCity - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessStateProvinceRegion(BusinessStateProvinceRegion string) *UpdateTollfreeVerificationParams { - params.BusinessStateProvinceRegion = &BusinessStateProvinceRegion - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessPostalCode(BusinessPostalCode string) *UpdateTollfreeVerificationParams { - params.BusinessPostalCode = &BusinessPostalCode - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessCountry(BusinessCountry string) *UpdateTollfreeVerificationParams { - params.BusinessCountry = &BusinessCountry - return params -} -func (params *UpdateTollfreeVerificationParams) SetAdditionalInformation(AdditionalInformation string) *UpdateTollfreeVerificationParams { - params.AdditionalInformation = &AdditionalInformation - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessContactFirstName(BusinessContactFirstName string) *UpdateTollfreeVerificationParams { - params.BusinessContactFirstName = &BusinessContactFirstName - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessContactLastName(BusinessContactLastName string) *UpdateTollfreeVerificationParams { - params.BusinessContactLastName = &BusinessContactLastName - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessContactEmail(BusinessContactEmail string) *UpdateTollfreeVerificationParams { - params.BusinessContactEmail = &BusinessContactEmail - return params -} -func (params *UpdateTollfreeVerificationParams) SetBusinessContactPhone(BusinessContactPhone string) *UpdateTollfreeVerificationParams { - params.BusinessContactPhone = &BusinessContactPhone - return params -} - -// + // The name of the business or organization using the Tollfree number. + BusinessName *string `json:"BusinessName,omitempty"` + // The website of the business or organization using the Tollfree number. + BusinessWebsite *string `json:"BusinessWebsite,omitempty"` + // The email address to receive the notification about the verification result. . + NotificationEmail *string `json:"NotificationEmail,omitempty"` + // The category of the use case for the Tollfree Number. List as many are applicable.. + UseCaseCategories *[]string `json:"UseCaseCategories,omitempty"` + // Use this to further explain how messaging is used by the business or organization. + UseCaseSummary *string `json:"UseCaseSummary,omitempty"` + // An example of message content, i.e. a sample message. + ProductionMessageSample *string `json:"ProductionMessageSample,omitempty"` + // Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. + OptInImageUrls *[]string `json:"OptInImageUrls,omitempty"` + // + OptInType *string `json:"OptInType,omitempty"` + // Estimate monthly volume of messages from the Tollfree Number. + MessageVolume *string `json:"MessageVolume,omitempty"` + // The address of the business or organization using the Tollfree number. + BusinessStreetAddress *string `json:"BusinessStreetAddress,omitempty"` + // The address of the business or organization using the Tollfree number. + BusinessStreetAddress2 *string `json:"BusinessStreetAddress2,omitempty"` + // The city of the business or organization using the Tollfree number. + BusinessCity *string `json:"BusinessCity,omitempty"` + // The state/province/region of the business or organization using the Tollfree number. + BusinessStateProvinceRegion *string `json:"BusinessStateProvinceRegion,omitempty"` + // The postal code of the business or organization using the Tollfree number. + BusinessPostalCode *string `json:"BusinessPostalCode,omitempty"` + // The country of the business or organization using the Tollfree number. + BusinessCountry *string `json:"BusinessCountry,omitempty"` + // Additional information to be provided for verification. + AdditionalInformation *string `json:"AdditionalInformation,omitempty"` + // The first name of the contact for the business or organization using the Tollfree number. + BusinessContactFirstName *string `json:"BusinessContactFirstName,omitempty"` + // The last name of the contact for the business or organization using the Tollfree number. + BusinessContactLastName *string `json:"BusinessContactLastName,omitempty"` + // The email address of the contact for the business or organization using the Tollfree number. + BusinessContactEmail *string `json:"BusinessContactEmail,omitempty"` + // The phone number of the contact for the business or organization using the Tollfree number. + BusinessContactPhone *string `json:"BusinessContactPhone,omitempty"` +} + +func (params *UpdateTollfreeVerificationParams) SetBusinessName(BusinessName string) (*UpdateTollfreeVerificationParams){ + params.BusinessName = &BusinessName + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessWebsite(BusinessWebsite string) (*UpdateTollfreeVerificationParams){ + params.BusinessWebsite = &BusinessWebsite + return params +} +func (params *UpdateTollfreeVerificationParams) SetNotificationEmail(NotificationEmail string) (*UpdateTollfreeVerificationParams){ + params.NotificationEmail = &NotificationEmail + return params +} +func (params *UpdateTollfreeVerificationParams) SetUseCaseCategories(UseCaseCategories []string) (*UpdateTollfreeVerificationParams){ + params.UseCaseCategories = &UseCaseCategories + return params +} +func (params *UpdateTollfreeVerificationParams) SetUseCaseSummary(UseCaseSummary string) (*UpdateTollfreeVerificationParams){ + params.UseCaseSummary = &UseCaseSummary + return params +} +func (params *UpdateTollfreeVerificationParams) SetProductionMessageSample(ProductionMessageSample string) (*UpdateTollfreeVerificationParams){ + params.ProductionMessageSample = &ProductionMessageSample + return params +} +func (params *UpdateTollfreeVerificationParams) SetOptInImageUrls(OptInImageUrls []string) (*UpdateTollfreeVerificationParams){ + params.OptInImageUrls = &OptInImageUrls + return params +} +func (params *UpdateTollfreeVerificationParams) SetOptInType(OptInType string) (*UpdateTollfreeVerificationParams){ + params.OptInType = &OptInType + return params +} +func (params *UpdateTollfreeVerificationParams) SetMessageVolume(MessageVolume string) (*UpdateTollfreeVerificationParams){ + params.MessageVolume = &MessageVolume + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessStreetAddress(BusinessStreetAddress string) (*UpdateTollfreeVerificationParams){ + params.BusinessStreetAddress = &BusinessStreetAddress + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessStreetAddress2(BusinessStreetAddress2 string) (*UpdateTollfreeVerificationParams){ + params.BusinessStreetAddress2 = &BusinessStreetAddress2 + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessCity(BusinessCity string) (*UpdateTollfreeVerificationParams){ + params.BusinessCity = &BusinessCity + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessStateProvinceRegion(BusinessStateProvinceRegion string) (*UpdateTollfreeVerificationParams){ + params.BusinessStateProvinceRegion = &BusinessStateProvinceRegion + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessPostalCode(BusinessPostalCode string) (*UpdateTollfreeVerificationParams){ + params.BusinessPostalCode = &BusinessPostalCode + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessCountry(BusinessCountry string) (*UpdateTollfreeVerificationParams){ + params.BusinessCountry = &BusinessCountry + return params +} +func (params *UpdateTollfreeVerificationParams) SetAdditionalInformation(AdditionalInformation string) (*UpdateTollfreeVerificationParams){ + params.AdditionalInformation = &AdditionalInformation + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessContactFirstName(BusinessContactFirstName string) (*UpdateTollfreeVerificationParams){ + params.BusinessContactFirstName = &BusinessContactFirstName + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessContactLastName(BusinessContactLastName string) (*UpdateTollfreeVerificationParams){ + params.BusinessContactLastName = &BusinessContactLastName + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessContactEmail(BusinessContactEmail string) (*UpdateTollfreeVerificationParams){ + params.BusinessContactEmail = &BusinessContactEmail + return params +} +func (params *UpdateTollfreeVerificationParams) SetBusinessContactPhone(BusinessContactPhone string) (*UpdateTollfreeVerificationParams){ + params.BusinessContactPhone = &BusinessContactPhone + return params +} + +// func (c *ApiService) UpdateTollfreeVerification(Sid string, params *UpdateTollfreeVerificationParams) (*MessagingV1TollfreeVerification, error) { - path := "/v1/Tollfree/Verifications/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.BusinessName != nil { - data.Set("BusinessName", *params.BusinessName) - } - if params != nil && params.BusinessWebsite != nil { - data.Set("BusinessWebsite", *params.BusinessWebsite) - } - if params != nil && params.NotificationEmail != nil { - data.Set("NotificationEmail", *params.NotificationEmail) - } - if params != nil && params.UseCaseCategories != nil { - for _, item := range *params.UseCaseCategories { - data.Add("UseCaseCategories", item) - } - } - if params != nil && params.UseCaseSummary != nil { - data.Set("UseCaseSummary", *params.UseCaseSummary) - } - if params != nil && params.ProductionMessageSample != nil { - data.Set("ProductionMessageSample", *params.ProductionMessageSample) - } - if params != nil && params.OptInImageUrls != nil { - for _, item := range *params.OptInImageUrls { - data.Add("OptInImageUrls", item) - } - } - if params != nil && params.OptInType != nil { - data.Set("OptInType", *params.OptInType) - } - if params != nil && params.MessageVolume != nil { - data.Set("MessageVolume", *params.MessageVolume) - } - if params != nil && params.BusinessStreetAddress != nil { - data.Set("BusinessStreetAddress", *params.BusinessStreetAddress) - } - if params != nil && params.BusinessStreetAddress2 != nil { - data.Set("BusinessStreetAddress2", *params.BusinessStreetAddress2) - } - if params != nil && params.BusinessCity != nil { - data.Set("BusinessCity", *params.BusinessCity) - } - if params != nil && params.BusinessStateProvinceRegion != nil { - data.Set("BusinessStateProvinceRegion", *params.BusinessStateProvinceRegion) - } - if params != nil && params.BusinessPostalCode != nil { - data.Set("BusinessPostalCode", *params.BusinessPostalCode) - } - if params != nil && params.BusinessCountry != nil { - data.Set("BusinessCountry", *params.BusinessCountry) - } - if params != nil && params.AdditionalInformation != nil { - data.Set("AdditionalInformation", *params.AdditionalInformation) - } - if params != nil && params.BusinessContactFirstName != nil { - data.Set("BusinessContactFirstName", *params.BusinessContactFirstName) - } - if params != nil && params.BusinessContactLastName != nil { - data.Set("BusinessContactLastName", *params.BusinessContactLastName) - } - if params != nil && params.BusinessContactEmail != nil { - data.Set("BusinessContactEmail", *params.BusinessContactEmail) - } - if params != nil && params.BusinessContactPhone != nil { - data.Set("BusinessContactPhone", *params.BusinessContactPhone) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MessagingV1TollfreeVerification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Tollfree/Verifications/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.BusinessName != nil { + data.Set("BusinessName", *params.BusinessName) + } + if params != nil && params.BusinessWebsite != nil { + data.Set("BusinessWebsite", *params.BusinessWebsite) + } + if params != nil && params.NotificationEmail != nil { + data.Set("NotificationEmail", *params.NotificationEmail) + } + if params != nil && params.UseCaseCategories != nil { + for _, item := range *params.UseCaseCategories { + data.Add("UseCaseCategories", item) + } + } + if params != nil && params.UseCaseSummary != nil { + data.Set("UseCaseSummary", *params.UseCaseSummary) + } + if params != nil && params.ProductionMessageSample != nil { + data.Set("ProductionMessageSample", *params.ProductionMessageSample) + } + if params != nil && params.OptInImageUrls != nil { + for _, item := range *params.OptInImageUrls { + data.Add("OptInImageUrls", item) + } + } + if params != nil && params.OptInType != nil { + data.Set("OptInType", *params.OptInType) + } + if params != nil && params.MessageVolume != nil { + data.Set("MessageVolume", *params.MessageVolume) + } + if params != nil && params.BusinessStreetAddress != nil { + data.Set("BusinessStreetAddress", *params.BusinessStreetAddress) + } + if params != nil && params.BusinessStreetAddress2 != nil { + data.Set("BusinessStreetAddress2", *params.BusinessStreetAddress2) + } + if params != nil && params.BusinessCity != nil { + data.Set("BusinessCity", *params.BusinessCity) + } + if params != nil && params.BusinessStateProvinceRegion != nil { + data.Set("BusinessStateProvinceRegion", *params.BusinessStateProvinceRegion) + } + if params != nil && params.BusinessPostalCode != nil { + data.Set("BusinessPostalCode", *params.BusinessPostalCode) + } + if params != nil && params.BusinessCountry != nil { + data.Set("BusinessCountry", *params.BusinessCountry) + } + if params != nil && params.AdditionalInformation != nil { + data.Set("AdditionalInformation", *params.AdditionalInformation) + } + if params != nil && params.BusinessContactFirstName != nil { + data.Set("BusinessContactFirstName", *params.BusinessContactFirstName) + } + if params != nil && params.BusinessContactLastName != nil { + data.Set("BusinessContactLastName", *params.BusinessContactLastName) + } + if params != nil && params.BusinessContactEmail != nil { + data.Set("BusinessContactEmail", *params.BusinessContactEmail) + } + if params != nil && params.BusinessContactPhone != nil { + data.Set("BusinessContactPhone", *params.BusinessContactPhone) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MessagingV1TollfreeVerification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/microvisor/v1/README.md b/rest/microvisor/v1/README.md index 971c750b5..f38d4e9fa 100644 --- a/rest/microvisor/v1/README.md +++ b/rest/microvisor/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/microvisor/v1/api_service.go b/rest/microvisor/v1/api_service.go index 2df498b86..b24eff5c8 100644 --- a/rest/microvisor/v1/api_service.go +++ b/rest/microvisor/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://microvisor.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/microvisor/v1/apps.go b/rest/microvisor/v1/apps.go index 31c92a719..f99548728 100644 --- a/rest/microvisor/v1/apps.go +++ b/rest/microvisor/v1/apps.go @@ -18,100 +18,105 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific App. -func (c *ApiService) DeleteApp(Sid string) error { - path := "/v1/Apps/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteApp(Sid string, ) (error) { + path := "/v1/Apps/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific App. -func (c *ApiService) FetchApp(Sid string) (*MicrovisorV1App, error) { - path := "/v1/Apps/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchApp(Sid string, ) (*MicrovisorV1App, error) { + path := "/v1/Apps/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MicrovisorV1App{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MicrovisorV1App{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListApp' type ListAppParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAppParams) SetPageSize(PageSize int) *ListAppParams { - params.PageSize = &PageSize - return params +func (params *ListAppParams) SetPageSize(PageSize int) (*ListAppParams){ + params.PageSize = &PageSize + return params } -func (params *ListAppParams) SetLimit(Limit int) *ListAppParams { - params.Limit = &Limit - return params +func (params *ListAppParams) SetLimit(Limit int) (*ListAppParams){ + params.Limit = &Limit + return params } // Retrieve a single page of App records from the API. Request is executed immediately. func (c *ApiService) PageApp(params *ListAppParams, pageToken, pageNumber string) (*ListAppResponse, error) { - path := "/v1/Apps" + path := "/v1/Apps" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAppResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAppResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists App records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -152,6 +157,7 @@ func (c *ApiService) StreamApp(params *ListAppParams) (chan MicrovisorV1App, cha return recordChannel, errorChannel } + func (c *ApiService) streamApp(response *ListAppResponse, params *ListAppParams, recordChannel chan MicrovisorV1App, errorChannel chan error) { curRecord := 1 @@ -183,19 +189,20 @@ func (c *ApiService) streamApp(response *ListAppResponse, params *ListAppParams, } func (c *ApiService) getNextListAppResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAppResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAppResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/microvisor/v1/apps_manifest.go b/rest/microvisor/v1/apps_manifest.go index c9eb9bf24..c43c29933 100644 --- a/rest/microvisor/v1/apps_manifest.go +++ b/rest/microvisor/v1/apps_manifest.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the Manifest for an App. -func (c *ApiService) FetchAppManifest(AppSid string) (*MicrovisorV1AppManifest, error) { - path := "/v1/Apps/{AppSid}/Manifest" - path = strings.Replace(path, "{"+"AppSid"+"}", AppSid, -1) +func (c *ApiService) FetchAppManifest(AppSid string, ) (*MicrovisorV1AppManifest, error) { + path := "/v1/Apps/{AppSid}/Manifest" + path = strings.Replace(path, "{"+"AppSid"+"}", AppSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MicrovisorV1AppManifest{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MicrovisorV1AppManifest{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/microvisor/v1/configs.go b/rest/microvisor/v1/configs.go index b1b5ad71e..f3bba8943 100644 --- a/rest/microvisor/v1/configs.go +++ b/rest/microvisor/v1/configs.go @@ -18,146 +18,152 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAccountConfig' type CreateAccountConfigParams struct { - // The config key; up to 100 characters. - Key *string `json:"Key,omitempty"` - // The config value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The config key; up to 100 characters. + Key *string `json:"Key,omitempty"` + // The config value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *CreateAccountConfigParams) SetKey(Key string) *CreateAccountConfigParams { - params.Key = &Key - return params +func (params *CreateAccountConfigParams) SetKey(Key string) (*CreateAccountConfigParams){ + params.Key = &Key + return params } -func (params *CreateAccountConfigParams) SetValue(Value string) *CreateAccountConfigParams { - params.Value = &Value - return params +func (params *CreateAccountConfigParams) SetValue(Value string) (*CreateAccountConfigParams){ + params.Value = &Value + return params } // Create a config for an Account. func (c *ApiService) CreateAccountConfig(params *CreateAccountConfigParams) (*MicrovisorV1AccountConfig, error) { - path := "/v1/Configs" + path := "/v1/Configs" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MicrovisorV1AccountConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MicrovisorV1AccountConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a config for an Account. -func (c *ApiService) DeleteAccountConfig(Key string) error { - path := "/v1/Configs/{Key}" - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) DeleteAccountConfig(Key string, ) (error) { + path := "/v1/Configs/{Key}" + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a Config for an Account. -func (c *ApiService) FetchAccountConfig(Key string) (*MicrovisorV1AccountConfig, error) { - path := "/v1/Configs/{Key}" - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) FetchAccountConfig(Key string, ) (*MicrovisorV1AccountConfig, error) { + path := "/v1/Configs/{Key}" + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MicrovisorV1AccountConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MicrovisorV1AccountConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAccountConfig' type ListAccountConfigParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAccountConfigParams) SetPageSize(PageSize int) *ListAccountConfigParams { - params.PageSize = &PageSize - return params +func (params *ListAccountConfigParams) SetPageSize(PageSize int) (*ListAccountConfigParams){ + params.PageSize = &PageSize + return params } -func (params *ListAccountConfigParams) SetLimit(Limit int) *ListAccountConfigParams { - params.Limit = &Limit - return params +func (params *ListAccountConfigParams) SetLimit(Limit int) (*ListAccountConfigParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AccountConfig records from the API. Request is executed immediately. func (c *ApiService) PageAccountConfig(params *ListAccountConfigParams, pageToken, pageNumber string) (*ListAccountConfigResponse, error) { - path := "/v1/Configs" + path := "/v1/Configs" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAccountConfigResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAccountConfigResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AccountConfig records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -198,6 +204,7 @@ func (c *ApiService) StreamAccountConfig(params *ListAccountConfigParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamAccountConfig(response *ListAccountConfigResponse, params *ListAccountConfigParams, recordChannel chan MicrovisorV1AccountConfig, errorChannel chan error) { curRecord := 1 @@ -229,57 +236,59 @@ func (c *ApiService) streamAccountConfig(response *ListAccountConfigResponse, pa } func (c *ApiService) getNextListAccountConfigResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAccountConfigResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAccountConfigResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateAccountConfig' type UpdateAccountConfigParams struct { - // The config value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The config value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *UpdateAccountConfigParams) SetValue(Value string) *UpdateAccountConfigParams { - params.Value = &Value - return params +func (params *UpdateAccountConfigParams) SetValue(Value string) (*UpdateAccountConfigParams){ + params.Value = &Value + return params } // Update a config for an Account. func (c *ApiService) UpdateAccountConfig(Key string, params *UpdateAccountConfigParams) (*MicrovisorV1AccountConfig, error) { - path := "/v1/Configs/{Key}" - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + path := "/v1/Configs/{Key}" + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MicrovisorV1AccountConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MicrovisorV1AccountConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/microvisor/v1/devices.go b/rest/microvisor/v1/devices.go index 731efd963..067fad98b 100644 --- a/rest/microvisor/v1/devices.go +++ b/rest/microvisor/v1/devices.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Device. -func (c *ApiService) FetchDevice(Sid string) (*MicrovisorV1Device, error) { - path := "/v1/Devices/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchDevice(Sid string, ) (*MicrovisorV1Device, error) { + path := "/v1/Devices/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MicrovisorV1Device{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MicrovisorV1Device{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListDevice' type ListDeviceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDeviceParams) SetPageSize(PageSize int) *ListDeviceParams { - params.PageSize = &PageSize - return params +func (params *ListDeviceParams) SetPageSize(PageSize int) (*ListDeviceParams){ + params.PageSize = &PageSize + return params } -func (params *ListDeviceParams) SetLimit(Limit int) *ListDeviceParams { - params.Limit = &Limit - return params +func (params *ListDeviceParams) SetLimit(Limit int) (*ListDeviceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Device records from the API. Request is executed immediately. func (c *ApiService) PageDevice(params *ListDeviceParams, pageToken, pageNumber string) (*ListDeviceResponse, error) { - path := "/v1/Devices" + path := "/v1/Devices" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDeviceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDeviceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Device records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamDevice(params *ListDeviceParams) (chan MicrovisorV1De return recordChannel, errorChannel } + func (c *ApiService) streamDevice(response *ListDeviceResponse, params *ListDeviceParams, recordChannel chan MicrovisorV1Device, errorChannel chan error) { curRecord := 1 @@ -165,84 +169,86 @@ func (c *ApiService) streamDevice(response *ListDeviceResponse, params *ListDevi } func (c *ApiService) getNextListDeviceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDeviceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDeviceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateDevice' type UpdateDeviceParams struct { - // A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - UniqueName *string `json:"UniqueName,omitempty"` - // The SID or unique name of the App to be targeted to the Device. - TargetApp *string `json:"TargetApp,omitempty"` - // A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - LoggingEnabled *bool `json:"LoggingEnabled,omitempty"` - // Set to true to restart the App running on the Device. - RestartApp *bool `json:"RestartApp,omitempty"` + // A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. + UniqueName *string `json:"UniqueName,omitempty"` + // The SID or unique name of the App to be targeted to the Device. + TargetApp *string `json:"TargetApp,omitempty"` + // A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. + LoggingEnabled *bool `json:"LoggingEnabled,omitempty"` + // Set to true to restart the App running on the Device. + RestartApp *bool `json:"RestartApp,omitempty"` } -func (params *UpdateDeviceParams) SetUniqueName(UniqueName string) *UpdateDeviceParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateDeviceParams) SetUniqueName(UniqueName string) (*UpdateDeviceParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateDeviceParams) SetTargetApp(TargetApp string) *UpdateDeviceParams { - params.TargetApp = &TargetApp - return params +func (params *UpdateDeviceParams) SetTargetApp(TargetApp string) (*UpdateDeviceParams){ + params.TargetApp = &TargetApp + return params } -func (params *UpdateDeviceParams) SetLoggingEnabled(LoggingEnabled bool) *UpdateDeviceParams { - params.LoggingEnabled = &LoggingEnabled - return params +func (params *UpdateDeviceParams) SetLoggingEnabled(LoggingEnabled bool) (*UpdateDeviceParams){ + params.LoggingEnabled = &LoggingEnabled + return params } -func (params *UpdateDeviceParams) SetRestartApp(RestartApp bool) *UpdateDeviceParams { - params.RestartApp = &RestartApp - return params +func (params *UpdateDeviceParams) SetRestartApp(RestartApp bool) (*UpdateDeviceParams){ + params.RestartApp = &RestartApp + return params } // Update a specific Device. func (c *ApiService) UpdateDevice(Sid string, params *UpdateDeviceParams) (*MicrovisorV1Device, error) { - path := "/v1/Devices/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.TargetApp != nil { - data.Set("TargetApp", *params.TargetApp) - } - if params != nil && params.LoggingEnabled != nil { - data.Set("LoggingEnabled", fmt.Sprint(*params.LoggingEnabled)) - } - if params != nil && params.RestartApp != nil { - data.Set("RestartApp", fmt.Sprint(*params.RestartApp)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &MicrovisorV1Device{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Devices/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.TargetApp != nil { + data.Set("TargetApp", *params.TargetApp) + } + if params != nil && params.LoggingEnabled != nil { + data.Set("LoggingEnabled", fmt.Sprint(*params.LoggingEnabled)) + } + if params != nil && params.RestartApp != nil { + data.Set("RestartApp", fmt.Sprint(*params.RestartApp)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MicrovisorV1Device{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/microvisor/v1/devices_configs.go b/rest/microvisor/v1/devices_configs.go index ebaebfb23..4f8b9d654 100644 --- a/rest/microvisor/v1/devices_configs.go +++ b/rest/microvisor/v1/devices_configs.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateDeviceConfig' type CreateDeviceConfigParams struct { - // The config key; up to 100 characters. - Key *string `json:"Key,omitempty"` - // The config value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The config key; up to 100 characters. + Key *string `json:"Key,omitempty"` + // The config value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *CreateDeviceConfigParams) SetKey(Key string) *CreateDeviceConfigParams { - params.Key = &Key - return params +func (params *CreateDeviceConfigParams) SetKey(Key string) (*CreateDeviceConfigParams){ + params.Key = &Key + return params } -func (params *CreateDeviceConfigParams) SetValue(Value string) *CreateDeviceConfigParams { - params.Value = &Value - return params +func (params *CreateDeviceConfigParams) SetValue(Value string) (*CreateDeviceConfigParams){ + params.Value = &Value + return params } // Create a config for a Microvisor Device. func (c *ApiService) CreateDeviceConfig(DeviceSid string, params *CreateDeviceConfigParams) (*MicrovisorV1DeviceConfig, error) { - path := "/v1/Devices/{DeviceSid}/Configs" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path := "/v1/Devices/{DeviceSid}/Configs" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MicrovisorV1DeviceConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MicrovisorV1DeviceConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a config for a Microvisor Device. -func (c *ApiService) DeleteDeviceConfig(DeviceSid string, Key string) error { - path := "/v1/Devices/{DeviceSid}/Configs/{Key}" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) DeleteDeviceConfig(DeviceSid string, Key string, ) (error) { + path := "/v1/Devices/{DeviceSid}/Configs/{Key}" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a Config for a Device. -func (c *ApiService) FetchDeviceConfig(DeviceSid string, Key string) (*MicrovisorV1DeviceConfig, error) { - path := "/v1/Devices/{DeviceSid}/Configs/{Key}" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) FetchDeviceConfig(DeviceSid string, Key string, ) (*MicrovisorV1DeviceConfig, error) { + path := "/v1/Devices/{DeviceSid}/Configs/{Key}" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MicrovisorV1DeviceConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MicrovisorV1DeviceConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListDeviceConfig' type ListDeviceConfigParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDeviceConfigParams) SetPageSize(PageSize int) *ListDeviceConfigParams { - params.PageSize = &PageSize - return params +func (params *ListDeviceConfigParams) SetPageSize(PageSize int) (*ListDeviceConfigParams){ + params.PageSize = &PageSize + return params } -func (params *ListDeviceConfigParams) SetLimit(Limit int) *ListDeviceConfigParams { - params.Limit = &Limit - return params +func (params *ListDeviceConfigParams) SetLimit(Limit int) (*ListDeviceConfigParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DeviceConfig records from the API. Request is executed immediately. func (c *ApiService) PageDeviceConfig(DeviceSid string, params *ListDeviceConfigParams, pageToken, pageNumber string) (*ListDeviceConfigResponse, error) { - path := "/v1/Devices/{DeviceSid}/Configs" + path := "/v1/Devices/{DeviceSid}/Configs" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDeviceConfigResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDeviceConfigResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists DeviceConfig records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamDeviceConfig(DeviceSid string, params *ListDeviceConf return recordChannel, errorChannel } + func (c *ApiService) streamDeviceConfig(response *ListDeviceConfigResponse, params *ListDeviceConfigParams, recordChannel chan MicrovisorV1DeviceConfig, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamDeviceConfig(response *ListDeviceConfigResponse, para } func (c *ApiService) getNextListDeviceConfigResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDeviceConfigResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDeviceConfigResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateDeviceConfig' type UpdateDeviceConfigParams struct { - // The config value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The config value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *UpdateDeviceConfigParams) SetValue(Value string) *UpdateDeviceConfigParams { - params.Value = &Value - return params +func (params *UpdateDeviceConfigParams) SetValue(Value string) (*UpdateDeviceConfigParams){ + params.Value = &Value + return params } // Update a config for a Microvisor Device. func (c *ApiService) UpdateDeviceConfig(DeviceSid string, Key string, params *UpdateDeviceConfigParams) (*MicrovisorV1DeviceConfig, error) { - path := "/v1/Devices/{DeviceSid}/Configs/{Key}" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + path := "/v1/Devices/{DeviceSid}/Configs/{Key}" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MicrovisorV1DeviceConfig{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MicrovisorV1DeviceConfig{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/microvisor/v1/devices_secrets.go b/rest/microvisor/v1/devices_secrets.go index be0e7320a..729abb901 100644 --- a/rest/microvisor/v1/devices_secrets.go +++ b/rest/microvisor/v1/devices_secrets.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateDeviceSecret' type CreateDeviceSecretParams struct { - // The secret key; up to 100 characters. - Key *string `json:"Key,omitempty"` - // The secret value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The secret key; up to 100 characters. + Key *string `json:"Key,omitempty"` + // The secret value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *CreateDeviceSecretParams) SetKey(Key string) *CreateDeviceSecretParams { - params.Key = &Key - return params +func (params *CreateDeviceSecretParams) SetKey(Key string) (*CreateDeviceSecretParams){ + params.Key = &Key + return params } -func (params *CreateDeviceSecretParams) SetValue(Value string) *CreateDeviceSecretParams { - params.Value = &Value - return params +func (params *CreateDeviceSecretParams) SetValue(Value string) (*CreateDeviceSecretParams){ + params.Value = &Value + return params } // Create a secret for a Microvisor Device. func (c *ApiService) CreateDeviceSecret(DeviceSid string, params *CreateDeviceSecretParams) (*MicrovisorV1DeviceSecret, error) { - path := "/v1/Devices/{DeviceSid}/Secrets" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path := "/v1/Devices/{DeviceSid}/Secrets" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MicrovisorV1DeviceSecret{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MicrovisorV1DeviceSecret{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a secret for a Microvisor Device. -func (c *ApiService) DeleteDeviceSecret(DeviceSid string, Key string) error { - path := "/v1/Devices/{DeviceSid}/Secrets/{Key}" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) DeleteDeviceSecret(DeviceSid string, Key string, ) (error) { + path := "/v1/Devices/{DeviceSid}/Secrets/{Key}" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a Secret for a Device. -func (c *ApiService) FetchDeviceSecret(DeviceSid string, Key string) (*MicrovisorV1DeviceSecret, error) { - path := "/v1/Devices/{DeviceSid}/Secrets/{Key}" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) FetchDeviceSecret(DeviceSid string, Key string, ) (*MicrovisorV1DeviceSecret, error) { + path := "/v1/Devices/{DeviceSid}/Secrets/{Key}" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MicrovisorV1DeviceSecret{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MicrovisorV1DeviceSecret{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListDeviceSecret' type ListDeviceSecretParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDeviceSecretParams) SetPageSize(PageSize int) *ListDeviceSecretParams { - params.PageSize = &PageSize - return params +func (params *ListDeviceSecretParams) SetPageSize(PageSize int) (*ListDeviceSecretParams){ + params.PageSize = &PageSize + return params } -func (params *ListDeviceSecretParams) SetLimit(Limit int) *ListDeviceSecretParams { - params.Limit = &Limit - return params +func (params *ListDeviceSecretParams) SetLimit(Limit int) (*ListDeviceSecretParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DeviceSecret records from the API. Request is executed immediately. func (c *ApiService) PageDeviceSecret(DeviceSid string, params *ListDeviceSecretParams, pageToken, pageNumber string) (*ListDeviceSecretResponse, error) { - path := "/v1/Devices/{DeviceSid}/Secrets" + path := "/v1/Devices/{DeviceSid}/Secrets" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDeviceSecretResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDeviceSecretResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists DeviceSecret records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamDeviceSecret(DeviceSid string, params *ListDeviceSecr return recordChannel, errorChannel } + func (c *ApiService) streamDeviceSecret(response *ListDeviceSecretResponse, params *ListDeviceSecretParams, recordChannel chan MicrovisorV1DeviceSecret, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamDeviceSecret(response *ListDeviceSecretResponse, para } func (c *ApiService) getNextListDeviceSecretResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDeviceSecretResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDeviceSecretResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateDeviceSecret' type UpdateDeviceSecretParams struct { - // The secret value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The secret value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *UpdateDeviceSecretParams) SetValue(Value string) *UpdateDeviceSecretParams { - params.Value = &Value - return params +func (params *UpdateDeviceSecretParams) SetValue(Value string) (*UpdateDeviceSecretParams){ + params.Value = &Value + return params } // Update a secret for a Microvisor Device. func (c *ApiService) UpdateDeviceSecret(DeviceSid string, Key string, params *UpdateDeviceSecretParams) (*MicrovisorV1DeviceSecret, error) { - path := "/v1/Devices/{DeviceSid}/Secrets/{Key}" - path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + path := "/v1/Devices/{DeviceSid}/Secrets/{Key}" + path = strings.Replace(path, "{"+"DeviceSid"+"}", DeviceSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MicrovisorV1DeviceSecret{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MicrovisorV1DeviceSecret{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/microvisor/v1/docs/ListAccountConfigResponseMeta.md b/rest/microvisor/v1/docs/ListAccountConfigResponseMeta.md index 5e7a4ede0..779a1d466 100644 --- a/rest/microvisor/v1/docs/ListAccountConfigResponseMeta.md +++ b/rest/microvisor/v1/docs/ListAccountConfigResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/microvisor/v1/model_list_account_config_response.go b/rest/microvisor/v1/model_list_account_config_response.go index 0c06d5cf5..1dc548848 100644 --- a/rest/microvisor/v1/model_list_account_config_response.go +++ b/rest/microvisor/v1/model_list_account_config_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAccountConfigResponse struct for ListAccountConfigResponse type ListAccountConfigResponse struct { - Configs []MicrovisorV1AccountConfig `json:"configs,omitempty"` - Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` + Configs []MicrovisorV1AccountConfig `json:"configs,omitempty"` + Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/microvisor/v1/model_list_account_config_response_meta.go b/rest/microvisor/v1/model_list_account_config_response_meta.go index 734126b35..0fe3d8f6c 100644 --- a/rest/microvisor/v1/model_list_account_config_response_meta.go +++ b/rest/microvisor/v1/model_list_account_config_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAccountConfigResponseMeta struct for ListAccountConfigResponseMeta type ListAccountConfigResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/microvisor/v1/model_list_account_secret_response.go b/rest/microvisor/v1/model_list_account_secret_response.go index 18711dc5f..c75584921 100644 --- a/rest/microvisor/v1/model_list_account_secret_response.go +++ b/rest/microvisor/v1/model_list_account_secret_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAccountSecretResponse struct for ListAccountSecretResponse type ListAccountSecretResponse struct { - Secrets []MicrovisorV1AccountSecret `json:"secrets,omitempty"` - Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` + Secrets []MicrovisorV1AccountSecret `json:"secrets,omitempty"` + Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/microvisor/v1/model_list_app_response.go b/rest/microvisor/v1/model_list_app_response.go index 471d57088..2eaa2ca14 100644 --- a/rest/microvisor/v1/model_list_app_response.go +++ b/rest/microvisor/v1/model_list_app_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAppResponse struct for ListAppResponse type ListAppResponse struct { - Apps []MicrovisorV1App `json:"apps,omitempty"` + Apps []MicrovisorV1App `json:"apps,omitempty"` Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/microvisor/v1/model_list_device_config_response.go b/rest/microvisor/v1/model_list_device_config_response.go index cddfb2947..12cfeab56 100644 --- a/rest/microvisor/v1/model_list_device_config_response.go +++ b/rest/microvisor/v1/model_list_device_config_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDeviceConfigResponse struct for ListDeviceConfigResponse type ListDeviceConfigResponse struct { - Configs []MicrovisorV1DeviceConfig `json:"configs,omitempty"` - Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` + Configs []MicrovisorV1DeviceConfig `json:"configs,omitempty"` + Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/microvisor/v1/model_list_device_response.go b/rest/microvisor/v1/model_list_device_response.go index 353e5efaa..c4203dad0 100644 --- a/rest/microvisor/v1/model_list_device_response.go +++ b/rest/microvisor/v1/model_list_device_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDeviceResponse struct for ListDeviceResponse type ListDeviceResponse struct { - Devices []MicrovisorV1Device `json:"devices,omitempty"` - Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` + Devices []MicrovisorV1Device `json:"devices,omitempty"` + Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/microvisor/v1/model_list_device_secret_response.go b/rest/microvisor/v1/model_list_device_secret_response.go index bf3c850d7..5fb14b8a3 100644 --- a/rest/microvisor/v1/model_list_device_secret_response.go +++ b/rest/microvisor/v1/model_list_device_secret_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDeviceSecretResponse struct for ListDeviceSecretResponse type ListDeviceSecretResponse struct { - Secrets []MicrovisorV1DeviceSecret `json:"secrets,omitempty"` - Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` + Secrets []MicrovisorV1DeviceSecret `json:"secrets,omitempty"` + Meta ListAccountConfigResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_account_config.go b/rest/microvisor/v1/model_microvisor_v1_account_config.go index 2b5760a72..afbf7f7c4 100644 --- a/rest/microvisor/v1/model_microvisor_v1_account_config.go +++ b/rest/microvisor/v1/model_microvisor_v1_account_config.go @@ -13,18 +13,20 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MicrovisorV1AccountConfig struct for MicrovisorV1AccountConfig type MicrovisorV1AccountConfig struct { - // The config key; up to 100 characters. - Key *string `json:"key,omitempty"` + // The config key; up to 100 characters. + Key *string `json:"key,omitempty"` DateUpdated *time.Time `json:"date_updated,omitempty"` - // The config value; up to 4096 characters. + // The config value; up to 4096 characters. Value *string `json:"value,omitempty"` - // The absolute URL of the Config. + // The absolute URL of the Config. Url *string `json:"url,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_account_secret.go b/rest/microvisor/v1/model_microvisor_v1_account_secret.go index 8624d0bb4..9c82cb91b 100644 --- a/rest/microvisor/v1/model_microvisor_v1_account_secret.go +++ b/rest/microvisor/v1/model_microvisor_v1_account_secret.go @@ -13,16 +13,18 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MicrovisorV1AccountSecret struct for MicrovisorV1AccountSecret type MicrovisorV1AccountSecret struct { - // The secret key; up to 100 characters. - Key *string `json:"key,omitempty"` + // The secret key; up to 100 characters. + Key *string `json:"key,omitempty"` DateRotated *time.Time `json:"date_rotated,omitempty"` - // The absolute URL of the Secret. + // The absolute URL of the Secret. Url *string `json:"url,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_app.go b/rest/microvisor/v1/model_microvisor_v1_app.go index 9984c72be..41c3f3433 100644 --- a/rest/microvisor/v1/model_microvisor_v1_app.go +++ b/rest/microvisor/v1/model_microvisor_v1_app.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MicrovisorV1App struct for MicrovisorV1App type MicrovisorV1App struct { - // A 34-character string that uniquely identifies this App. + // A 34-character string that uniquely identifies this App. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // App manifest hash represented as `hash_algorithm:hash_value`. + // App manifest hash represented as `hash_algorithm:hash_value`. Hash *string `json:"hash,omitempty"` - // A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. + // A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL of this resource. - Url *string `json:"url,omitempty"` + // The URL of this resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_app_manifest.go b/rest/microvisor/v1/model_microvisor_v1_app_manifest.go index 886118d27..52b2ee4ba 100644 --- a/rest/microvisor/v1/model_microvisor_v1_app_manifest.go +++ b/rest/microvisor/v1/model_microvisor_v1_app_manifest.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // MicrovisorV1AppManifest struct for MicrovisorV1AppManifest type MicrovisorV1AppManifest struct { - // A 34-character string that uniquely identifies this App. + // A 34-character string that uniquely identifies this App. AppSid *string `json:"app_sid,omitempty"` - // App manifest hash represented as `hash_algorithm:hash_value`. + // App manifest hash represented as `hash_algorithm:hash_value`. Hash *string `json:"hash,omitempty"` - // The base-64 encoded manifest + // The base-64 encoded manifest EncodedBytes *string `json:"encoded_bytes,omitempty"` - // The absolute URL of this Manifest. + // The absolute URL of this Manifest. Url *string `json:"url,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_device.go b/rest/microvisor/v1/model_microvisor_v1_device.go index 426ce7d74..eaf51e3d9 100644 --- a/rest/microvisor/v1/model_microvisor_v1_device.go +++ b/rest/microvisor/v1/model_microvisor_v1_device.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MicrovisorV1Device struct for MicrovisorV1Device type MicrovisorV1Device struct { - // A 34-character string that uniquely identifies this Device. + // A 34-character string that uniquely identifies this Device. Sid *string `json:"sid,omitempty"` - // A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. + // A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. + // Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. App *interface{} `json:"app,omitempty"` - // Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. + // Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. Logging *interface{} `json:"logging,omitempty"` - // The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // The absolute URLs of related resources. + // The absolute URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_device_config.go b/rest/microvisor/v1/model_microvisor_v1_device_config.go index 7e08a9b50..1be944e97 100644 --- a/rest/microvisor/v1/model_microvisor_v1_device_config.go +++ b/rest/microvisor/v1/model_microvisor_v1_device_config.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MicrovisorV1DeviceConfig struct for MicrovisorV1DeviceConfig type MicrovisorV1DeviceConfig struct { - // A 34-character string that uniquely identifies the parent Device. + // A 34-character string that uniquely identifies the parent Device. DeviceSid *string `json:"device_sid,omitempty"` - // The config key; up to 100 characters. + // The config key; up to 100 characters. Key *string `json:"key,omitempty"` - // The config value; up to 4096 characters. - Value *string `json:"value,omitempty"` + // The config value; up to 4096 characters. + Value *string `json:"value,omitempty"` DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Config. + // The absolute URL of the Config. Url *string `json:"url,omitempty"` } + + diff --git a/rest/microvisor/v1/model_microvisor_v1_device_secret.go b/rest/microvisor/v1/model_microvisor_v1_device_secret.go index 8a5b53461..08377dc5c 100644 --- a/rest/microvisor/v1/model_microvisor_v1_device_secret.go +++ b/rest/microvisor/v1/model_microvisor_v1_device_secret.go @@ -13,18 +13,20 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MicrovisorV1DeviceSecret struct for MicrovisorV1DeviceSecret type MicrovisorV1DeviceSecret struct { - // A 34-character string that uniquely identifies the parent Device. + // A 34-character string that uniquely identifies the parent Device. DeviceSid *string `json:"device_sid,omitempty"` - // The secret key; up to 100 characters. - Key *string `json:"key,omitempty"` + // The secret key; up to 100 characters. + Key *string `json:"key,omitempty"` DateRotated *time.Time `json:"date_rotated,omitempty"` - // The absolute URL of the Secret. + // The absolute URL of the Secret. Url *string `json:"url,omitempty"` } + + diff --git a/rest/microvisor/v1/secrets.go b/rest/microvisor/v1/secrets.go index 12d2ce8e1..843689b4a 100644 --- a/rest/microvisor/v1/secrets.go +++ b/rest/microvisor/v1/secrets.go @@ -18,146 +18,152 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAccountSecret' type CreateAccountSecretParams struct { - // The secret key; up to 100 characters. - Key *string `json:"Key,omitempty"` - // The secret value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The secret key; up to 100 characters. + Key *string `json:"Key,omitempty"` + // The secret value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *CreateAccountSecretParams) SetKey(Key string) *CreateAccountSecretParams { - params.Key = &Key - return params +func (params *CreateAccountSecretParams) SetKey(Key string) (*CreateAccountSecretParams){ + params.Key = &Key + return params } -func (params *CreateAccountSecretParams) SetValue(Value string) *CreateAccountSecretParams { - params.Value = &Value - return params +func (params *CreateAccountSecretParams) SetValue(Value string) (*CreateAccountSecretParams){ + params.Value = &Value + return params } // Create a secret for an Account. func (c *ApiService) CreateAccountSecret(params *CreateAccountSecretParams) (*MicrovisorV1AccountSecret, error) { - path := "/v1/Secrets" + path := "/v1/Secrets" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &MicrovisorV1AccountSecret{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &MicrovisorV1AccountSecret{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a secret for an Account. -func (c *ApiService) DeleteAccountSecret(Key string) error { - path := "/v1/Secrets/{Key}" - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) DeleteAccountSecret(Key string, ) (error) { + path := "/v1/Secrets/{Key}" + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a Secret for an Account. -func (c *ApiService) FetchAccountSecret(Key string) (*MicrovisorV1AccountSecret, error) { - path := "/v1/Secrets/{Key}" - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +func (c *ApiService) FetchAccountSecret(Key string, ) (*MicrovisorV1AccountSecret, error) { + path := "/v1/Secrets/{Key}" + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &MicrovisorV1AccountSecret{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &MicrovisorV1AccountSecret{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAccountSecret' type ListAccountSecretParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAccountSecretParams) SetPageSize(PageSize int) *ListAccountSecretParams { - params.PageSize = &PageSize - return params +func (params *ListAccountSecretParams) SetPageSize(PageSize int) (*ListAccountSecretParams){ + params.PageSize = &PageSize + return params } -func (params *ListAccountSecretParams) SetLimit(Limit int) *ListAccountSecretParams { - params.Limit = &Limit - return params +func (params *ListAccountSecretParams) SetLimit(Limit int) (*ListAccountSecretParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AccountSecret records from the API. Request is executed immediately. func (c *ApiService) PageAccountSecret(params *ListAccountSecretParams, pageToken, pageNumber string) (*ListAccountSecretResponse, error) { - path := "/v1/Secrets" + path := "/v1/Secrets" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAccountSecretResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAccountSecretResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AccountSecret records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -198,6 +204,7 @@ func (c *ApiService) StreamAccountSecret(params *ListAccountSecretParams) (chan return recordChannel, errorChannel } + func (c *ApiService) streamAccountSecret(response *ListAccountSecretResponse, params *ListAccountSecretParams, recordChannel chan MicrovisorV1AccountSecret, errorChannel chan error) { curRecord := 1 @@ -229,57 +236,59 @@ func (c *ApiService) streamAccountSecret(response *ListAccountSecretResponse, pa } func (c *ApiService) getNextListAccountSecretResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAccountSecretResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAccountSecretResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateAccountSecret' type UpdateAccountSecretParams struct { - // The secret value; up to 4096 characters. - Value *string `json:"Value,omitempty"` + // The secret value; up to 4096 characters. + Value *string `json:"Value,omitempty"` } -func (params *UpdateAccountSecretParams) SetValue(Value string) *UpdateAccountSecretParams { - params.Value = &Value - return params +func (params *UpdateAccountSecretParams) SetValue(Value string) (*UpdateAccountSecretParams){ + params.Value = &Value + return params } // Update a secret for an Account. func (c *ApiService) UpdateAccountSecret(Key string, params *UpdateAccountSecretParams) (*MicrovisorV1AccountSecret, error) { - path := "/v1/Secrets/{Key}" - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + path := "/v1/Secrets/{Key}" + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &MicrovisorV1AccountSecret{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &MicrovisorV1AccountSecret{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/monitor/v1/README.md b/rest/monitor/v1/README.md index 778d309b0..afba156ea 100644 --- a/rest/monitor/v1/README.md +++ b/rest/monitor/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/monitor/v1/alerts.go b/rest/monitor/v1/alerts.go index 7fc808c65..f0cff5a9b 100644 --- a/rest/monitor/v1/alerts.go +++ b/rest/monitor/v1/alerts.go @@ -18,110 +18,112 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchAlert(Sid string) (*MonitorV1AlertInstance, error) { - path := "/v1/Alerts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchAlert(Sid string, ) (*MonitorV1AlertInstance, error) { + path := "/v1/Alerts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &MonitorV1AlertInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MonitorV1AlertInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAlert' type ListAlertParams struct { - // Only show alerts for this log-level. Can be: `error`, `warning`, `notice`, or `debug`. - LogLevel *string `json:"LogLevel,omitempty"` - // Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. - EndDate *time.Time `json:"EndDate,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only show alerts for this log-level. Can be: `error`, `warning`, `notice`, or `debug`. + LogLevel *string `json:"LogLevel,omitempty"` + // Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. + EndDate *time.Time `json:"EndDate,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAlertParams) SetLogLevel(LogLevel string) *ListAlertParams { - params.LogLevel = &LogLevel - return params +func (params *ListAlertParams) SetLogLevel(LogLevel string) (*ListAlertParams){ + params.LogLevel = &LogLevel + return params } -func (params *ListAlertParams) SetStartDate(StartDate time.Time) *ListAlertParams { - params.StartDate = &StartDate - return params +func (params *ListAlertParams) SetStartDate(StartDate time.Time) (*ListAlertParams){ + params.StartDate = &StartDate + return params } -func (params *ListAlertParams) SetEndDate(EndDate time.Time) *ListAlertParams { - params.EndDate = &EndDate - return params +func (params *ListAlertParams) SetEndDate(EndDate time.Time) (*ListAlertParams){ + params.EndDate = &EndDate + return params } -func (params *ListAlertParams) SetPageSize(PageSize int) *ListAlertParams { - params.PageSize = &PageSize - return params +func (params *ListAlertParams) SetPageSize(PageSize int) (*ListAlertParams){ + params.PageSize = &PageSize + return params } -func (params *ListAlertParams) SetLimit(Limit int) *ListAlertParams { - params.Limit = &Limit - return params +func (params *ListAlertParams) SetLimit(Limit int) (*ListAlertParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Alert records from the API. Request is executed immediately. func (c *ApiService) PageAlert(params *ListAlertParams, pageToken, pageNumber string) (*ListAlertResponse, error) { - path := "/v1/Alerts" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.LogLevel != nil { - data.Set("LogLevel", *params.LogLevel) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAlertResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Alerts" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.LogLevel != nil { + data.Set("LogLevel", *params.LogLevel) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAlertResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Alert records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -162,6 +164,7 @@ func (c *ApiService) StreamAlert(params *ListAlertParams) (chan MonitorV1Alert, return recordChannel, errorChannel } + func (c *ApiService) streamAlert(response *ListAlertResponse, params *ListAlertParams, recordChannel chan MonitorV1Alert, errorChannel chan error) { curRecord := 1 @@ -193,19 +196,20 @@ func (c *ApiService) streamAlert(response *ListAlertResponse, params *ListAlertP } func (c *ApiService) getNextListAlertResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAlertResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAlertResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/monitor/v1/api_service.go b/rest/monitor/v1/api_service.go index c1d89c5b3..f85e77e5f 100644 --- a/rest/monitor/v1/api_service.go +++ b/rest/monitor/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://monitor.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/monitor/v1/docs/ListAlertResponseMeta.md b/rest/monitor/v1/docs/ListAlertResponseMeta.md index dcc1226e3..d1149f4ee 100644 --- a/rest/monitor/v1/docs/ListAlertResponseMeta.md +++ b/rest/monitor/v1/docs/ListAlertResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/monitor/v1/events.go b/rest/monitor/v1/events.go index 98492ac46..5a1eb1cda 100644 --- a/rest/monitor/v1/events.go +++ b/rest/monitor/v1/events.go @@ -18,137 +18,139 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchEvent(Sid string) (*MonitorV1Event, error) { - path := "/v1/Events/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchEvent(Sid string, ) (*MonitorV1Event, error) { + path := "/v1/Events/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &MonitorV1Event{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &MonitorV1Event{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEvent' type ListEventParams struct { - // Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials. - ActorSid *string `json:"ActorSid,omitempty"` - // Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types). - EventType *string `json:"EventType,omitempty"` - // Only include events that refer to this resource. Useful for discovering the history of a specific resource. - ResourceSid *string `json:"ResourceSid,omitempty"` - // Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console. - SourceIpAddress *string `json:"SourceIpAddress,omitempty"` - // Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - EndDate *time.Time `json:"EndDate,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials. + ActorSid *string `json:"ActorSid,omitempty"` + // Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types). + EventType *string `json:"EventType,omitempty"` + // Only include events that refer to this resource. Useful for discovering the history of a specific resource. + ResourceSid *string `json:"ResourceSid,omitempty"` + // Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console. + SourceIpAddress *string `json:"SourceIpAddress,omitempty"` + // Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + EndDate *time.Time `json:"EndDate,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEventParams) SetActorSid(ActorSid string) *ListEventParams { - params.ActorSid = &ActorSid - return params +func (params *ListEventParams) SetActorSid(ActorSid string) (*ListEventParams){ + params.ActorSid = &ActorSid + return params } -func (params *ListEventParams) SetEventType(EventType string) *ListEventParams { - params.EventType = &EventType - return params +func (params *ListEventParams) SetEventType(EventType string) (*ListEventParams){ + params.EventType = &EventType + return params } -func (params *ListEventParams) SetResourceSid(ResourceSid string) *ListEventParams { - params.ResourceSid = &ResourceSid - return params +func (params *ListEventParams) SetResourceSid(ResourceSid string) (*ListEventParams){ + params.ResourceSid = &ResourceSid + return params } -func (params *ListEventParams) SetSourceIpAddress(SourceIpAddress string) *ListEventParams { - params.SourceIpAddress = &SourceIpAddress - return params +func (params *ListEventParams) SetSourceIpAddress(SourceIpAddress string) (*ListEventParams){ + params.SourceIpAddress = &SourceIpAddress + return params } -func (params *ListEventParams) SetStartDate(StartDate time.Time) *ListEventParams { - params.StartDate = &StartDate - return params +func (params *ListEventParams) SetStartDate(StartDate time.Time) (*ListEventParams){ + params.StartDate = &StartDate + return params } -func (params *ListEventParams) SetEndDate(EndDate time.Time) *ListEventParams { - params.EndDate = &EndDate - return params +func (params *ListEventParams) SetEndDate(EndDate time.Time) (*ListEventParams){ + params.EndDate = &EndDate + return params } -func (params *ListEventParams) SetPageSize(PageSize int) *ListEventParams { - params.PageSize = &PageSize - return params +func (params *ListEventParams) SetPageSize(PageSize int) (*ListEventParams){ + params.PageSize = &PageSize + return params } -func (params *ListEventParams) SetLimit(Limit int) *ListEventParams { - params.Limit = &Limit - return params +func (params *ListEventParams) SetLimit(Limit int) (*ListEventParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Event records from the API. Request is executed immediately. func (c *ApiService) PageEvent(params *ListEventParams, pageToken, pageNumber string) (*ListEventResponse, error) { - path := "/v1/Events" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ActorSid != nil { - data.Set("ActorSid", *params.ActorSid) - } - if params != nil && params.EventType != nil { - data.Set("EventType", *params.EventType) - } - if params != nil && params.ResourceSid != nil { - data.Set("ResourceSid", *params.ResourceSid) - } - if params != nil && params.SourceIpAddress != nil { - data.Set("SourceIpAddress", *params.SourceIpAddress) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Events" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ActorSid != nil { + data.Set("ActorSid", *params.ActorSid) + } + if params != nil && params.EventType != nil { + data.Set("EventType", *params.EventType) + } + if params != nil && params.ResourceSid != nil { + data.Set("ResourceSid", *params.ResourceSid) + } + if params != nil && params.SourceIpAddress != nil { + data.Set("SourceIpAddress", *params.SourceIpAddress) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Event records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +191,7 @@ func (c *ApiService) StreamEvent(params *ListEventParams) (chan MonitorV1Event, return recordChannel, errorChannel } + func (c *ApiService) streamEvent(response *ListEventResponse, params *ListEventParams, recordChannel chan MonitorV1Event, errorChannel chan error) { curRecord := 1 @@ -220,19 +223,20 @@ func (c *ApiService) streamEvent(response *ListEventResponse, params *ListEventP } func (c *ApiService) getNextListEventResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/monitor/v1/model_list_alert_response.go b/rest/monitor/v1/model_list_alert_response.go index 2e945e689..423933b35 100644 --- a/rest/monitor/v1/model_list_alert_response.go +++ b/rest/monitor/v1/model_list_alert_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAlertResponse struct for ListAlertResponse type ListAlertResponse struct { - Alerts []MonitorV1Alert `json:"alerts,omitempty"` - Meta ListAlertResponseMeta `json:"meta,omitempty"` + Alerts []MonitorV1Alert `json:"alerts,omitempty"` + Meta ListAlertResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/monitor/v1/model_list_alert_response_meta.go b/rest/monitor/v1/model_list_alert_response_meta.go index cfbc0259c..471a959c8 100644 --- a/rest/monitor/v1/model_list_alert_response_meta.go +++ b/rest/monitor/v1/model_list_alert_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAlertResponseMeta struct for ListAlertResponseMeta type ListAlertResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/monitor/v1/model_list_event_response.go b/rest/monitor/v1/model_list_event_response.go index e878699fa..7848dd907 100644 --- a/rest/monitor/v1/model_list_event_response.go +++ b/rest/monitor/v1/model_list_event_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEventResponse struct for ListEventResponse type ListEventResponse struct { - Events []MonitorV1Event `json:"events,omitempty"` - Meta ListAlertResponseMeta `json:"meta,omitempty"` + Events []MonitorV1Event `json:"events,omitempty"` + Meta ListAlertResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/monitor/v1/model_monitor_v1_alert.go b/rest/monitor/v1/model_monitor_v1_alert.go index 5beb57fad..f9eda67ef 100644 --- a/rest/monitor/v1/model_monitor_v1_alert.go +++ b/rest/monitor/v1/model_monitor_v1_alert.go @@ -13,41 +13,43 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MonitorV1Alert struct for MonitorV1Alert type MonitorV1Alert struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. AccountSid *string `json:"account_sid,omitempty"` - // The text of the alert. + // The text of the alert. AlertText *string `json:"alert_text,omitempty"` - // The API version used when the alert was generated. Can be empty for events that don't have a specific API version. + // The API version used when the alert was generated. Can be empty for events that don't have a specific API version. ApiVersion *string `json:"api_version,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. + // The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. DateGenerated *time.Time `json:"date_generated,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. + // The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. ErrorCode *string `json:"error_code,omitempty"` - // The log level. Can be: `error`, `warning`, `notice`, or `debug`. + // The log level. Can be: `error`, `warning`, `notice`, or `debug`. LogLevel *string `json:"log_level,omitempty"` - // The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. + // The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. MoreInfo *string `json:"more_info,omitempty"` - // The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. + // The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. RequestMethod *string `json:"request_method,omitempty"` - // The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. + // The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. RequestUrl *string `json:"request_url,omitempty"` - // The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. + // The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. ResourceSid *string `json:"resource_sid,omitempty"` - // The unique string that we created to identify the Alert resource. + // The unique string that we created to identify the Alert resource. Sid *string `json:"sid,omitempty"` - // The absolute URL of the Alert resource. + // The absolute URL of the Alert resource. Url *string `json:"url,omitempty"` - // The SID of the service or resource that generated the alert. Can be `null`. + // The SID of the service or resource that generated the alert. Can be `null`. ServiceSid *string `json:"service_sid,omitempty"` } + + diff --git a/rest/monitor/v1/model_monitor_v1_alert_instance.go b/rest/monitor/v1/model_monitor_v1_alert_instance.go index 49ef7c489..bf28f3ddb 100644 --- a/rest/monitor/v1/model_monitor_v1_alert_instance.go +++ b/rest/monitor/v1/model_monitor_v1_alert_instance.go @@ -13,49 +13,51 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MonitorV1AlertInstance struct for MonitorV1AlertInstance type MonitorV1AlertInstance struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. AccountSid *string `json:"account_sid,omitempty"` - // The text of the alert. + // The text of the alert. AlertText *string `json:"alert_text,omitempty"` - // The API version used when the alert was generated. Can be empty for events that don't have a specific API version. + // The API version used when the alert was generated. Can be empty for events that don't have a specific API version. ApiVersion *string `json:"api_version,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. + // The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. DateGenerated *time.Time `json:"date_generated,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. + // The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. ErrorCode *string `json:"error_code,omitempty"` - // The log level. Can be: `error`, `warning`, `notice`, or `debug`. + // The log level. Can be: `error`, `warning`, `notice`, or `debug`. LogLevel *string `json:"log_level,omitempty"` - // The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. + // The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. MoreInfo *string `json:"more_info,omitempty"` - // The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. + // The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. RequestMethod *string `json:"request_method,omitempty"` - // The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. + // The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. RequestUrl *string `json:"request_url,omitempty"` - // The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched. + // The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched. RequestVariables *string `json:"request_variables,omitempty"` - // The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. + // The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. ResourceSid *string `json:"resource_sid,omitempty"` - // The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched. + // The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched. ResponseBody *string `json:"response_body,omitempty"` - // The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. + // The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. ResponseHeaders *string `json:"response_headers,omitempty"` - // The unique string that we created to identify the Alert resource. + // The unique string that we created to identify the Alert resource. Sid *string `json:"sid,omitempty"` - // The absolute URL of the Alert resource. + // The absolute URL of the Alert resource. Url *string `json:"url,omitempty"` - // The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. + // The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. RequestHeaders *string `json:"request_headers,omitempty"` - // The SID of the service or resource that generated the alert. Can be `null`. + // The SID of the service or resource that generated the alert. Can be `null`. ServiceSid *string `json:"service_sid,omitempty"` } + + diff --git a/rest/monitor/v1/model_monitor_v1_event.go b/rest/monitor/v1/model_monitor_v1_event.go index 3d84af1f2..1a3c88842 100644 --- a/rest/monitor/v1/model_monitor_v1_event.go +++ b/rest/monitor/v1/model_monitor_v1_event.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // MonitorV1Event struct for MonitorV1Event type MonitorV1Event struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the actor that caused the event, if available. Can be `null`. + // The SID of the actor that caused the event, if available. Can be `null`. ActorSid *string `json:"actor_sid,omitempty"` - // The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on. + // The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on. ActorType *string `json:"actor_type,omitempty"` - // A description of the event. Can be `null`. + // A description of the event. Can be `null`. Description *string `json:"description,omitempty"` - // An object with additional data about the event. The contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource. + // An object with additional data about the event. The contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource. EventData *interface{} `json:"event_data,omitempty"` - // The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. EventDate *time.Time `json:"event_date,omitempty"` - // The event's type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). + // The event's type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). EventType *string `json:"event_type,omitempty"` - // The SID of the resource that was affected. + // The SID of the resource that was affected. ResourceSid *string `json:"resource_sid,omitempty"` - // The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). + // The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). ResourceType *string `json:"resource_type,omitempty"` - // The unique string that we created to identify the Event resource. + // The unique string that we created to identify the Event resource. Sid *string `json:"sid,omitempty"` - // The originating system or interface that caused the event. Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or `twilio` for events caused by an automated or internal Twilio system. + // The originating system or interface that caused the event. Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or `twilio` for events caused by an automated or internal Twilio system. Source *string `json:"source,omitempty"` - // The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio` + // The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio` SourceIpAddress *string `json:"source_ip_address,omitempty"` - // The absolute URL of the resource that was affected. Can be `null`. + // The absolute URL of the resource that was affected. Can be `null`. Url *string `json:"url,omitempty"` - // The absolute URLs of related resources. + // The absolute URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/notify/v1/README.md b/rest/notify/v1/README.md index 414e12e24..1c41c200a 100644 --- a/rest/notify/v1/README.md +++ b/rest/notify/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/notify/v1/api_service.go b/rest/notify/v1/api_service.go index ff6ad6508..c885e40ea 100644 --- a/rest/notify/v1/api_service.go +++ b/rest/notify/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://notify.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/notify/v1/credentials.go b/rest/notify/v1/credentials.go index 196d912d3..bde8a42e6 100644 --- a/rest/notify/v1/credentials.go +++ b/rest/notify/v1/credentials.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredential' type CreateCredentialParams struct { - // - Type *string `json:"Type,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // + Type *string `json:"Type,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *CreateCredentialParams) SetType(Type string) *CreateCredentialParams { - params.Type = &Type - return params +func (params *CreateCredentialParams) SetType(Type string) (*CreateCredentialParams){ + params.Type = &Type + return params } -func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) *CreateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCredentialParams) SetFriendlyName(FriendlyName string) (*CreateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCredentialParams) SetCertificate(Certificate string) *CreateCredentialParams { - params.Certificate = &Certificate - return params +func (params *CreateCredentialParams) SetCertificate(Certificate string) (*CreateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) *CreateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *CreateCredentialParams) SetPrivateKey(PrivateKey string) (*CreateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *CreateCredentialParams) SetSandbox(Sandbox bool) *CreateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *CreateCredentialParams) SetSandbox(Sandbox bool) (*CreateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *CreateCredentialParams) SetApiKey(ApiKey string) *CreateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *CreateCredentialParams) SetApiKey(ApiKey string) (*CreateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *CreateCredentialParams) SetSecret(Secret string) *CreateCredentialParams { - params.Secret = &Secret - return params +func (params *CreateCredentialParams) SetSecret(Secret string) (*CreateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) CreateCredential(params *CreateCredentialParams) (*NotifyV1Credential, error) { - path := "/v1/Credentials" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Credentials" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NotifyV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } +// +func (c *ApiService) DeleteCredential(Sid string, ) (error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &NotifyV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteCredential(Sid string) error { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchCredential(Sid string, ) (*NotifyV1Credential, error) { + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchCredential(Sid string) (*NotifyV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &NotifyV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &NotifyV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListCredential' type ListCredentialParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialParams) SetPageSize(PageSize int) *ListCredentialParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialParams) SetPageSize(PageSize int) (*ListCredentialParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialParams) SetLimit(Limit int) *ListCredentialParams { - params.Limit = &Limit - return params +func (params *ListCredentialParams) SetLimit(Limit int) (*ListCredentialParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Credential records from the API. Request is executed immediately. func (c *ApiService) PageCredential(params *ListCredentialParams, pageToken, pageNumber string) (*ListCredentialResponse, error) { - path := "/v1/Credentials" + path := "/v1/Credentials" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Credential records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCredential(params *ListCredentialParams) (chan Notify return recordChannel, errorChannel } + func (c *ApiService) streamCredential(response *ListCredentialResponse, params *ListCredentialParams, recordChannel chan NotifyV1Credential, errorChannel chan error) { curRecord := 1 @@ -274,102 +281,104 @@ func (c *ApiService) streamCredential(response *ListCredentialResponse, params * } func (c *ApiService) getNextListCredentialResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCredential' type UpdateCredentialParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` - Certificate *string `json:"Certificate,omitempty"` - // [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` - PrivateKey *string `json:"PrivateKey,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - Sandbox *bool `json:"Sandbox,omitempty"` - // [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. - ApiKey *string `json:"ApiKey,omitempty"` - // [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. - Secret *string `json:"Secret,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` + Certificate *string `json:"Certificate,omitempty"` + // [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\\\\n.-----END RSA PRIVATE KEY-----` + PrivateKey *string `json:"PrivateKey,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Sandbox *bool `json:"Sandbox,omitempty"` + // [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. + ApiKey *string `json:"ApiKey,omitempty"` + // [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. + Secret *string `json:"Secret,omitempty"` } -func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) *UpdateCredentialParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCredentialParams) SetFriendlyName(FriendlyName string) (*UpdateCredentialParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCredentialParams) SetCertificate(Certificate string) *UpdateCredentialParams { - params.Certificate = &Certificate - return params +func (params *UpdateCredentialParams) SetCertificate(Certificate string) (*UpdateCredentialParams){ + params.Certificate = &Certificate + return params } -func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) *UpdateCredentialParams { - params.PrivateKey = &PrivateKey - return params +func (params *UpdateCredentialParams) SetPrivateKey(PrivateKey string) (*UpdateCredentialParams){ + params.PrivateKey = &PrivateKey + return params } -func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) *UpdateCredentialParams { - params.Sandbox = &Sandbox - return params +func (params *UpdateCredentialParams) SetSandbox(Sandbox bool) (*UpdateCredentialParams){ + params.Sandbox = &Sandbox + return params } -func (params *UpdateCredentialParams) SetApiKey(ApiKey string) *UpdateCredentialParams { - params.ApiKey = &ApiKey - return params +func (params *UpdateCredentialParams) SetApiKey(ApiKey string) (*UpdateCredentialParams){ + params.ApiKey = &ApiKey + return params } -func (params *UpdateCredentialParams) SetSecret(Secret string) *UpdateCredentialParams { - params.Secret = &Secret - return params +func (params *UpdateCredentialParams) SetSecret(Secret string) (*UpdateCredentialParams){ + params.Secret = &Secret + return params } -// +// func (c *ApiService) UpdateCredential(Sid string, params *UpdateCredentialParams) (*NotifyV1Credential, error) { - path := "/v1/Credentials/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Certificate != nil { - data.Set("Certificate", *params.Certificate) - } - if params != nil && params.PrivateKey != nil { - data.Set("PrivateKey", *params.PrivateKey) - } - if params != nil && params.Sandbox != nil { - data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) - } - if params != nil && params.ApiKey != nil { - data.Set("ApiKey", *params.ApiKey) - } - if params != nil && params.Secret != nil { - data.Set("Secret", *params.Secret) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NotifyV1Credential{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Credentials/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Certificate != nil { + data.Set("Certificate", *params.Certificate) + } + if params != nil && params.PrivateKey != nil { + data.Set("PrivateKey", *params.PrivateKey) + } + if params != nil && params.Sandbox != nil { + data.Set("Sandbox", fmt.Sprint(*params.Sandbox)) + } + if params != nil && params.ApiKey != nil { + data.Set("ApiKey", *params.ApiKey) + } + if params != nil && params.Secret != nil { + data.Set("Secret", *params.Secret) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NotifyV1Credential{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/notify/v1/docs/ListBindingResponseMeta.md b/rest/notify/v1/docs/ListBindingResponseMeta.md index f40b7bc19..fcd580e38 100644 --- a/rest/notify/v1/docs/ListBindingResponseMeta.md +++ b/rest/notify/v1/docs/ListBindingResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/notify/v1/model_list_binding_response.go b/rest/notify/v1/model_list_binding_response.go index 45c2dd733..9d1635e6d 100644 --- a/rest/notify/v1/model_list_binding_response.go +++ b/rest/notify/v1/model_list_binding_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBindingResponse struct for ListBindingResponse type ListBindingResponse struct { - Bindings []NotifyV1Binding `json:"bindings,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Bindings []NotifyV1Binding `json:"bindings,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/notify/v1/model_list_binding_response_meta.go b/rest/notify/v1/model_list_binding_response_meta.go index 4da24841c..bc4b85b5d 100644 --- a/rest/notify/v1/model_list_binding_response_meta.go +++ b/rest/notify/v1/model_list_binding_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBindingResponseMeta struct for ListBindingResponseMeta type ListBindingResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/notify/v1/model_list_credential_response.go b/rest/notify/v1/model_list_credential_response.go index effa4bf91..46b1afb6c 100644 --- a/rest/notify/v1/model_list_credential_response.go +++ b/rest/notify/v1/model_list_credential_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialResponse struct for ListCredentialResponse type ListCredentialResponse struct { - Credentials []NotifyV1Credential `json:"credentials,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Credentials []NotifyV1Credential `json:"credentials,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/notify/v1/model_list_service_response.go b/rest/notify/v1/model_list_service_response.go index e87a9326a..d877eea1b 100644 --- a/rest/notify/v1/model_list_service_response.go +++ b/rest/notify/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []NotifyV1Service `json:"services,omitempty"` - Meta ListBindingResponseMeta `json:"meta,omitempty"` + Services []NotifyV1Service `json:"services,omitempty"` + Meta ListBindingResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/notify/v1/model_notify_v1_binding.go b/rest/notify/v1/model_notify_v1_binding.go index ec0f72797..3215a936f 100644 --- a/rest/notify/v1/model_notify_v1_binding.go +++ b/rest/notify/v1/model_notify_v1_binding.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NotifyV1Binding struct for NotifyV1Binding type NotifyV1Binding struct { - // The unique string that we created to identify the Binding resource. + // The unique string that we created to identify the Binding resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to `apn`, `fcm`, and `gcm` type Bindings. + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to `apn`, `fcm`, and `gcm` type Bindings. CredentialSid *string `json:"credential_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` in the [Service](https://www.twilio.com/docs/notify/api/service-resource) for the protocol. The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. + // The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` in the [Service](https://www.twilio.com/docs/notify/api/service-resource) for the protocol. The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. NotificationProtocolVersion *string `json:"notification_protocol_version,omitempty"` - // Deprecated. + // Deprecated. Endpoint *string `json:"endpoint,omitempty"` - // The `identity` value that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. + // The `identity` value that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. Identity *string `json:"identity,omitempty"` - // The transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`. + // The transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`. BindingType *string `json:"binding_type,omitempty"` - // The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. + // The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. Address *string `json:"address,omitempty"` - // The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed. + // The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed. Tags *[]string `json:"tags,omitempty"` - // The absolute URL of the Binding resource. + // The absolute URL of the Binding resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/notify/v1/model_notify_v1_credential.go b/rest/notify/v1/model_notify_v1_credential.go index 3ef1a57c8..e422b57ba 100644 --- a/rest/notify/v1/model_notify_v1_credential.go +++ b/rest/notify/v1/model_notify_v1_credential.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NotifyV1Credential struct for NotifyV1Credential type NotifyV1Credential struct { - // The unique string that we created to identify the Credential resource. + // The unique string that we created to identify the Credential resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + Type *string `json:"type,omitempty"` + // [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. Sandbox *string `json:"sandbox,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Credential resource. + // The absolute URL of the Credential resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/notify/v1/model_notify_v1_notification.go b/rest/notify/v1/model_notify_v1_notification.go index 59f8cb077..5cbd9c651 100644 --- a/rest/notify/v1/model_notify_v1_notification.go +++ b/rest/notify/v1/model_notify_v1_notification.go @@ -13,50 +13,52 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NotifyV1Notification struct for NotifyV1Notification type NotifyV1Notification struct { - // The unique string that we created to identify the Notification resource. + // The unique string that we created to identify the Notification resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The list of `identity` values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list. + // The list of `identity` values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list. Identities *[]string `json:"identities,omitempty"` - // The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property. + // The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property. Tags *[]string `json:"tags,omitempty"` - // The list of Segments to notify. The [Segment](https://www.twilio.com/docs/notify/api/segment-resource) resource is deprecated. Use the `tags` property, instead. + // The list of Segments to notify. The [Segment](https://www.twilio.com/docs/notify/api/segment-resource) resource is deprecated. Use the `tags` property, instead. Segments *[]string `json:"segments,omitempty"` - Priority *string `json:"priority,omitempty"` - // How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. + Priority *string `json:"priority,omitempty"` + // How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. Ttl *int `json:"ttl,omitempty"` - // The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. + // The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. Title *string `json:"title,omitempty"` - // The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. + // The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. Body *string `json:"body,omitempty"` - // The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. + // The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. Sound *string `json:"sound,omitempty"` - // The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. + // The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. Action *string `json:"action,omitempty"` - // The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. + // The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. Data *interface{} `json:"data,omitempty"` - // The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. + // The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. Apn *interface{} `json:"apn,omitempty"` - // The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. + // The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. Gcm *interface{} `json:"gcm,omitempty"` - // The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. + // The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. Fcm *interface{} `json:"fcm,omitempty"` - // The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. + // The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. Sms *interface{} `json:"sms,omitempty"` - // Deprecated. + // Deprecated. FacebookMessenger *interface{} `json:"facebook_messenger,omitempty"` - // Deprecated. + // Deprecated. Alexa *interface{} `json:"alexa,omitempty"` } + + diff --git a/rest/notify/v1/model_notify_v1_service.go b/rest/notify/v1/model_notify_v1_service.go index d2b03d7f2..c6a9069ac 100644 --- a/rest/notify/v1/model_notify_v1_service.go +++ b/rest/notify/v1/model_notify_v1_service.go @@ -13,51 +13,53 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NotifyV1Service struct for NotifyV1Service type NotifyV1Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. ApnCredentialSid *string `json:"apn_credential_sid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. GcmCredentialSid *string `json:"gcm_credential_sid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. FcmCredentialSid *string `json:"fcm_credential_sid,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. + // The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // Deprecated. + // Deprecated. FacebookMessengerPageId *string `json:"facebook_messenger_page_id,omitempty"` - // The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + // The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. DefaultApnNotificationProtocolVersion *string `json:"default_apn_notification_protocol_version,omitempty"` - // The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + // The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. DefaultGcmNotificationProtocolVersion *string `json:"default_gcm_notification_protocol_version,omitempty"` - // The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + // The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. DefaultFcmNotificationProtocolVersion *string `json:"default_fcm_notification_protocol_version,omitempty"` - // Whether to log notifications. Can be: `true` or `false` and the default is `true`. + // Whether to log notifications. Can be: `true` or `false` and the default is `true`. LogEnabled *bool `json:"log_enabled,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The URLs of the Binding, Notification, Segment, and User resources related to the service. + // The URLs of the Binding, Notification, Segment, and User resources related to the service. Links *map[string]interface{} `json:"links,omitempty"` - // Deprecated. + // Deprecated. AlexaSkillId *string `json:"alexa_skill_id,omitempty"` - // Deprecated. + // Deprecated. DefaultAlexaNotificationProtocolVersion *string `json:"default_alexa_notification_protocol_version,omitempty"` - // URL to send delivery status callback. + // URL to send delivery status callback. DeliveryCallbackUrl *string `json:"delivery_callback_url,omitempty"` - // Callback configuration that enables delivery callbacks, default false + // Callback configuration that enables delivery callbacks, default false DeliveryCallbackEnabled *bool `json:"delivery_callback_enabled,omitempty"` } + + diff --git a/rest/notify/v1/services.go b/rest/notify/v1/services.go index 5a6e5f81e..05b13c6a5 100644 --- a/rest/notify/v1/services.go +++ b/rest/notify/v1/services.go @@ -18,263 +18,269 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. - ApnCredentialSid *string `json:"ApnCredentialSid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - GcmCredentialSid *string `json:"GcmCredentialSid,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // Deprecated. - FacebookMessengerPageId *string `json:"FacebookMessengerPageId,omitempty"` - // The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - DefaultApnNotificationProtocolVersion *string `json:"DefaultApnNotificationProtocolVersion,omitempty"` - // The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - DefaultGcmNotificationProtocolVersion *string `json:"DefaultGcmNotificationProtocolVersion,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. - FcmCredentialSid *string `json:"FcmCredentialSid,omitempty"` - // The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - DefaultFcmNotificationProtocolVersion *string `json:"DefaultFcmNotificationProtocolVersion,omitempty"` - // Whether to log notifications. Can be: `true` or `false` and the default is `true`. - LogEnabled *bool `json:"LogEnabled,omitempty"` - // Deprecated. - AlexaSkillId *string `json:"AlexaSkillId,omitempty"` - // Deprecated. - DefaultAlexaNotificationProtocolVersion *string `json:"DefaultAlexaNotificationProtocolVersion,omitempty"` - // URL to send delivery status callback. - DeliveryCallbackUrl *string `json:"DeliveryCallbackUrl,omitempty"` - // Callback configuration that enables delivery callbacks, default false - DeliveryCallbackEnabled *bool `json:"DeliveryCallbackEnabled,omitempty"` -} - -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateServiceParams) SetApnCredentialSid(ApnCredentialSid string) *CreateServiceParams { - params.ApnCredentialSid = &ApnCredentialSid - return params -} -func (params *CreateServiceParams) SetGcmCredentialSid(GcmCredentialSid string) *CreateServiceParams { - params.GcmCredentialSid = &GcmCredentialSid - return params -} -func (params *CreateServiceParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateServiceParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *CreateServiceParams) SetFacebookMessengerPageId(FacebookMessengerPageId string) *CreateServiceParams { - params.FacebookMessengerPageId = &FacebookMessengerPageId - return params -} -func (params *CreateServiceParams) SetDefaultApnNotificationProtocolVersion(DefaultApnNotificationProtocolVersion string) *CreateServiceParams { - params.DefaultApnNotificationProtocolVersion = &DefaultApnNotificationProtocolVersion - return params -} -func (params *CreateServiceParams) SetDefaultGcmNotificationProtocolVersion(DefaultGcmNotificationProtocolVersion string) *CreateServiceParams { - params.DefaultGcmNotificationProtocolVersion = &DefaultGcmNotificationProtocolVersion - return params -} -func (params *CreateServiceParams) SetFcmCredentialSid(FcmCredentialSid string) *CreateServiceParams { - params.FcmCredentialSid = &FcmCredentialSid - return params -} -func (params *CreateServiceParams) SetDefaultFcmNotificationProtocolVersion(DefaultFcmNotificationProtocolVersion string) *CreateServiceParams { - params.DefaultFcmNotificationProtocolVersion = &DefaultFcmNotificationProtocolVersion - return params -} -func (params *CreateServiceParams) SetLogEnabled(LogEnabled bool) *CreateServiceParams { - params.LogEnabled = &LogEnabled - return params -} -func (params *CreateServiceParams) SetAlexaSkillId(AlexaSkillId string) *CreateServiceParams { - params.AlexaSkillId = &AlexaSkillId - return params -} -func (params *CreateServiceParams) SetDefaultAlexaNotificationProtocolVersion(DefaultAlexaNotificationProtocolVersion string) *CreateServiceParams { - params.DefaultAlexaNotificationProtocolVersion = &DefaultAlexaNotificationProtocolVersion - return params -} -func (params *CreateServiceParams) SetDeliveryCallbackUrl(DeliveryCallbackUrl string) *CreateServiceParams { - params.DeliveryCallbackUrl = &DeliveryCallbackUrl - return params -} -func (params *CreateServiceParams) SetDeliveryCallbackEnabled(DeliveryCallbackEnabled bool) *CreateServiceParams { - params.DeliveryCallbackEnabled = &DeliveryCallbackEnabled - return params -} - -// + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. + ApnCredentialSid *string `json:"ApnCredentialSid,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. + GcmCredentialSid *string `json:"GcmCredentialSid,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // Deprecated. + FacebookMessengerPageId *string `json:"FacebookMessengerPageId,omitempty"` + // The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + DefaultApnNotificationProtocolVersion *string `json:"DefaultApnNotificationProtocolVersion,omitempty"` + // The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + DefaultGcmNotificationProtocolVersion *string `json:"DefaultGcmNotificationProtocolVersion,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. + FcmCredentialSid *string `json:"FcmCredentialSid,omitempty"` + // The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + DefaultFcmNotificationProtocolVersion *string `json:"DefaultFcmNotificationProtocolVersion,omitempty"` + // Whether to log notifications. Can be: `true` or `false` and the default is `true`. + LogEnabled *bool `json:"LogEnabled,omitempty"` + // Deprecated. + AlexaSkillId *string `json:"AlexaSkillId,omitempty"` + // Deprecated. + DefaultAlexaNotificationProtocolVersion *string `json:"DefaultAlexaNotificationProtocolVersion,omitempty"` + // URL to send delivery status callback. + DeliveryCallbackUrl *string `json:"DeliveryCallbackUrl,omitempty"` + // Callback configuration that enables delivery callbacks, default false + DeliveryCallbackEnabled *bool `json:"DeliveryCallbackEnabled,omitempty"` +} + +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateServiceParams) SetApnCredentialSid(ApnCredentialSid string) (*CreateServiceParams){ + params.ApnCredentialSid = &ApnCredentialSid + return params +} +func (params *CreateServiceParams) SetGcmCredentialSid(GcmCredentialSid string) (*CreateServiceParams){ + params.GcmCredentialSid = &GcmCredentialSid + return params +} +func (params *CreateServiceParams) SetMessagingServiceSid(MessagingServiceSid string) (*CreateServiceParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *CreateServiceParams) SetFacebookMessengerPageId(FacebookMessengerPageId string) (*CreateServiceParams){ + params.FacebookMessengerPageId = &FacebookMessengerPageId + return params +} +func (params *CreateServiceParams) SetDefaultApnNotificationProtocolVersion(DefaultApnNotificationProtocolVersion string) (*CreateServiceParams){ + params.DefaultApnNotificationProtocolVersion = &DefaultApnNotificationProtocolVersion + return params +} +func (params *CreateServiceParams) SetDefaultGcmNotificationProtocolVersion(DefaultGcmNotificationProtocolVersion string) (*CreateServiceParams){ + params.DefaultGcmNotificationProtocolVersion = &DefaultGcmNotificationProtocolVersion + return params +} +func (params *CreateServiceParams) SetFcmCredentialSid(FcmCredentialSid string) (*CreateServiceParams){ + params.FcmCredentialSid = &FcmCredentialSid + return params +} +func (params *CreateServiceParams) SetDefaultFcmNotificationProtocolVersion(DefaultFcmNotificationProtocolVersion string) (*CreateServiceParams){ + params.DefaultFcmNotificationProtocolVersion = &DefaultFcmNotificationProtocolVersion + return params +} +func (params *CreateServiceParams) SetLogEnabled(LogEnabled bool) (*CreateServiceParams){ + params.LogEnabled = &LogEnabled + return params +} +func (params *CreateServiceParams) SetAlexaSkillId(AlexaSkillId string) (*CreateServiceParams){ + params.AlexaSkillId = &AlexaSkillId + return params +} +func (params *CreateServiceParams) SetDefaultAlexaNotificationProtocolVersion(DefaultAlexaNotificationProtocolVersion string) (*CreateServiceParams){ + params.DefaultAlexaNotificationProtocolVersion = &DefaultAlexaNotificationProtocolVersion + return params +} +func (params *CreateServiceParams) SetDeliveryCallbackUrl(DeliveryCallbackUrl string) (*CreateServiceParams){ + params.DeliveryCallbackUrl = &DeliveryCallbackUrl + return params +} +func (params *CreateServiceParams) SetDeliveryCallbackEnabled(DeliveryCallbackEnabled bool) (*CreateServiceParams){ + params.DeliveryCallbackEnabled = &DeliveryCallbackEnabled + return params +} + +// func (c *ApiService) CreateService(params *CreateServiceParams) (*NotifyV1Service, error) { - path := "/v1/Services" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ApnCredentialSid != nil { - data.Set("ApnCredentialSid", *params.ApnCredentialSid) - } - if params != nil && params.GcmCredentialSid != nil { - data.Set("GcmCredentialSid", *params.GcmCredentialSid) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.FacebookMessengerPageId != nil { - data.Set("FacebookMessengerPageId", *params.FacebookMessengerPageId) - } - if params != nil && params.DefaultApnNotificationProtocolVersion != nil { - data.Set("DefaultApnNotificationProtocolVersion", *params.DefaultApnNotificationProtocolVersion) - } - if params != nil && params.DefaultGcmNotificationProtocolVersion != nil { - data.Set("DefaultGcmNotificationProtocolVersion", *params.DefaultGcmNotificationProtocolVersion) - } - if params != nil && params.FcmCredentialSid != nil { - data.Set("FcmCredentialSid", *params.FcmCredentialSid) - } - if params != nil && params.DefaultFcmNotificationProtocolVersion != nil { - data.Set("DefaultFcmNotificationProtocolVersion", *params.DefaultFcmNotificationProtocolVersion) - } - if params != nil && params.LogEnabled != nil { - data.Set("LogEnabled", fmt.Sprint(*params.LogEnabled)) - } - if params != nil && params.AlexaSkillId != nil { - data.Set("AlexaSkillId", *params.AlexaSkillId) - } - if params != nil && params.DefaultAlexaNotificationProtocolVersion != nil { - data.Set("DefaultAlexaNotificationProtocolVersion", *params.DefaultAlexaNotificationProtocolVersion) - } - if params != nil && params.DeliveryCallbackUrl != nil { - data.Set("DeliveryCallbackUrl", *params.DeliveryCallbackUrl) - } - if params != nil && params.DeliveryCallbackEnabled != nil { - data.Set("DeliveryCallbackEnabled", fmt.Sprint(*params.DeliveryCallbackEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NotifyV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err -} - -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() - - return nil -} - -// -func (c *ApiService) FetchService(Sid string) (*NotifyV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NotifyV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ApnCredentialSid != nil { + data.Set("ApnCredentialSid", *params.ApnCredentialSid) + } + if params != nil && params.GcmCredentialSid != nil { + data.Set("GcmCredentialSid", *params.GcmCredentialSid) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.FacebookMessengerPageId != nil { + data.Set("FacebookMessengerPageId", *params.FacebookMessengerPageId) + } + if params != nil && params.DefaultApnNotificationProtocolVersion != nil { + data.Set("DefaultApnNotificationProtocolVersion", *params.DefaultApnNotificationProtocolVersion) + } + if params != nil && params.DefaultGcmNotificationProtocolVersion != nil { + data.Set("DefaultGcmNotificationProtocolVersion", *params.DefaultGcmNotificationProtocolVersion) + } + if params != nil && params.FcmCredentialSid != nil { + data.Set("FcmCredentialSid", *params.FcmCredentialSid) + } + if params != nil && params.DefaultFcmNotificationProtocolVersion != nil { + data.Set("DefaultFcmNotificationProtocolVersion", *params.DefaultFcmNotificationProtocolVersion) + } + if params != nil && params.LogEnabled != nil { + data.Set("LogEnabled", fmt.Sprint(*params.LogEnabled)) + } + if params != nil && params.AlexaSkillId != nil { + data.Set("AlexaSkillId", *params.AlexaSkillId) + } + if params != nil && params.DefaultAlexaNotificationProtocolVersion != nil { + data.Set("DefaultAlexaNotificationProtocolVersion", *params.DefaultAlexaNotificationProtocolVersion) + } + if params != nil && params.DeliveryCallbackUrl != nil { + data.Set("DeliveryCallbackUrl", *params.DeliveryCallbackUrl) + } + if params != nil && params.DeliveryCallbackEnabled != nil { + data.Set("DeliveryCallbackEnabled", fmt.Sprint(*params.DeliveryCallbackEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NotifyV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil +} + +// +func (c *ApiService) FetchService(Sid string, ) (*NotifyV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NotifyV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // The string that identifies the Service resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The string that identifies the Service resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetFriendlyName(FriendlyName string) *ListServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListServiceParams) SetFriendlyName(FriendlyName string) (*ListServiceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -315,6 +321,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan NotifyV1Serv return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan NotifyV1Service, errorChannel chan error) { curRecord := 1 @@ -346,174 +353,176 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. - ApnCredentialSid *string `json:"ApnCredentialSid,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - GcmCredentialSid *string `json:"GcmCredentialSid,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` - // Deprecated. - FacebookMessengerPageId *string `json:"FacebookMessengerPageId,omitempty"` - // The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - DefaultApnNotificationProtocolVersion *string `json:"DefaultApnNotificationProtocolVersion,omitempty"` - // The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - DefaultGcmNotificationProtocolVersion *string `json:"DefaultGcmNotificationProtocolVersion,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. - FcmCredentialSid *string `json:"FcmCredentialSid,omitempty"` - // The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - DefaultFcmNotificationProtocolVersion *string `json:"DefaultFcmNotificationProtocolVersion,omitempty"` - // Whether to log notifications. Can be: `true` or `false` and the default is `true`. - LogEnabled *bool `json:"LogEnabled,omitempty"` - // Deprecated. - AlexaSkillId *string `json:"AlexaSkillId,omitempty"` - // Deprecated. - DefaultAlexaNotificationProtocolVersion *string `json:"DefaultAlexaNotificationProtocolVersion,omitempty"` - // URL to send delivery status callback. - DeliveryCallbackUrl *string `json:"DeliveryCallbackUrl,omitempty"` - // Callback configuration that enables delivery callbacks, default false - DeliveryCallbackEnabled *bool `json:"DeliveryCallbackEnabled,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetApnCredentialSid(ApnCredentialSid string) *UpdateServiceParams { - params.ApnCredentialSid = &ApnCredentialSid - return params -} -func (params *UpdateServiceParams) SetGcmCredentialSid(GcmCredentialSid string) *UpdateServiceParams { - params.GcmCredentialSid = &GcmCredentialSid - return params -} -func (params *UpdateServiceParams) SetMessagingServiceSid(MessagingServiceSid string) *UpdateServiceParams { - params.MessagingServiceSid = &MessagingServiceSid - return params -} -func (params *UpdateServiceParams) SetFacebookMessengerPageId(FacebookMessengerPageId string) *UpdateServiceParams { - params.FacebookMessengerPageId = &FacebookMessengerPageId - return params -} -func (params *UpdateServiceParams) SetDefaultApnNotificationProtocolVersion(DefaultApnNotificationProtocolVersion string) *UpdateServiceParams { - params.DefaultApnNotificationProtocolVersion = &DefaultApnNotificationProtocolVersion - return params -} -func (params *UpdateServiceParams) SetDefaultGcmNotificationProtocolVersion(DefaultGcmNotificationProtocolVersion string) *UpdateServiceParams { - params.DefaultGcmNotificationProtocolVersion = &DefaultGcmNotificationProtocolVersion - return params -} -func (params *UpdateServiceParams) SetFcmCredentialSid(FcmCredentialSid string) *UpdateServiceParams { - params.FcmCredentialSid = &FcmCredentialSid - return params -} -func (params *UpdateServiceParams) SetDefaultFcmNotificationProtocolVersion(DefaultFcmNotificationProtocolVersion string) *UpdateServiceParams { - params.DefaultFcmNotificationProtocolVersion = &DefaultFcmNotificationProtocolVersion - return params -} -func (params *UpdateServiceParams) SetLogEnabled(LogEnabled bool) *UpdateServiceParams { - params.LogEnabled = &LogEnabled - return params -} -func (params *UpdateServiceParams) SetAlexaSkillId(AlexaSkillId string) *UpdateServiceParams { - params.AlexaSkillId = &AlexaSkillId - return params -} -func (params *UpdateServiceParams) SetDefaultAlexaNotificationProtocolVersion(DefaultAlexaNotificationProtocolVersion string) *UpdateServiceParams { - params.DefaultAlexaNotificationProtocolVersion = &DefaultAlexaNotificationProtocolVersion - return params -} -func (params *UpdateServiceParams) SetDeliveryCallbackUrl(DeliveryCallbackUrl string) *UpdateServiceParams { - params.DeliveryCallbackUrl = &DeliveryCallbackUrl - return params -} -func (params *UpdateServiceParams) SetDeliveryCallbackEnabled(DeliveryCallbackEnabled bool) *UpdateServiceParams { - params.DeliveryCallbackEnabled = &DeliveryCallbackEnabled - return params -} - -// + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. + ApnCredentialSid *string `json:"ApnCredentialSid,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. + GcmCredentialSid *string `json:"GcmCredentialSid,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // Deprecated. + FacebookMessengerPageId *string `json:"FacebookMessengerPageId,omitempty"` + // The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + DefaultApnNotificationProtocolVersion *string `json:"DefaultApnNotificationProtocolVersion,omitempty"` + // The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + DefaultGcmNotificationProtocolVersion *string `json:"DefaultGcmNotificationProtocolVersion,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. + FcmCredentialSid *string `json:"FcmCredentialSid,omitempty"` + // The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + DefaultFcmNotificationProtocolVersion *string `json:"DefaultFcmNotificationProtocolVersion,omitempty"` + // Whether to log notifications. Can be: `true` or `false` and the default is `true`. + LogEnabled *bool `json:"LogEnabled,omitempty"` + // Deprecated. + AlexaSkillId *string `json:"AlexaSkillId,omitempty"` + // Deprecated. + DefaultAlexaNotificationProtocolVersion *string `json:"DefaultAlexaNotificationProtocolVersion,omitempty"` + // URL to send delivery status callback. + DeliveryCallbackUrl *string `json:"DeliveryCallbackUrl,omitempty"` + // Callback configuration that enables delivery callbacks, default false + DeliveryCallbackEnabled *bool `json:"DeliveryCallbackEnabled,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetApnCredentialSid(ApnCredentialSid string) (*UpdateServiceParams){ + params.ApnCredentialSid = &ApnCredentialSid + return params +} +func (params *UpdateServiceParams) SetGcmCredentialSid(GcmCredentialSid string) (*UpdateServiceParams){ + params.GcmCredentialSid = &GcmCredentialSid + return params +} +func (params *UpdateServiceParams) SetMessagingServiceSid(MessagingServiceSid string) (*UpdateServiceParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params +} +func (params *UpdateServiceParams) SetFacebookMessengerPageId(FacebookMessengerPageId string) (*UpdateServiceParams){ + params.FacebookMessengerPageId = &FacebookMessengerPageId + return params +} +func (params *UpdateServiceParams) SetDefaultApnNotificationProtocolVersion(DefaultApnNotificationProtocolVersion string) (*UpdateServiceParams){ + params.DefaultApnNotificationProtocolVersion = &DefaultApnNotificationProtocolVersion + return params +} +func (params *UpdateServiceParams) SetDefaultGcmNotificationProtocolVersion(DefaultGcmNotificationProtocolVersion string) (*UpdateServiceParams){ + params.DefaultGcmNotificationProtocolVersion = &DefaultGcmNotificationProtocolVersion + return params +} +func (params *UpdateServiceParams) SetFcmCredentialSid(FcmCredentialSid string) (*UpdateServiceParams){ + params.FcmCredentialSid = &FcmCredentialSid + return params +} +func (params *UpdateServiceParams) SetDefaultFcmNotificationProtocolVersion(DefaultFcmNotificationProtocolVersion string) (*UpdateServiceParams){ + params.DefaultFcmNotificationProtocolVersion = &DefaultFcmNotificationProtocolVersion + return params +} +func (params *UpdateServiceParams) SetLogEnabled(LogEnabled bool) (*UpdateServiceParams){ + params.LogEnabled = &LogEnabled + return params +} +func (params *UpdateServiceParams) SetAlexaSkillId(AlexaSkillId string) (*UpdateServiceParams){ + params.AlexaSkillId = &AlexaSkillId + return params +} +func (params *UpdateServiceParams) SetDefaultAlexaNotificationProtocolVersion(DefaultAlexaNotificationProtocolVersion string) (*UpdateServiceParams){ + params.DefaultAlexaNotificationProtocolVersion = &DefaultAlexaNotificationProtocolVersion + return params +} +func (params *UpdateServiceParams) SetDeliveryCallbackUrl(DeliveryCallbackUrl string) (*UpdateServiceParams){ + params.DeliveryCallbackUrl = &DeliveryCallbackUrl + return params +} +func (params *UpdateServiceParams) SetDeliveryCallbackEnabled(DeliveryCallbackEnabled bool) (*UpdateServiceParams){ + params.DeliveryCallbackEnabled = &DeliveryCallbackEnabled + return params +} + +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*NotifyV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ApnCredentialSid != nil { - data.Set("ApnCredentialSid", *params.ApnCredentialSid) - } - if params != nil && params.GcmCredentialSid != nil { - data.Set("GcmCredentialSid", *params.GcmCredentialSid) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } - if params != nil && params.FacebookMessengerPageId != nil { - data.Set("FacebookMessengerPageId", *params.FacebookMessengerPageId) - } - if params != nil && params.DefaultApnNotificationProtocolVersion != nil { - data.Set("DefaultApnNotificationProtocolVersion", *params.DefaultApnNotificationProtocolVersion) - } - if params != nil && params.DefaultGcmNotificationProtocolVersion != nil { - data.Set("DefaultGcmNotificationProtocolVersion", *params.DefaultGcmNotificationProtocolVersion) - } - if params != nil && params.FcmCredentialSid != nil { - data.Set("FcmCredentialSid", *params.FcmCredentialSid) - } - if params != nil && params.DefaultFcmNotificationProtocolVersion != nil { - data.Set("DefaultFcmNotificationProtocolVersion", *params.DefaultFcmNotificationProtocolVersion) - } - if params != nil && params.LogEnabled != nil { - data.Set("LogEnabled", fmt.Sprint(*params.LogEnabled)) - } - if params != nil && params.AlexaSkillId != nil { - data.Set("AlexaSkillId", *params.AlexaSkillId) - } - if params != nil && params.DefaultAlexaNotificationProtocolVersion != nil { - data.Set("DefaultAlexaNotificationProtocolVersion", *params.DefaultAlexaNotificationProtocolVersion) - } - if params != nil && params.DeliveryCallbackUrl != nil { - data.Set("DeliveryCallbackUrl", *params.DeliveryCallbackUrl) - } - if params != nil && params.DeliveryCallbackEnabled != nil { - data.Set("DeliveryCallbackEnabled", fmt.Sprint(*params.DeliveryCallbackEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NotifyV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ApnCredentialSid != nil { + data.Set("ApnCredentialSid", *params.ApnCredentialSid) + } + if params != nil && params.GcmCredentialSid != nil { + data.Set("GcmCredentialSid", *params.GcmCredentialSid) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } + if params != nil && params.FacebookMessengerPageId != nil { + data.Set("FacebookMessengerPageId", *params.FacebookMessengerPageId) + } + if params != nil && params.DefaultApnNotificationProtocolVersion != nil { + data.Set("DefaultApnNotificationProtocolVersion", *params.DefaultApnNotificationProtocolVersion) + } + if params != nil && params.DefaultGcmNotificationProtocolVersion != nil { + data.Set("DefaultGcmNotificationProtocolVersion", *params.DefaultGcmNotificationProtocolVersion) + } + if params != nil && params.FcmCredentialSid != nil { + data.Set("FcmCredentialSid", *params.FcmCredentialSid) + } + if params != nil && params.DefaultFcmNotificationProtocolVersion != nil { + data.Set("DefaultFcmNotificationProtocolVersion", *params.DefaultFcmNotificationProtocolVersion) + } + if params != nil && params.LogEnabled != nil { + data.Set("LogEnabled", fmt.Sprint(*params.LogEnabled)) + } + if params != nil && params.AlexaSkillId != nil { + data.Set("AlexaSkillId", *params.AlexaSkillId) + } + if params != nil && params.DefaultAlexaNotificationProtocolVersion != nil { + data.Set("DefaultAlexaNotificationProtocolVersion", *params.DefaultAlexaNotificationProtocolVersion) + } + if params != nil && params.DeliveryCallbackUrl != nil { + data.Set("DeliveryCallbackUrl", *params.DeliveryCallbackUrl) + } + if params != nil && params.DeliveryCallbackEnabled != nil { + data.Set("DeliveryCallbackEnabled", fmt.Sprint(*params.DeliveryCallbackEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NotifyV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/notify/v1/services_bindings.go b/rest/notify/v1/services_bindings.go index 6240d68eb..b4c6bba51 100644 --- a/rest/notify/v1/services_bindings.go +++ b/rest/notify/v1/services_bindings.go @@ -18,238 +18,243 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBinding' type CreateBindingParams struct { - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. - Identity *string `json:"Identity,omitempty"` - // - BindingType *string `json:"BindingType,omitempty"` - // The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. - Address *string `json:"Address,omitempty"` - // A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags. - Tag *[]string `json:"Tag,omitempty"` - // The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `\\\"3\\\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. - NotificationProtocolVersion *string `json:"NotificationProtocolVersion,omitempty"` - // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings. - CredentialSid *string `json:"CredentialSid,omitempty"` - // Deprecated. - Endpoint *string `json:"Endpoint,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. + Identity *string `json:"Identity,omitempty"` + // + BindingType *string `json:"BindingType,omitempty"` + // The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. + Address *string `json:"Address,omitempty"` + // A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags. + Tag *[]string `json:"Tag,omitempty"` + // The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `\\\"3\\\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. + NotificationProtocolVersion *string `json:"NotificationProtocolVersion,omitempty"` + // The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings. + CredentialSid *string `json:"CredentialSid,omitempty"` + // Deprecated. + Endpoint *string `json:"Endpoint,omitempty"` } -func (params *CreateBindingParams) SetIdentity(Identity string) *CreateBindingParams { - params.Identity = &Identity - return params +func (params *CreateBindingParams) SetIdentity(Identity string) (*CreateBindingParams){ + params.Identity = &Identity + return params } -func (params *CreateBindingParams) SetBindingType(BindingType string) *CreateBindingParams { - params.BindingType = &BindingType - return params +func (params *CreateBindingParams) SetBindingType(BindingType string) (*CreateBindingParams){ + params.BindingType = &BindingType + return params } -func (params *CreateBindingParams) SetAddress(Address string) *CreateBindingParams { - params.Address = &Address - return params +func (params *CreateBindingParams) SetAddress(Address string) (*CreateBindingParams){ + params.Address = &Address + return params } -func (params *CreateBindingParams) SetTag(Tag []string) *CreateBindingParams { - params.Tag = &Tag - return params +func (params *CreateBindingParams) SetTag(Tag []string) (*CreateBindingParams){ + params.Tag = &Tag + return params } -func (params *CreateBindingParams) SetNotificationProtocolVersion(NotificationProtocolVersion string) *CreateBindingParams { - params.NotificationProtocolVersion = &NotificationProtocolVersion - return params +func (params *CreateBindingParams) SetNotificationProtocolVersion(NotificationProtocolVersion string) (*CreateBindingParams){ + params.NotificationProtocolVersion = &NotificationProtocolVersion + return params } -func (params *CreateBindingParams) SetCredentialSid(CredentialSid string) *CreateBindingParams { - params.CredentialSid = &CredentialSid - return params +func (params *CreateBindingParams) SetCredentialSid(CredentialSid string) (*CreateBindingParams){ + params.CredentialSid = &CredentialSid + return params } -func (params *CreateBindingParams) SetEndpoint(Endpoint string) *CreateBindingParams { - params.Endpoint = &Endpoint - return params +func (params *CreateBindingParams) SetEndpoint(Endpoint string) (*CreateBindingParams){ + params.Endpoint = &Endpoint + return params } -// +// func (c *ApiService) CreateBinding(ServiceSid string, params *CreateBindingParams) (*NotifyV1Binding, error) { - path := "/v1/Services/{ServiceSid}/Bindings" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.BindingType != nil { - data.Set("BindingType", *params.BindingType) - } - if params != nil && params.Address != nil { - data.Set("Address", *params.Address) - } - if params != nil && params.Tag != nil { - for _, item := range *params.Tag { - data.Add("Tag", item) - } - } - if params != nil && params.NotificationProtocolVersion != nil { - data.Set("NotificationProtocolVersion", *params.NotificationProtocolVersion) - } - if params != nil && params.CredentialSid != nil { - data.Set("CredentialSid", *params.CredentialSid) - } - if params != nil && params.Endpoint != nil { - data.Set("Endpoint", *params.Endpoint) - } + path := "/v1/Services/{ServiceSid}/Bindings" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.BindingType != nil { + data.Set("BindingType", *params.BindingType) + } + if params != nil && params.Address != nil { + data.Set("Address", *params.Address) + } + if params != nil && params.Tag != nil { + for _, item := range *params.Tag { + data.Add("Tag", item) + } + } + if params != nil && params.NotificationProtocolVersion != nil { + data.Set("NotificationProtocolVersion", *params.NotificationProtocolVersion) + } + if params != nil && params.CredentialSid != nil { + data.Set("CredentialSid", *params.CredentialSid) + } + if params != nil && params.Endpoint != nil { + data.Set("Endpoint", *params.Endpoint) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NotifyV1Binding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteBinding(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &NotifyV1Binding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteBinding(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchBinding(ServiceSid string, Sid string, ) (*NotifyV1Binding, error) { + path := "/v1/Services/{ServiceSid}/Bindings/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchBinding(ServiceSid string, Sid string) (*NotifyV1Binding, error) { - path := "/v1/Services/{ServiceSid}/Bindings/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NotifyV1Binding{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NotifyV1Binding{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListBinding' type ListBindingParams struct { - // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. - StartDate *string `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. - EndDate *string `json:"EndDate,omitempty"` - // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. - Identity *[]string `json:"Identity,omitempty"` - // Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. - Tag *[]string `json:"Tag,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. + StartDate *string `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. + EndDate *string `json:"EndDate,omitempty"` + // The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. + Identity *[]string `json:"Identity,omitempty"` + // Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. + Tag *[]string `json:"Tag,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBindingParams) SetStartDate(StartDate string) *ListBindingParams { - params.StartDate = &StartDate - return params +func (params *ListBindingParams) SetStartDate(StartDate string) (*ListBindingParams){ + params.StartDate = &StartDate + return params } -func (params *ListBindingParams) SetEndDate(EndDate string) *ListBindingParams { - params.EndDate = &EndDate - return params +func (params *ListBindingParams) SetEndDate(EndDate string) (*ListBindingParams){ + params.EndDate = &EndDate + return params } -func (params *ListBindingParams) SetIdentity(Identity []string) *ListBindingParams { - params.Identity = &Identity - return params +func (params *ListBindingParams) SetIdentity(Identity []string) (*ListBindingParams){ + params.Identity = &Identity + return params } -func (params *ListBindingParams) SetTag(Tag []string) *ListBindingParams { - params.Tag = &Tag - return params +func (params *ListBindingParams) SetTag(Tag []string) (*ListBindingParams){ + params.Tag = &Tag + return params } -func (params *ListBindingParams) SetPageSize(PageSize int) *ListBindingParams { - params.PageSize = &PageSize - return params +func (params *ListBindingParams) SetPageSize(PageSize int) (*ListBindingParams){ + params.PageSize = &PageSize + return params } -func (params *ListBindingParams) SetLimit(Limit int) *ListBindingParams { - params.Limit = &Limit - return params +func (params *ListBindingParams) SetLimit(Limit int) (*ListBindingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Binding records from the API. Request is executed immediately. func (c *ApiService) PageBinding(ServiceSid string, params *ListBindingParams, pageToken, pageNumber string) (*ListBindingResponse, error) { - path := "/v1/Services/{ServiceSid}/Bindings" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint(*params.StartDate)) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint(*params.EndDate)) - } - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.Tag != nil { - for _, item := range *params.Tag { - data.Add("Tag", item) - } - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Bindings" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint(*params.StartDate)) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint(*params.EndDate)) + } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.Tag != nil { + for _, item := range *params.Tag { + data.Add("Tag", item) + } + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Binding records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -290,6 +295,7 @@ func (c *ApiService) StreamBinding(ServiceSid string, params *ListBindingParams) return recordChannel, errorChannel } + func (c *ApiService) streamBinding(response *ListBindingResponse, params *ListBindingParams, recordChannel chan NotifyV1Binding, errorChannel chan error) { curRecord := 1 @@ -321,19 +327,20 @@ func (c *ApiService) streamBinding(response *ListBindingResponse, params *ListBi } func (c *ApiService) getNextListBindingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBindingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBindingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/notify/v1/services_notifications.go b/rest/notify/v1/services_notifications.go index 91bfbcc1c..0415371f4 100644 --- a/rest/notify/v1/services_notifications.go +++ b/rest/notify/v1/services_notifications.go @@ -18,246 +18,249 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNotification' type CreateNotificationParams struct { - // The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. - Body *string `json:"Body,omitempty"` - // - Priority *string `json:"Priority,omitempty"` - // How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. - Ttl *int `json:"Ttl,omitempty"` - // The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. - Title *string `json:"Title,omitempty"` - // The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. - Sound *string `json:"Sound,omitempty"` - // The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. - Action *string `json:"Action,omitempty"` - // The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. - Data *interface{} `json:"Data,omitempty"` - // The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. - Apn *interface{} `json:"Apn,omitempty"` - // The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). - Gcm *interface{} `json:"Gcm,omitempty"` - // The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/send-messages) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. - Sms *interface{} `json:"Sms,omitempty"` - // Deprecated. - FacebookMessenger *interface{} `json:"FacebookMessenger,omitempty"` - // The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. - Fcm *interface{} `json:"Fcm,omitempty"` - // The Segment resource is deprecated. Use the `tag` parameter, instead. - Segment *[]string `json:"Segment,omitempty"` - // Deprecated. - Alexa *interface{} `json:"Alexa,omitempty"` - // The destination address specified as a JSON string. Multiple `to_binding` parameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers. - ToBinding *[]string `json:"ToBinding,omitempty"` - // URL to send webhooks. - DeliveryCallbackUrl *string `json:"DeliveryCallbackUrl,omitempty"` - // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. - Identity *[]string `json:"Identity,omitempty"` - // A tag that selects the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 5 tags. The implicit tag `all` is available to notify all Bindings in a Service instance. Similarly, the implicit tags `apn`, `fcm`, `gcm`, `sms` and `facebook-messenger` are available to notify all Bindings in a specific channel. - Tag *[]string `json:"Tag,omitempty"` + // The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. + Body *string `json:"Body,omitempty"` + // + Priority *string `json:"Priority,omitempty"` + // How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. + Ttl *int `json:"Ttl,omitempty"` + // The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. + Title *string `json:"Title,omitempty"` + // The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. + Sound *string `json:"Sound,omitempty"` + // The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. + Action *string `json:"Action,omitempty"` + // The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. + Data *interface{} `json:"Data,omitempty"` + // The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. + Apn *interface{} `json:"Apn,omitempty"` + // The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). + Gcm *interface{} `json:"Gcm,omitempty"` + // The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/send-messages) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. + Sms *interface{} `json:"Sms,omitempty"` + // Deprecated. + FacebookMessenger *interface{} `json:"FacebookMessenger,omitempty"` + // The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. + Fcm *interface{} `json:"Fcm,omitempty"` + // The Segment resource is deprecated. Use the `tag` parameter, instead. + Segment *[]string `json:"Segment,omitempty"` + // Deprecated. + Alexa *interface{} `json:"Alexa,omitempty"` + // The destination address specified as a JSON string. Multiple `to_binding` parameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers. + ToBinding *[]string `json:"ToBinding,omitempty"` + // URL to send webhooks. + DeliveryCallbackUrl *string `json:"DeliveryCallbackUrl,omitempty"` + // The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. + Identity *[]string `json:"Identity,omitempty"` + // A tag that selects the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 5 tags. The implicit tag `all` is available to notify all Bindings in a Service instance. Similarly, the implicit tags `apn`, `fcm`, `gcm`, `sms` and `facebook-messenger` are available to notify all Bindings in a specific channel. + Tag *[]string `json:"Tag,omitempty"` } -func (params *CreateNotificationParams) SetBody(Body string) *CreateNotificationParams { - params.Body = &Body - return params +func (params *CreateNotificationParams) SetBody(Body string) (*CreateNotificationParams){ + params.Body = &Body + return params } -func (params *CreateNotificationParams) SetPriority(Priority string) *CreateNotificationParams { - params.Priority = &Priority - return params +func (params *CreateNotificationParams) SetPriority(Priority string) (*CreateNotificationParams){ + params.Priority = &Priority + return params } -func (params *CreateNotificationParams) SetTtl(Ttl int) *CreateNotificationParams { - params.Ttl = &Ttl - return params +func (params *CreateNotificationParams) SetTtl(Ttl int) (*CreateNotificationParams){ + params.Ttl = &Ttl + return params } -func (params *CreateNotificationParams) SetTitle(Title string) *CreateNotificationParams { - params.Title = &Title - return params +func (params *CreateNotificationParams) SetTitle(Title string) (*CreateNotificationParams){ + params.Title = &Title + return params } -func (params *CreateNotificationParams) SetSound(Sound string) *CreateNotificationParams { - params.Sound = &Sound - return params +func (params *CreateNotificationParams) SetSound(Sound string) (*CreateNotificationParams){ + params.Sound = &Sound + return params } -func (params *CreateNotificationParams) SetAction(Action string) *CreateNotificationParams { - params.Action = &Action - return params +func (params *CreateNotificationParams) SetAction(Action string) (*CreateNotificationParams){ + params.Action = &Action + return params } -func (params *CreateNotificationParams) SetData(Data interface{}) *CreateNotificationParams { - params.Data = &Data - return params +func (params *CreateNotificationParams) SetData(Data interface{}) (*CreateNotificationParams){ + params.Data = &Data + return params } -func (params *CreateNotificationParams) SetApn(Apn interface{}) *CreateNotificationParams { - params.Apn = &Apn - return params +func (params *CreateNotificationParams) SetApn(Apn interface{}) (*CreateNotificationParams){ + params.Apn = &Apn + return params } -func (params *CreateNotificationParams) SetGcm(Gcm interface{}) *CreateNotificationParams { - params.Gcm = &Gcm - return params +func (params *CreateNotificationParams) SetGcm(Gcm interface{}) (*CreateNotificationParams){ + params.Gcm = &Gcm + return params } -func (params *CreateNotificationParams) SetSms(Sms interface{}) *CreateNotificationParams { - params.Sms = &Sms - return params +func (params *CreateNotificationParams) SetSms(Sms interface{}) (*CreateNotificationParams){ + params.Sms = &Sms + return params } -func (params *CreateNotificationParams) SetFacebookMessenger(FacebookMessenger interface{}) *CreateNotificationParams { - params.FacebookMessenger = &FacebookMessenger - return params +func (params *CreateNotificationParams) SetFacebookMessenger(FacebookMessenger interface{}) (*CreateNotificationParams){ + params.FacebookMessenger = &FacebookMessenger + return params } -func (params *CreateNotificationParams) SetFcm(Fcm interface{}) *CreateNotificationParams { - params.Fcm = &Fcm - return params +func (params *CreateNotificationParams) SetFcm(Fcm interface{}) (*CreateNotificationParams){ + params.Fcm = &Fcm + return params } -func (params *CreateNotificationParams) SetSegment(Segment []string) *CreateNotificationParams { - params.Segment = &Segment - return params +func (params *CreateNotificationParams) SetSegment(Segment []string) (*CreateNotificationParams){ + params.Segment = &Segment + return params } -func (params *CreateNotificationParams) SetAlexa(Alexa interface{}) *CreateNotificationParams { - params.Alexa = &Alexa - return params +func (params *CreateNotificationParams) SetAlexa(Alexa interface{}) (*CreateNotificationParams){ + params.Alexa = &Alexa + return params } -func (params *CreateNotificationParams) SetToBinding(ToBinding []string) *CreateNotificationParams { - params.ToBinding = &ToBinding - return params +func (params *CreateNotificationParams) SetToBinding(ToBinding []string) (*CreateNotificationParams){ + params.ToBinding = &ToBinding + return params } -func (params *CreateNotificationParams) SetDeliveryCallbackUrl(DeliveryCallbackUrl string) *CreateNotificationParams { - params.DeliveryCallbackUrl = &DeliveryCallbackUrl - return params +func (params *CreateNotificationParams) SetDeliveryCallbackUrl(DeliveryCallbackUrl string) (*CreateNotificationParams){ + params.DeliveryCallbackUrl = &DeliveryCallbackUrl + return params } -func (params *CreateNotificationParams) SetIdentity(Identity []string) *CreateNotificationParams { - params.Identity = &Identity - return params +func (params *CreateNotificationParams) SetIdentity(Identity []string) (*CreateNotificationParams){ + params.Identity = &Identity + return params } -func (params *CreateNotificationParams) SetTag(Tag []string) *CreateNotificationParams { - params.Tag = &Tag - return params +func (params *CreateNotificationParams) SetTag(Tag []string) (*CreateNotificationParams){ + params.Tag = &Tag + return params } -// +// func (c *ApiService) CreateNotification(ServiceSid string, params *CreateNotificationParams) (*NotifyV1Notification, error) { - path := "/v1/Services/{ServiceSid}/Notifications" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Notifications" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.Priority != nil { + data.Set("Priority", *params.Priority) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.Title != nil { + data.Set("Title", *params.Title) + } + if params != nil && params.Sound != nil { + data.Set("Sound", *params.Sound) + } + if params != nil && params.Action != nil { + data.Set("Action", *params.Action) + } + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.Priority != nil { - data.Set("Priority", *params.Priority) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.Title != nil { - data.Set("Title", *params.Title) - } - if params != nil && params.Sound != nil { - data.Set("Sound", *params.Sound) - } - if params != nil && params.Action != nil { - data.Set("Action", *params.Action) - } - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Data", string(v)) + } + if params != nil && params.Apn != nil { + v, err := json.Marshal(params.Apn) - data.Set("Data", string(v)) - } - if params != nil && params.Apn != nil { - v, err := json.Marshal(params.Apn) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Apn", string(v)) + } + if params != nil && params.Gcm != nil { + v, err := json.Marshal(params.Gcm) - data.Set("Apn", string(v)) - } - if params != nil && params.Gcm != nil { - v, err := json.Marshal(params.Gcm) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Gcm", string(v)) + } + if params != nil && params.Sms != nil { + v, err := json.Marshal(params.Sms) - data.Set("Gcm", string(v)) - } - if params != nil && params.Sms != nil { - v, err := json.Marshal(params.Sms) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Sms", string(v)) + } + if params != nil && params.FacebookMessenger != nil { + v, err := json.Marshal(params.FacebookMessenger) - data.Set("Sms", string(v)) - } - if params != nil && params.FacebookMessenger != nil { - v, err := json.Marshal(params.FacebookMessenger) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("FacebookMessenger", string(v)) + } + if params != nil && params.Fcm != nil { + v, err := json.Marshal(params.Fcm) - data.Set("FacebookMessenger", string(v)) - } - if params != nil && params.Fcm != nil { - v, err := json.Marshal(params.Fcm) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Fcm", string(v)) + } + if params != nil && params.Segment != nil { + for _, item := range *params.Segment { + data.Add("Segment", item) + } + } + if params != nil && params.Alexa != nil { + v, err := json.Marshal(params.Alexa) - data.Set("Fcm", string(v)) - } - if params != nil && params.Segment != nil { - for _, item := range *params.Segment { - data.Add("Segment", item) - } - } - if params != nil && params.Alexa != nil { - v, err := json.Marshal(params.Alexa) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Alexa", string(v)) + } + if params != nil && params.ToBinding != nil { + for _, item := range *params.ToBinding { + data.Add("ToBinding", item) + } + } + if params != nil && params.DeliveryCallbackUrl != nil { + data.Set("DeliveryCallbackUrl", *params.DeliveryCallbackUrl) + } + if params != nil && params.Identity != nil { + for _, item := range *params.Identity { + data.Add("Identity", item) + } + } + if params != nil && params.Tag != nil { + for _, item := range *params.Tag { + data.Add("Tag", item) + } + } - data.Set("Alexa", string(v)) - } - if params != nil && params.ToBinding != nil { - for _, item := range *params.ToBinding { - data.Add("ToBinding", item) - } - } - if params != nil && params.DeliveryCallbackUrl != nil { - data.Set("DeliveryCallbackUrl", *params.DeliveryCallbackUrl) - } - if params != nil && params.Identity != nil { - for _, item := range *params.Identity { - data.Add("Identity", item) - } - } - if params != nil && params.Tag != nil { - for _, item := range *params.Tag { - data.Add("Tag", item) - } - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NotifyV1Notification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NotifyV1Notification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v1/README.md b/rest/numbers/v1/README.md index dbf123281..b98970945 100644 --- a/rest/numbers/v1/README.md +++ b/rest/numbers/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -31,7 +31,10 @@ All URIs are relative to *https://numbers.twilio.com* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*HostedNumberEligibilityApi* | [**CreateEligibility**](docs/HostedNumberEligibilityApi.md#createeligibility) | **Post** /v1/HostedNumber/Eligibility | +*HostedNumberEligibilityBulkApi* | [**CreateBulkEligibility**](docs/HostedNumberEligibilityBulkApi.md#createbulkeligibility) | **Post** /v1/HostedNumber/Eligibility/Bulk | *HostedNumberEligibilityBulkApi* | [**FetchBulkEligibility**](docs/HostedNumberEligibilityBulkApi.md#fetchbulkeligibility) | **Get** /v1/HostedNumber/Eligibility/Bulk/{RequestId} | +*PortingPortInApi* | [**CreatePortingPortIn**](docs/PortingPortInApi.md#createportingportin) | **Post** /v1/Porting/PortIn | *PortingPortabilityApi* | [**CreatePortingBulkPortability**](docs/PortingPortabilityApi.md#createportingbulkportability) | **Post** /v1/Porting/Portability | *PortingPortabilityApi* | [**FetchPortingBulkPortability**](docs/PortingPortabilityApi.md#fetchportingbulkportability) | **Get** /v1/Porting/Portability/{Sid} | *PortingPortabilityPhoneNumberApi* | [**FetchPortingPortability**](docs/PortingPortabilityPhoneNumberApi.md#fetchportingportability) | **Get** /v1/Porting/Portability/PhoneNumber/{PhoneNumber} | diff --git a/rest/numbers/v1/api_service.go b/rest/numbers/v1/api_service.go index 46727785d..4c8e2d4a1 100644 --- a/rest/numbers/v1/api_service.go +++ b/rest/numbers/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://numbers.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/numbers/v1/docs/HostedNumberEligibilityBulkApi.md b/rest/numbers/v1/docs/HostedNumberEligibilityBulkApi.md index ea60f15fb..d5240f974 100644 --- a/rest/numbers/v1/docs/HostedNumberEligibilityBulkApi.md +++ b/rest/numbers/v1/docs/HostedNumberEligibilityBulkApi.md @@ -4,10 +4,46 @@ All URIs are relative to *https://numbers.twilio.com* Method | HTTP request | Description ------------- | ------------- | ------------- +[**CreateBulkEligibility**](HostedNumberEligibilityBulkApi.md#CreateBulkEligibility) | **Post** /v1/HostedNumber/Eligibility/Bulk | [**FetchBulkEligibility**](HostedNumberEligibilityBulkApi.md#FetchBulkEligibility) | **Get** /v1/HostedNumber/Eligibility/Bulk/{RequestId} | +## CreateBulkEligibility + +> NumbersV1BulkEligibility CreateBulkEligibility(ctx, ) + + + +Create a bulk eligibility check for a set of numbers that you want to host in Twilio. + +### Path Parameters + +This endpoint does not need any path parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateBulkEligibilityParams struct + + +### Return type + +[**NumbersV1BulkEligibility**](NumbersV1BulkEligibility.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## FetchBulkEligibility > NumbersV1BulkEligibility FetchBulkEligibility(ctx, RequestId) diff --git a/rest/numbers/v1/hosted_number_eligibility_bulk.go b/rest/numbers/v1/hosted_number_eligibility_bulk.go index 9bdfdaa90..eeda4864e 100644 --- a/rest/numbers/v1/hosted_number_eligibility_bulk.go +++ b/rest/numbers/v1/hosted_number_eligibility_bulk.go @@ -16,29 +16,58 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + +// Create a bulk eligibility check for a set of numbers that you want to host in Twilio. +func (c *ApiService) CreateBulkEligibility() (*NumbersV1BulkEligibility, error) { + path := "/v1/HostedNumber/Eligibility/Bulk" + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV1BulkEligibility{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + // Fetch an eligibility bulk check that you requested to host in Twilio. -func (c *ApiService) FetchBulkEligibility(RequestId string) (*NumbersV1BulkEligibility, error) { - path := "/v1/HostedNumber/Eligibility/Bulk/{RequestId}" - path = strings.Replace(path, "{"+"RequestId"+"}", RequestId, -1) +func (c *ApiService) FetchBulkEligibility(RequestId string, ) (*NumbersV1BulkEligibility, error) { + path := "/v1/HostedNumber/Eligibility/Bulk/{RequestId}" + path = strings.Replace(path, "{"+"RequestId"+"}", RequestId, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV1BulkEligibility{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV1BulkEligibility{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v1/model_numbers_v1_bulk_eligibility.go b/rest/numbers/v1/model_numbers_v1_bulk_eligibility.go index 1932ad8b0..6d5cc4f7f 100644 --- a/rest/numbers/v1/model_numbers_v1_bulk_eligibility.go +++ b/rest/numbers/v1/model_numbers_v1_bulk_eligibility.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV1BulkEligibility struct for NumbersV1BulkEligibility type NumbersV1BulkEligibility struct { - // The SID of the bulk eligibility check that you want to know about. + // The SID of the bulk eligibility check that you want to know about. RequestId *string `json:"request_id,omitempty"` - // This is the url of the request that you're trying to reach out to locate the resource. + // This is the url of the request that you're trying to reach out to locate the resource. Url *string `json:"url,omitempty"` - // The result set that contains the eligibility check response for each requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. + // The result set that contains the eligibility check response for each requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. Results *[]interface{} `json:"results,omitempty"` - // This is the string that you assigned as a friendly name for describing the eligibility check request. + // This is the string that you assigned as a friendly name for describing the eligibility check request. FriendlyName *string `json:"friendly_name,omitempty"` - // This is the status of the bulk eligibility check request. (Example: COMPLETE, IN_PROGRESS) - Status *string `json:"status,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` + // This is the status of the bulk eligibility check request. (Example: COMPLETE, IN_PROGRESS) + Status *string `json:"status,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` DateCompleted *time.Time `json:"date_completed,omitempty"` } + + diff --git a/rest/numbers/v1/model_numbers_v1_eligibility.go b/rest/numbers/v1/model_numbers_v1_eligibility.go index 24944fb63..0a9c46d02 100644 --- a/rest/numbers/v1/model_numbers_v1_eligibility.go +++ b/rest/numbers/v1/model_numbers_v1_eligibility.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV1Eligibility struct for NumbersV1Eligibility type NumbersV1Eligibility struct { - // The result set that contains the eligibility check response for the requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, date_last_checked: Datetime (ISO 8601) when the PN was last checked for eligibility, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. + // The result set that contains the eligibility check response for the requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, date_last_checked: Datetime (ISO 8601) when the PN was last checked for eligibility, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. Results *[]interface{} `json:"results,omitempty"` } + + diff --git a/rest/numbers/v1/model_numbers_v1_porting_bulk_portability.go b/rest/numbers/v1/model_numbers_v1_porting_bulk_portability.go index d6b5b4b3b..1c5a49c93 100644 --- a/rest/numbers/v1/model_numbers_v1_porting_bulk_portability.go +++ b/rest/numbers/v1/model_numbers_v1_porting_bulk_portability.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV1PortingBulkPortability struct for NumbersV1PortingBulkPortability type NumbersV1PortingBulkPortability struct { - // A 34 character string that uniquely identifies this Portability check. - Sid *string `json:"sid,omitempty"` + // A 34 character string that uniquely identifies this Portability check. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // The date that the Portability check was created, given in ISO 8601 format. + // The date that the Portability check was created, given in ISO 8601 format. DatetimeCreated *time.Time `json:"datetime_created,omitempty"` - // Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number. + // Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number. PhoneNumbers *[]interface{} `json:"phone_numbers,omitempty"` - // This is the url of the request that you're trying to reach out to locate the resource. + // This is the url of the request that you're trying to reach out to locate the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v1/model_numbers_v1_porting_port_in.go b/rest/numbers/v1/model_numbers_v1_porting_port_in.go index 9a1843806..9436dbcaa 100644 --- a/rest/numbers/v1/model_numbers_v1_porting_port_in.go +++ b/rest/numbers/v1/model_numbers_v1_porting_port_in.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV1PortingPortIn struct for NumbersV1PortingPortIn type NumbersV1PortingPortIn struct { - // The SID of the Port In request, It is the request identifier + // The SID of the Port In request, It is the request identifier PortInRequestSid *string `json:"port_in_request_sid,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v1/model_numbers_v1_porting_portability.go b/rest/numbers/v1/model_numbers_v1_porting_portability.go index ffd6bd962..5be512b69 100644 --- a/rest/numbers/v1/model_numbers_v1_porting_portability.go +++ b/rest/numbers/v1/model_numbers_v1_porting_portability.go @@ -13,28 +13,33 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV1PortingPortability struct for NumbersV1PortingPortability type NumbersV1PortingPortability struct { - // The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). + // The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212). PhoneNumber *string `json:"phone_number,omitempty"` - // The target account sid to which the number will be ported + // The target account sid to which the number will be ported AccountSid *string `json:"account_sid,omitempty"` - // Boolean flag specifying if phone number is portable or not. + // Boolean flag specifying if phone number is portable or not. Portable *bool `json:"portable,omitempty"` - // Boolean flag specifying if PIN and account number is required for the phone number. + // Boolean flag specifying if PIN and account number is required for the phone number. PinAndAccountNumberRequired *bool `json:"pin_and_account_number_required,omitempty"` - // Reason why the phone number cannot be ported into Twilio, `null` otherwise. + // Reason why the phone number cannot be ported into Twilio, `null` otherwise. NotPortableReason *string `json:"not_portable_reason,omitempty"` - // The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`. - NotPortableReasonCode *int `json:"not_portable_reason_code,omitempty"` - NumberType *string `json:"number_type,omitempty"` - // Country the phone number belongs to. + // The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`. + NotPortableReasonCode *int `json:"not_portable_reason_code,omitempty"` + NumberType *string `json:"number_type,omitempty"` + // Country the phone number belongs to. Country *string `json:"country,omitempty"` - // Current messaging carrier of the phone number + // Current messaging carrier of the phone number MessagingCarrier *string `json:"messaging_carrier,omitempty"` - // Current voice carrier of the phone number + // Current voice carrier of the phone number VoiceCarrier *string `json:"voice_carrier,omitempty"` - // This is the url of the request that you're trying to reach out to locate the resource. + // This is the url of the request that you're trying to reach out to locate the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v1/porting_portability.go b/rest/numbers/v1/porting_portability.go index 813ecdfb1..db876a8ad 100644 --- a/rest/numbers/v1/porting_portability.go +++ b/rest/numbers/v1/porting_portability.go @@ -16,68 +16,74 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePortingBulkPortability' type CreatePortingBulkPortabilityParams struct { - // The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). . - PhoneNumbers *[]string `json:"PhoneNumbers,omitempty"` + // The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). . + PhoneNumbers *[]string `json:"PhoneNumbers,omitempty"` } -func (params *CreatePortingBulkPortabilityParams) SetPhoneNumbers(PhoneNumbers []string) *CreatePortingBulkPortabilityParams { - params.PhoneNumbers = &PhoneNumbers - return params +func (params *CreatePortingBulkPortabilityParams) SetPhoneNumbers(PhoneNumbers []string) (*CreatePortingBulkPortabilityParams){ + params.PhoneNumbers = &PhoneNumbers + return params } // Allows to check if a list of phone numbers can be ported to Twilio or not. This is done asynchronous for each phone number. func (c *ApiService) CreatePortingBulkPortability(params *CreatePortingBulkPortabilityParams) (*NumbersV1PortingBulkPortability, error) { - path := "/v1/Porting/Portability" + path := "/v1/Porting/Portability" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.PhoneNumbers != nil { + for _, item := range *params.PhoneNumbers { + data.Add("PhoneNumbers", item) + } + } - if params != nil && params.PhoneNumbers != nil { - for _, item := range *params.PhoneNumbers { - data.Add("PhoneNumbers", item) - } - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV1PortingBulkPortability{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV1PortingBulkPortability{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Fetch a previous portability check. This should return the current status of the validation and the result for all the numbers provided, given that they have been validated (as this process is performed asynchronously). -func (c *ApiService) FetchPortingBulkPortability(Sid string) (*NumbersV1PortingBulkPortability, error) { - path := "/v1/Porting/Portability/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchPortingBulkPortability(Sid string, ) (*NumbersV1PortingBulkPortability, error) { + path := "/v1/Porting/Portability/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV1PortingBulkPortability{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV1PortingBulkPortability{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v1/porting_portability_phone_number.go b/rest/numbers/v1/porting_portability_phone_number.go index 22279148c..e3fd94290 100644 --- a/rest/numbers/v1/porting_portability_phone_number.go +++ b/rest/numbers/v1/porting_portability_phone_number.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchPortingPortability' type FetchPortingPortabilityParams struct { - // The SID of the account where the phone number(s) will be ported. - TargetAccountSid *string `json:"TargetAccountSid,omitempty"` + // The SID of the account where the phone number(s) will be ported. + TargetAccountSid *string `json:"TargetAccountSid,omitempty"` } -func (params *FetchPortingPortabilityParams) SetTargetAccountSid(TargetAccountSid string) *FetchPortingPortabilityParams { - params.TargetAccountSid = &TargetAccountSid - return params +func (params *FetchPortingPortabilityParams) SetTargetAccountSid(TargetAccountSid string) (*FetchPortingPortabilityParams){ + params.TargetAccountSid = &TargetAccountSid + return params } // Allows to check if a single phone number can be ported to Twilio or not. func (c *ApiService) FetchPortingPortability(PhoneNumber string, params *FetchPortingPortabilityParams) (*NumbersV1PortingPortability, error) { - path := "/v1/Porting/Portability/PhoneNumber/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + path := "/v1/Porting/Portability/PhoneNumber/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TargetAccountSid != nil { + data.Set("TargetAccountSid", *params.TargetAccountSid) + } - if params != nil && params.TargetAccountSid != nil { - data.Set("TargetAccountSid", *params.TargetAccountSid) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV1PortingPortability{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV1PortingPortability{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v2/README.md b/rest/numbers/v2/README.md index 3894bcd8e..3318f9450 100644 --- a/rest/numbers/v2/README.md +++ b/rest/numbers/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -40,6 +40,7 @@ Class | Method | HTTP request | Description *HostedNumberOrdersApi* | [**DeleteHostedNumberOrder**](docs/HostedNumberOrdersApi.md#deletehostednumberorder) | **Delete** /v2/HostedNumber/Orders/{Sid} | *HostedNumberOrdersApi* | [**FetchHostedNumberOrder**](docs/HostedNumberOrdersApi.md#fetchhostednumberorder) | **Get** /v2/HostedNumber/Orders/{Sid} | *HostedNumberOrdersApi* | [**ListHostedNumberOrder**](docs/HostedNumberOrdersApi.md#listhostednumberorder) | **Get** /v2/HostedNumber/Orders | +*HostedNumberOrdersBulkApi* | [**CreateBulkHostedNumberOrder**](docs/HostedNumberOrdersBulkApi.md#createbulkhostednumberorder) | **Post** /v2/HostedNumber/Orders/Bulk | *HostedNumberOrdersBulkApi* | [**FetchBulkHostedNumberOrder**](docs/HostedNumberOrdersBulkApi.md#fetchbulkhostednumberorder) | **Get** /v2/HostedNumber/Orders/Bulk/{BulkHostingSid} | *RegulatoryComplianceBundlesApi* | [**CreateBundle**](docs/RegulatoryComplianceBundlesApi.md#createbundle) | **Post** /v2/RegulatoryCompliance/Bundles | *RegulatoryComplianceBundlesApi* | [**DeleteBundle**](docs/RegulatoryComplianceBundlesApi.md#deletebundle) | **Delete** /v2/RegulatoryCompliance/Bundles/{Sid} | diff --git a/rest/numbers/v2/api_service.go b/rest/numbers/v2/api_service.go index 46727785d..4c8e2d4a1 100644 --- a/rest/numbers/v2/api_service.go +++ b/rest/numbers/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://numbers.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/numbers/v2/docs/HostedNumberOrdersBulkApi.md b/rest/numbers/v2/docs/HostedNumberOrdersBulkApi.md index fbbcd3450..7f0c0b8f7 100644 --- a/rest/numbers/v2/docs/HostedNumberOrdersBulkApi.md +++ b/rest/numbers/v2/docs/HostedNumberOrdersBulkApi.md @@ -4,10 +4,46 @@ All URIs are relative to *https://numbers.twilio.com* Method | HTTP request | Description ------------- | ------------- | ------------- +[**CreateBulkHostedNumberOrder**](HostedNumberOrdersBulkApi.md#CreateBulkHostedNumberOrder) | **Post** /v2/HostedNumber/Orders/Bulk | [**FetchBulkHostedNumberOrder**](HostedNumberOrdersBulkApi.md#FetchBulkHostedNumberOrder) | **Get** /v2/HostedNumber/Orders/Bulk/{BulkHostingSid} | +## CreateBulkHostedNumberOrder + +> NumbersV2BulkHostedNumberOrder CreateBulkHostedNumberOrder(ctx, ) + + + +Host multiple phone numbers on Twilio's platform. + +### Path Parameters + +This endpoint does not need any path parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateBulkHostedNumberOrderParams struct + + +### Return type + +[**NumbersV2BulkHostedNumberOrder**](NumbersV2BulkHostedNumberOrder.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## FetchBulkHostedNumberOrder > NumbersV2BulkHostedNumberOrder FetchBulkHostedNumberOrder(ctx, BulkHostingSidoptional) diff --git a/rest/numbers/v2/docs/ListAuthorizationDocumentResponseMeta.md b/rest/numbers/v2/docs/ListAuthorizationDocumentResponseMeta.md index e26545bdd..326d23ece 100644 --- a/rest/numbers/v2/docs/ListAuthorizationDocumentResponseMeta.md +++ b/rest/numbers/v2/docs/ListAuthorizationDocumentResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/numbers/v2/docs/RegulatoryComplianceBundlesApi.md b/rest/numbers/v2/docs/RegulatoryComplianceBundlesApi.md index 3d98a3d96..99f7bb401 100644 --- a/rest/numbers/v2/docs/RegulatoryComplianceBundlesApi.md +++ b/rest/numbers/v2/docs/RegulatoryComplianceBundlesApi.md @@ -169,8 +169,6 @@ Name | Type | Description **SortBy** | **string** | Can be `valid-until` or `date-updated`. Defaults to `date-created`. **SortDirection** | **string** | Default is `DESC`. Can be `ASC` or `DESC`. **ValidUntilDate** | **time.Time** | Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. -**ValidUntilDateBefore** | **time.Time** | Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. -**ValidUntilDateAfter** | **time.Time** | Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. **Limit** | **int** | Max number of records to return. diff --git a/rest/numbers/v2/hosted_number_authorization_documents.go b/rest/numbers/v2/hosted_number_authorization_documents.go index f258fe604..334ce5be0 100644 --- a/rest/numbers/v2/hosted_number_authorization_documents.go +++ b/rest/numbers/v2/hosted_number_authorization_documents.go @@ -18,204 +18,210 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAuthorizationDocument' type CreateAuthorizationDocumentParams struct { - // A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. - AddressSid *string `json:"AddressSid,omitempty"` - // Email that this AuthorizationDocument will be sent to for signing. - Email *string `json:"Email,omitempty"` - // The contact phone number of the person authorized to sign the Authorization Document. - ContactPhoneNumber *string `json:"ContactPhoneNumber,omitempty"` - // A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio's platform. - HostedNumberOrderSids *[]string `json:"HostedNumberOrderSids,omitempty"` - // The title of the person authorized to sign the Authorization Document for this phone number. - ContactTitle *string `json:"ContactTitle,omitempty"` - // Email recipients who will be informed when an Authorization Document has been sent and signed. - CcEmails *[]string `json:"CcEmails,omitempty"` + // A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. + AddressSid *string `json:"AddressSid,omitempty"` + // Email that this AuthorizationDocument will be sent to for signing. + Email *string `json:"Email,omitempty"` + // The contact phone number of the person authorized to sign the Authorization Document. + ContactPhoneNumber *string `json:"ContactPhoneNumber,omitempty"` + // A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio's platform. + HostedNumberOrderSids *[]string `json:"HostedNumberOrderSids,omitempty"` + // The title of the person authorized to sign the Authorization Document for this phone number. + ContactTitle *string `json:"ContactTitle,omitempty"` + // Email recipients who will be informed when an Authorization Document has been sent and signed. + CcEmails *[]string `json:"CcEmails,omitempty"` } -func (params *CreateAuthorizationDocumentParams) SetAddressSid(AddressSid string) *CreateAuthorizationDocumentParams { - params.AddressSid = &AddressSid - return params +func (params *CreateAuthorizationDocumentParams) SetAddressSid(AddressSid string) (*CreateAuthorizationDocumentParams){ + params.AddressSid = &AddressSid + return params } -func (params *CreateAuthorizationDocumentParams) SetEmail(Email string) *CreateAuthorizationDocumentParams { - params.Email = &Email - return params +func (params *CreateAuthorizationDocumentParams) SetEmail(Email string) (*CreateAuthorizationDocumentParams){ + params.Email = &Email + return params } -func (params *CreateAuthorizationDocumentParams) SetContactPhoneNumber(ContactPhoneNumber string) *CreateAuthorizationDocumentParams { - params.ContactPhoneNumber = &ContactPhoneNumber - return params +func (params *CreateAuthorizationDocumentParams) SetContactPhoneNumber(ContactPhoneNumber string) (*CreateAuthorizationDocumentParams){ + params.ContactPhoneNumber = &ContactPhoneNumber + return params } -func (params *CreateAuthorizationDocumentParams) SetHostedNumberOrderSids(HostedNumberOrderSids []string) *CreateAuthorizationDocumentParams { - params.HostedNumberOrderSids = &HostedNumberOrderSids - return params +func (params *CreateAuthorizationDocumentParams) SetHostedNumberOrderSids(HostedNumberOrderSids []string) (*CreateAuthorizationDocumentParams){ + params.HostedNumberOrderSids = &HostedNumberOrderSids + return params } -func (params *CreateAuthorizationDocumentParams) SetContactTitle(ContactTitle string) *CreateAuthorizationDocumentParams { - params.ContactTitle = &ContactTitle - return params +func (params *CreateAuthorizationDocumentParams) SetContactTitle(ContactTitle string) (*CreateAuthorizationDocumentParams){ + params.ContactTitle = &ContactTitle + return params } -func (params *CreateAuthorizationDocumentParams) SetCcEmails(CcEmails []string) *CreateAuthorizationDocumentParams { - params.CcEmails = &CcEmails - return params +func (params *CreateAuthorizationDocumentParams) SetCcEmails(CcEmails []string) (*CreateAuthorizationDocumentParams){ + params.CcEmails = &CcEmails + return params } // Create an AuthorizationDocument for authorizing the hosting of phone number capabilities on Twilio's platform. func (c *ApiService) CreateAuthorizationDocument(params *CreateAuthorizationDocumentParams) (*NumbersV2AuthorizationDocument, error) { - path := "/v2/HostedNumber/AuthorizationDocuments" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - if params != nil && params.ContactPhoneNumber != nil { - data.Set("ContactPhoneNumber", *params.ContactPhoneNumber) - } - if params != nil && params.HostedNumberOrderSids != nil { - for _, item := range *params.HostedNumberOrderSids { - data.Add("HostedNumberOrderSids", item) - } - } - if params != nil && params.ContactTitle != nil { - data.Set("ContactTitle", *params.ContactTitle) - } - if params != nil && params.CcEmails != nil { - for _, item := range *params.CcEmails { - data.Add("CcEmails", item) - } - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NumbersV2AuthorizationDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/HostedNumber/AuthorizationDocuments" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + if params != nil && params.ContactPhoneNumber != nil { + data.Set("ContactPhoneNumber", *params.ContactPhoneNumber) + } + if params != nil && params.HostedNumberOrderSids != nil { + for _, item := range *params.HostedNumberOrderSids { + data.Add("HostedNumberOrderSids", item) + } + } + if params != nil && params.ContactTitle != nil { + data.Set("ContactTitle", *params.ContactTitle) + } + if params != nil && params.CcEmails != nil { + for _, item := range *params.CcEmails { + data.Add("CcEmails", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2AuthorizationDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Cancel the AuthorizationDocument request. -func (c *ApiService) DeleteAuthorizationDocument(Sid string) error { - path := "/v2/HostedNumber/AuthorizationDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteAuthorizationDocument(Sid string, ) (error) { + path := "/v2/HostedNumber/AuthorizationDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific AuthorizationDocument. -func (c *ApiService) FetchAuthorizationDocument(Sid string) (*NumbersV2AuthorizationDocument, error) { - path := "/v2/HostedNumber/AuthorizationDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchAuthorizationDocument(Sid string, ) (*NumbersV2AuthorizationDocument, error) { + path := "/v2/HostedNumber/AuthorizationDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2AuthorizationDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &NumbersV2AuthorizationDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAuthorizationDocument' type ListAuthorizationDocumentParams struct { - // Email that this AuthorizationDocument will be sent to for signing. - Email *string `json:"Email,omitempty"` - // Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Email that this AuthorizationDocument will be sent to for signing. + Email *string `json:"Email,omitempty"` + // Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAuthorizationDocumentParams) SetEmail(Email string) *ListAuthorizationDocumentParams { - params.Email = &Email - return params +func (params *ListAuthorizationDocumentParams) SetEmail(Email string) (*ListAuthorizationDocumentParams){ + params.Email = &Email + return params } -func (params *ListAuthorizationDocumentParams) SetStatus(Status string) *ListAuthorizationDocumentParams { - params.Status = &Status - return params +func (params *ListAuthorizationDocumentParams) SetStatus(Status string) (*ListAuthorizationDocumentParams){ + params.Status = &Status + return params } -func (params *ListAuthorizationDocumentParams) SetPageSize(PageSize int) *ListAuthorizationDocumentParams { - params.PageSize = &PageSize - return params +func (params *ListAuthorizationDocumentParams) SetPageSize(PageSize int) (*ListAuthorizationDocumentParams){ + params.PageSize = &PageSize + return params } -func (params *ListAuthorizationDocumentParams) SetLimit(Limit int) *ListAuthorizationDocumentParams { - params.Limit = &Limit - return params +func (params *ListAuthorizationDocumentParams) SetLimit(Limit int) (*ListAuthorizationDocumentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AuthorizationDocument records from the API. Request is executed immediately. func (c *ApiService) PageAuthorizationDocument(params *ListAuthorizationDocumentParams, pageToken, pageNumber string) (*ListAuthorizationDocumentResponse, error) { - path := "/v2/HostedNumber/AuthorizationDocuments" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAuthorizationDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/HostedNumber/AuthorizationDocuments" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAuthorizationDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists AuthorizationDocument records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -256,6 +262,7 @@ func (c *ApiService) StreamAuthorizationDocument(params *ListAuthorizationDocume return recordChannel, errorChannel } + func (c *ApiService) streamAuthorizationDocument(response *ListAuthorizationDocumentResponse, params *ListAuthorizationDocumentParams, recordChannel chan NumbersV2AuthorizationDocument, errorChannel chan error) { curRecord := 1 @@ -287,19 +294,20 @@ func (c *ApiService) streamAuthorizationDocument(response *ListAuthorizationDocu } func (c *ApiService) getNextListAuthorizationDocumentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAuthorizationDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAuthorizationDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/hosted_number_authorization_documents_dependent_hosted_number_orders.go b/rest/numbers/v2/hosted_number_authorization_documents_dependent_hosted_number_orders.go index 5e5c55323..9304df97e 100644 --- a/rest/numbers/v2/hosted_number_authorization_documents_dependent_hosted_number_orders.go +++ b/rest/numbers/v2/hosted_number_authorization_documents_dependent_hosted_number_orders.go @@ -18,97 +18,97 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListDependentHostedNumberOrder' type ListDependentHostedNumberOrderParams struct { - // Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. - Status *string `json:"Status,omitempty"` - // An E164 formatted phone number hosted by this HostedNumberOrder. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. - IncomingPhoneNumberSid *string `json:"IncomingPhoneNumberSid,omitempty"` - // A human readable description of this resource, up to 128 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses. + Status *string `json:"Status,omitempty"` + // An E164 formatted phone number hosted by this HostedNumberOrder. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. + IncomingPhoneNumberSid *string `json:"IncomingPhoneNumberSid,omitempty"` + // A human readable description of this resource, up to 128 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDependentHostedNumberOrderParams) SetStatus(Status string) *ListDependentHostedNumberOrderParams { - params.Status = &Status - return params +func (params *ListDependentHostedNumberOrderParams) SetStatus(Status string) (*ListDependentHostedNumberOrderParams){ + params.Status = &Status + return params } -func (params *ListDependentHostedNumberOrderParams) SetPhoneNumber(PhoneNumber string) *ListDependentHostedNumberOrderParams { - params.PhoneNumber = &PhoneNumber - return params +func (params *ListDependentHostedNumberOrderParams) SetPhoneNumber(PhoneNumber string) (*ListDependentHostedNumberOrderParams){ + params.PhoneNumber = &PhoneNumber + return params } -func (params *ListDependentHostedNumberOrderParams) SetIncomingPhoneNumberSid(IncomingPhoneNumberSid string) *ListDependentHostedNumberOrderParams { - params.IncomingPhoneNumberSid = &IncomingPhoneNumberSid - return params +func (params *ListDependentHostedNumberOrderParams) SetIncomingPhoneNumberSid(IncomingPhoneNumberSid string) (*ListDependentHostedNumberOrderParams){ + params.IncomingPhoneNumberSid = &IncomingPhoneNumberSid + return params } -func (params *ListDependentHostedNumberOrderParams) SetFriendlyName(FriendlyName string) *ListDependentHostedNumberOrderParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListDependentHostedNumberOrderParams) SetFriendlyName(FriendlyName string) (*ListDependentHostedNumberOrderParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListDependentHostedNumberOrderParams) SetPageSize(PageSize int) *ListDependentHostedNumberOrderParams { - params.PageSize = &PageSize - return params +func (params *ListDependentHostedNumberOrderParams) SetPageSize(PageSize int) (*ListDependentHostedNumberOrderParams){ + params.PageSize = &PageSize + return params } -func (params *ListDependentHostedNumberOrderParams) SetLimit(Limit int) *ListDependentHostedNumberOrderParams { - params.Limit = &Limit - return params +func (params *ListDependentHostedNumberOrderParams) SetLimit(Limit int) (*ListDependentHostedNumberOrderParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DependentHostedNumberOrder records from the API. Request is executed immediately. func (c *ApiService) PageDependentHostedNumberOrder(SigningDocumentSid string, params *ListDependentHostedNumberOrderParams, pageToken, pageNumber string) (*ListDependentHostedNumberOrderResponse, error) { - path := "/v2/HostedNumber/AuthorizationDocuments/{SigningDocumentSid}/DependentHostedNumberOrders" - - path = strings.Replace(path, "{"+"SigningDocumentSid"+"}", SigningDocumentSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.IncomingPhoneNumberSid != nil { - data.Set("IncomingPhoneNumberSid", *params.IncomingPhoneNumberSid) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDependentHostedNumberOrderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/HostedNumber/AuthorizationDocuments/{SigningDocumentSid}/DependentHostedNumberOrders" + + path = strings.Replace(path, "{"+"SigningDocumentSid"+"}", SigningDocumentSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.IncomingPhoneNumberSid != nil { + data.Set("IncomingPhoneNumberSid", *params.IncomingPhoneNumberSid) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDependentHostedNumberOrderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists DependentHostedNumberOrder records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -149,6 +149,7 @@ func (c *ApiService) StreamDependentHostedNumberOrder(SigningDocumentSid string, return recordChannel, errorChannel } + func (c *ApiService) streamDependentHostedNumberOrder(response *ListDependentHostedNumberOrderResponse, params *ListDependentHostedNumberOrderParams, recordChannel chan NumbersV2DependentHostedNumberOrder, errorChannel chan error) { curRecord := 1 @@ -180,19 +181,20 @@ func (c *ApiService) streamDependentHostedNumberOrder(response *ListDependentHos } func (c *ApiService) getNextListDependentHostedNumberOrderResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDependentHostedNumberOrderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDependentHostedNumberOrderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/hosted_number_orders.go b/rest/numbers/v2/hosted_number_orders.go index 2b61d2000..a245be347 100644 --- a/rest/numbers/v2/hosted_number_orders.go +++ b/rest/numbers/v2/hosted_number_orders.go @@ -18,319 +18,325 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateHostedNumberOrder' type CreateHostedNumberOrderParams struct { - // The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // The contact phone number of the person authorized to sign the Authorization Document. - ContactPhoneNumber *string `json:"ContactPhoneNumber,omitempty"` - // Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. - AddressSid *string `json:"AddressSid,omitempty"` - // Optional. Email of the owner of this phone number that is being hosted. - Email *string `json:"Email,omitempty"` - // This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. - AccountSid *string `json:"AccountSid,omitempty"` - // A 128 character string that is a human readable text that describes this resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. - CcEmails *[]string `json:"CcEmails,omitempty"` - // The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. - SmsUrl *string `json:"SmsUrl,omitempty"` - // The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. - SmsMethod *string `json:"SmsMethod,omitempty"` - // A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // Used to specify that the SMS capability will be hosted on Twilio's platform. - SmsCapability *bool `json:"SmsCapability,omitempty"` - // The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. - StatusCallbackUrl *string `json:"StatusCallbackUrl,omitempty"` - // Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. - SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` - // The title of the person authorized to sign the Authorization Document for this phone number. - ContactTitle *string `json:"ContactTitle,omitempty"` -} - -func (params *CreateHostedNumberOrderParams) SetPhoneNumber(PhoneNumber string) *CreateHostedNumberOrderParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *CreateHostedNumberOrderParams) SetContactPhoneNumber(ContactPhoneNumber string) *CreateHostedNumberOrderParams { - params.ContactPhoneNumber = &ContactPhoneNumber - return params -} -func (params *CreateHostedNumberOrderParams) SetAddressSid(AddressSid string) *CreateHostedNumberOrderParams { - params.AddressSid = &AddressSid - return params -} -func (params *CreateHostedNumberOrderParams) SetEmail(Email string) *CreateHostedNumberOrderParams { - params.Email = &Email - return params -} -func (params *CreateHostedNumberOrderParams) SetAccountSid(AccountSid string) *CreateHostedNumberOrderParams { - params.AccountSid = &AccountSid - return params -} -func (params *CreateHostedNumberOrderParams) SetFriendlyName(FriendlyName string) *CreateHostedNumberOrderParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateHostedNumberOrderParams) SetCcEmails(CcEmails []string) *CreateHostedNumberOrderParams { - params.CcEmails = &CcEmails - return params -} -func (params *CreateHostedNumberOrderParams) SetSmsUrl(SmsUrl string) *CreateHostedNumberOrderParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *CreateHostedNumberOrderParams) SetSmsMethod(SmsMethod string) *CreateHostedNumberOrderParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *CreateHostedNumberOrderParams) SetSmsFallbackUrl(SmsFallbackUrl string) *CreateHostedNumberOrderParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *CreateHostedNumberOrderParams) SetSmsCapability(SmsCapability bool) *CreateHostedNumberOrderParams { - params.SmsCapability = &SmsCapability - return params -} -func (params *CreateHostedNumberOrderParams) SetSmsFallbackMethod(SmsFallbackMethod string) *CreateHostedNumberOrderParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *CreateHostedNumberOrderParams) SetStatusCallbackUrl(StatusCallbackUrl string) *CreateHostedNumberOrderParams { - params.StatusCallbackUrl = &StatusCallbackUrl - return params -} -func (params *CreateHostedNumberOrderParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateHostedNumberOrderParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateHostedNumberOrderParams) SetSmsApplicationSid(SmsApplicationSid string) *CreateHostedNumberOrderParams { - params.SmsApplicationSid = &SmsApplicationSid - return params -} -func (params *CreateHostedNumberOrderParams) SetContactTitle(ContactTitle string) *CreateHostedNumberOrderParams { - params.ContactTitle = &ContactTitle - return params + // The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The contact phone number of the person authorized to sign the Authorization Document. + ContactPhoneNumber *string `json:"ContactPhoneNumber,omitempty"` + // Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. + AddressSid *string `json:"AddressSid,omitempty"` + // Optional. Email of the owner of this phone number that is being hosted. + Email *string `json:"Email,omitempty"` + // This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. + AccountSid *string `json:"AccountSid,omitempty"` + // A 128 character string that is a human readable text that describes this resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. + CcEmails *[]string `json:"CcEmails,omitempty"` + // The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. + SmsUrl *string `json:"SmsUrl,omitempty"` + // The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. + SmsMethod *string `json:"SmsMethod,omitempty"` + // A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // Used to specify that the SMS capability will be hosted on Twilio's platform. + SmsCapability *bool `json:"SmsCapability,omitempty"` + // The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. + StatusCallbackUrl *string `json:"StatusCallbackUrl,omitempty"` + // Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. + SmsApplicationSid *string `json:"SmsApplicationSid,omitempty"` + // The title of the person authorized to sign the Authorization Document for this phone number. + ContactTitle *string `json:"ContactTitle,omitempty"` +} + +func (params *CreateHostedNumberOrderParams) SetPhoneNumber(PhoneNumber string) (*CreateHostedNumberOrderParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *CreateHostedNumberOrderParams) SetContactPhoneNumber(ContactPhoneNumber string) (*CreateHostedNumberOrderParams){ + params.ContactPhoneNumber = &ContactPhoneNumber + return params +} +func (params *CreateHostedNumberOrderParams) SetAddressSid(AddressSid string) (*CreateHostedNumberOrderParams){ + params.AddressSid = &AddressSid + return params +} +func (params *CreateHostedNumberOrderParams) SetEmail(Email string) (*CreateHostedNumberOrderParams){ + params.Email = &Email + return params +} +func (params *CreateHostedNumberOrderParams) SetAccountSid(AccountSid string) (*CreateHostedNumberOrderParams){ + params.AccountSid = &AccountSid + return params +} +func (params *CreateHostedNumberOrderParams) SetFriendlyName(FriendlyName string) (*CreateHostedNumberOrderParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateHostedNumberOrderParams) SetCcEmails(CcEmails []string) (*CreateHostedNumberOrderParams){ + params.CcEmails = &CcEmails + return params +} +func (params *CreateHostedNumberOrderParams) SetSmsUrl(SmsUrl string) (*CreateHostedNumberOrderParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *CreateHostedNumberOrderParams) SetSmsMethod(SmsMethod string) (*CreateHostedNumberOrderParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *CreateHostedNumberOrderParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*CreateHostedNumberOrderParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *CreateHostedNumberOrderParams) SetSmsCapability(SmsCapability bool) (*CreateHostedNumberOrderParams){ + params.SmsCapability = &SmsCapability + return params +} +func (params *CreateHostedNumberOrderParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*CreateHostedNumberOrderParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *CreateHostedNumberOrderParams) SetStatusCallbackUrl(StatusCallbackUrl string) (*CreateHostedNumberOrderParams){ + params.StatusCallbackUrl = &StatusCallbackUrl + return params +} +func (params *CreateHostedNumberOrderParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateHostedNumberOrderParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateHostedNumberOrderParams) SetSmsApplicationSid(SmsApplicationSid string) (*CreateHostedNumberOrderParams){ + params.SmsApplicationSid = &SmsApplicationSid + return params +} +func (params *CreateHostedNumberOrderParams) SetContactTitle(ContactTitle string) (*CreateHostedNumberOrderParams){ + params.ContactTitle = &ContactTitle + return params } // Host a phone number's capability on Twilio's platform. func (c *ApiService) CreateHostedNumberOrder(params *CreateHostedNumberOrderParams) (*NumbersV2HostedNumberOrder, error) { - path := "/v2/HostedNumber/Orders" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.ContactPhoneNumber != nil { - data.Set("ContactPhoneNumber", *params.ContactPhoneNumber) - } - if params != nil && params.AddressSid != nil { - data.Set("AddressSid", *params.AddressSid) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - if params != nil && params.AccountSid != nil { - data.Set("AccountSid", *params.AccountSid) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CcEmails != nil { - for _, item := range *params.CcEmails { - data.Add("CcEmails", item) - } - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsCapability != nil { - data.Set("SmsCapability", fmt.Sprint(*params.SmsCapability)) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.StatusCallbackUrl != nil { - data.Set("StatusCallbackUrl", *params.StatusCallbackUrl) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.SmsApplicationSid != nil { - data.Set("SmsApplicationSid", *params.SmsApplicationSid) - } - if params != nil && params.ContactTitle != nil { - data.Set("ContactTitle", *params.ContactTitle) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NumbersV2HostedNumberOrder{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/HostedNumber/Orders" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.ContactPhoneNumber != nil { + data.Set("ContactPhoneNumber", *params.ContactPhoneNumber) + } + if params != nil && params.AddressSid != nil { + data.Set("AddressSid", *params.AddressSid) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + if params != nil && params.AccountSid != nil { + data.Set("AccountSid", *params.AccountSid) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CcEmails != nil { + for _, item := range *params.CcEmails { + data.Add("CcEmails", item) + } + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsCapability != nil { + data.Set("SmsCapability", fmt.Sprint(*params.SmsCapability)) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.StatusCallbackUrl != nil { + data.Set("StatusCallbackUrl", *params.StatusCallbackUrl) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.SmsApplicationSid != nil { + data.Set("SmsApplicationSid", *params.SmsApplicationSid) + } + if params != nil && params.ContactTitle != nil { + data.Set("ContactTitle", *params.ContactTitle) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2HostedNumberOrder{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Cancel the HostedNumberOrder (only available when the status is in `received`). -func (c *ApiService) DeleteHostedNumberOrder(Sid string) error { - path := "/v2/HostedNumber/Orders/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteHostedNumberOrder(Sid string, ) (error) { + path := "/v2/HostedNumber/Orders/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific HostedNumberOrder. -func (c *ApiService) FetchHostedNumberOrder(Sid string) (*NumbersV2HostedNumberOrder, error) { - path := "/v2/HostedNumber/Orders/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchHostedNumberOrder(Sid string, ) (*NumbersV2HostedNumberOrder, error) { + path := "/v2/HostedNumber/Orders/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2HostedNumberOrder{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &NumbersV2HostedNumberOrder{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListHostedNumberOrder' type ListHostedNumberOrderParams struct { - // The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. - Status *string `json:"Status,omitempty"` - // Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. - SmsCapability *bool `json:"SmsCapability,omitempty"` - // An E164 formatted phone number hosted by this HostedNumberOrder. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. - IncomingPhoneNumberSid *string `json:"IncomingPhoneNumberSid,omitempty"` - // A human readable description of this resource, up to 128 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListHostedNumberOrderParams) SetStatus(Status string) *ListHostedNumberOrderParams { - params.Status = &Status - return params -} -func (params *ListHostedNumberOrderParams) SetSmsCapability(SmsCapability bool) *ListHostedNumberOrderParams { - params.SmsCapability = &SmsCapability - return params -} -func (params *ListHostedNumberOrderParams) SetPhoneNumber(PhoneNumber string) *ListHostedNumberOrderParams { - params.PhoneNumber = &PhoneNumber - return params -} -func (params *ListHostedNumberOrderParams) SetIncomingPhoneNumberSid(IncomingPhoneNumberSid string) *ListHostedNumberOrderParams { - params.IncomingPhoneNumberSid = &IncomingPhoneNumberSid - return params -} -func (params *ListHostedNumberOrderParams) SetFriendlyName(FriendlyName string) *ListHostedNumberOrderParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListHostedNumberOrderParams) SetPageSize(PageSize int) *ListHostedNumberOrderParams { - params.PageSize = &PageSize - return params -} -func (params *ListHostedNumberOrderParams) SetLimit(Limit int) *ListHostedNumberOrderParams { - params.Limit = &Limit - return params + // The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. + Status *string `json:"Status,omitempty"` + // Whether the SMS capability will be hosted on our platform. Can be `true` of `false`. + SmsCapability *bool `json:"SmsCapability,omitempty"` + // An E164 formatted phone number hosted by this HostedNumberOrder. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. + IncomingPhoneNumberSid *string `json:"IncomingPhoneNumberSid,omitempty"` + // A human readable description of this resource, up to 128 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListHostedNumberOrderParams) SetStatus(Status string) (*ListHostedNumberOrderParams){ + params.Status = &Status + return params +} +func (params *ListHostedNumberOrderParams) SetSmsCapability(SmsCapability bool) (*ListHostedNumberOrderParams){ + params.SmsCapability = &SmsCapability + return params +} +func (params *ListHostedNumberOrderParams) SetPhoneNumber(PhoneNumber string) (*ListHostedNumberOrderParams){ + params.PhoneNumber = &PhoneNumber + return params +} +func (params *ListHostedNumberOrderParams) SetIncomingPhoneNumberSid(IncomingPhoneNumberSid string) (*ListHostedNumberOrderParams){ + params.IncomingPhoneNumberSid = &IncomingPhoneNumberSid + return params +} +func (params *ListHostedNumberOrderParams) SetFriendlyName(FriendlyName string) (*ListHostedNumberOrderParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListHostedNumberOrderParams) SetPageSize(PageSize int) (*ListHostedNumberOrderParams){ + params.PageSize = &PageSize + return params +} +func (params *ListHostedNumberOrderParams) SetLimit(Limit int) (*ListHostedNumberOrderParams){ + params.Limit = &Limit + return params } // Retrieve a single page of HostedNumberOrder records from the API. Request is executed immediately. func (c *ApiService) PageHostedNumberOrder(params *ListHostedNumberOrderParams, pageToken, pageNumber string) (*ListHostedNumberOrderResponse, error) { - path := "/v2/HostedNumber/Orders" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.SmsCapability != nil { - data.Set("SmsCapability", fmt.Sprint(*params.SmsCapability)) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.IncomingPhoneNumberSid != nil { - data.Set("IncomingPhoneNumberSid", *params.IncomingPhoneNumberSid) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListHostedNumberOrderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/HostedNumber/Orders" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.SmsCapability != nil { + data.Set("SmsCapability", fmt.Sprint(*params.SmsCapability)) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.IncomingPhoneNumberSid != nil { + data.Set("IncomingPhoneNumberSid", *params.IncomingPhoneNumberSid) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListHostedNumberOrderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists HostedNumberOrder records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -371,6 +377,7 @@ func (c *ApiService) StreamHostedNumberOrder(params *ListHostedNumberOrderParams return recordChannel, errorChannel } + func (c *ApiService) streamHostedNumberOrder(response *ListHostedNumberOrderResponse, params *ListHostedNumberOrderParams, recordChannel chan NumbersV2HostedNumberOrder, errorChannel chan error) { curRecord := 1 @@ -402,19 +409,20 @@ func (c *ApiService) streamHostedNumberOrder(response *ListHostedNumberOrderResp } func (c *ApiService) getNextListHostedNumberOrderResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListHostedNumberOrderResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListHostedNumberOrderResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/hosted_number_orders_bulk.go b/rest/numbers/v2/hosted_number_orders_bulk.go index 341c7eee2..05c6d326b 100644 --- a/rest/numbers/v2/hosted_number_orders_bulk.go +++ b/rest/numbers/v2/hosted_number_orders_bulk.go @@ -16,44 +16,72 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + +// Host multiple phone numbers on Twilio's platform. +func (c *ApiService) CreateBulkHostedNumberOrder() (*NumbersV2BulkHostedNumberOrder, error) { + path := "/v2/HostedNumber/Orders/Bulk" + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2BulkHostedNumberOrder{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + // Optional parameters for the method 'FetchBulkHostedNumberOrder' type FetchBulkHostedNumberOrderParams struct { - // Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'. - OrderStatus *string `json:"OrderStatus,omitempty"` + // Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'. + OrderStatus *string `json:"OrderStatus,omitempty"` } -func (params *FetchBulkHostedNumberOrderParams) SetOrderStatus(OrderStatus string) *FetchBulkHostedNumberOrderParams { - params.OrderStatus = &OrderStatus - return params +func (params *FetchBulkHostedNumberOrderParams) SetOrderStatus(OrderStatus string) (*FetchBulkHostedNumberOrderParams){ + params.OrderStatus = &OrderStatus + return params } // Fetch a specific BulkHostedNumberOrder. func (c *ApiService) FetchBulkHostedNumberOrder(BulkHostingSid string, params *FetchBulkHostedNumberOrderParams) (*NumbersV2BulkHostedNumberOrder, error) { - path := "/v2/HostedNumber/Orders/Bulk/{BulkHostingSid}" - path = strings.Replace(path, "{"+"BulkHostingSid"+"}", BulkHostingSid, -1) + path := "/v2/HostedNumber/Orders/Bulk/{BulkHostingSid}" + path = strings.Replace(path, "{"+"BulkHostingSid"+"}", BulkHostingSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.OrderStatus != nil { + data.Set("OrderStatus", *params.OrderStatus) + } - if params != nil && params.OrderStatus != nil { - data.Set("OrderStatus", *params.OrderStatus) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV2BulkHostedNumberOrder{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV2BulkHostedNumberOrder{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v2/model_list_authorization_document_response.go b/rest/numbers/v2/model_list_authorization_document_response.go index 92f44dd99..15229e3bc 100644 --- a/rest/numbers/v2/model_list_authorization_document_response.go +++ b/rest/numbers/v2/model_list_authorization_document_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAuthorizationDocumentResponse struct for ListAuthorizationDocumentResponse type ListAuthorizationDocumentResponse struct { - Items []NumbersV2AuthorizationDocument `json:"items,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Items []NumbersV2AuthorizationDocument `json:"items,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_authorization_document_response_meta.go b/rest/numbers/v2/model_list_authorization_document_response_meta.go index 65a29879e..52fded4ff 100644 --- a/rest/numbers/v2/model_list_authorization_document_response_meta.go +++ b/rest/numbers/v2/model_list_authorization_document_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAuthorizationDocumentResponseMeta struct for ListAuthorizationDocumentResponseMeta type ListAuthorizationDocumentResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_bundle_copy_response.go b/rest/numbers/v2/model_list_bundle_copy_response.go index 3aefb39a3..9b5c3267c 100644 --- a/rest/numbers/v2/model_list_bundle_copy_response.go +++ b/rest/numbers/v2/model_list_bundle_copy_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBundleCopyResponse struct for ListBundleCopyResponse type ListBundleCopyResponse struct { - Results []NumbersV2BundleCopy `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2BundleCopy `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_bundle_response.go b/rest/numbers/v2/model_list_bundle_response.go index 4974d3947..da2883e82 100644 --- a/rest/numbers/v2/model_list_bundle_response.go +++ b/rest/numbers/v2/model_list_bundle_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBundleResponse struct for ListBundleResponse type ListBundleResponse struct { - Results []NumbersV2Bundle `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2Bundle `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_dependent_hosted_number_order_response.go b/rest/numbers/v2/model_list_dependent_hosted_number_order_response.go index 68fff8820..b604c8caf 100644 --- a/rest/numbers/v2/model_list_dependent_hosted_number_order_response.go +++ b/rest/numbers/v2/model_list_dependent_hosted_number_order_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDependentHostedNumberOrderResponse struct for ListDependentHostedNumberOrderResponse type ListDependentHostedNumberOrderResponse struct { Items []NumbersV2DependentHostedNumberOrder `json:"items,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_end_user_response.go b/rest/numbers/v2/model_list_end_user_response.go index 8a1192f92..6d8d57da8 100644 --- a/rest/numbers/v2/model_list_end_user_response.go +++ b/rest/numbers/v2/model_list_end_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEndUserResponse struct for ListEndUserResponse type ListEndUserResponse struct { - Results []NumbersV2EndUser `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2EndUser `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_end_user_type_response.go b/rest/numbers/v2/model_list_end_user_type_response.go index 447a02814..74e0fccd2 100644 --- a/rest/numbers/v2/model_list_end_user_type_response.go +++ b/rest/numbers/v2/model_list_end_user_type_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEndUserTypeResponse struct for ListEndUserTypeResponse type ListEndUserTypeResponse struct { - EndUserTypes []NumbersV2EndUserType `json:"end_user_types,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + EndUserTypes []NumbersV2EndUserType `json:"end_user_types,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_evaluation_response.go b/rest/numbers/v2/model_list_evaluation_response.go index 3621e8142..81ff1c6df 100644 --- a/rest/numbers/v2/model_list_evaluation_response.go +++ b/rest/numbers/v2/model_list_evaluation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEvaluationResponse struct for ListEvaluationResponse type ListEvaluationResponse struct { - Results []NumbersV2Evaluation `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2Evaluation `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_hosted_number_order_response.go b/rest/numbers/v2/model_list_hosted_number_order_response.go index 86080cfc8..e74fadd98 100644 --- a/rest/numbers/v2/model_list_hosted_number_order_response.go +++ b/rest/numbers/v2/model_list_hosted_number_order_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListHostedNumberOrderResponse struct for ListHostedNumberOrderResponse type ListHostedNumberOrderResponse struct { - Items []NumbersV2HostedNumberOrder `json:"items,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Items []NumbersV2HostedNumberOrder `json:"items,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_item_assignment_response.go b/rest/numbers/v2/model_list_item_assignment_response.go index 5fef21ef6..2a4e7840d 100644 --- a/rest/numbers/v2/model_list_item_assignment_response.go +++ b/rest/numbers/v2/model_list_item_assignment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListItemAssignmentResponse struct for ListItemAssignmentResponse type ListItemAssignmentResponse struct { - Results []NumbersV2ItemAssignment `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2ItemAssignment `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_regulation_response.go b/rest/numbers/v2/model_list_regulation_response.go index ea2797936..e2fc5db27 100644 --- a/rest/numbers/v2/model_list_regulation_response.go +++ b/rest/numbers/v2/model_list_regulation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRegulationResponse struct for ListRegulationResponse type ListRegulationResponse struct { - Results []NumbersV2Regulation `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2Regulation `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_supporting_document_response.go b/rest/numbers/v2/model_list_supporting_document_response.go index d6d55f00c..7e834ab33 100644 --- a/rest/numbers/v2/model_list_supporting_document_response.go +++ b/rest/numbers/v2/model_list_supporting_document_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSupportingDocumentResponse struct for ListSupportingDocumentResponse type ListSupportingDocumentResponse struct { - Results []NumbersV2SupportingDocument `json:"results,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + Results []NumbersV2SupportingDocument `json:"results,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_list_supporting_document_type_response.go b/rest/numbers/v2/model_list_supporting_document_type_response.go index 12de185a4..f66c48641 100644 --- a/rest/numbers/v2/model_list_supporting_document_type_response.go +++ b/rest/numbers/v2/model_list_supporting_document_type_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSupportingDocumentTypeResponse struct for ListSupportingDocumentTypeResponse type ListSupportingDocumentTypeResponse struct { - SupportingDocumentTypes []NumbersV2SupportingDocumentType `json:"supporting_document_types,omitempty"` - Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` + SupportingDocumentTypes []NumbersV2SupportingDocumentType `json:"supporting_document_types,omitempty"` + Meta ListAuthorizationDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_authorization_document.go b/rest/numbers/v2/model_numbers_v2_authorization_document.go index bb481d98a..37d05742a 100644 --- a/rest/numbers/v2/model_numbers_v2_authorization_document.go +++ b/rest/numbers/v2/model_numbers_v2_authorization_document.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2AuthorizationDocument struct for NumbersV2AuthorizationDocument type NumbersV2AuthorizationDocument struct { - // A 34 character string that uniquely identifies this AuthorizationDocument. + // A 34 character string that uniquely identifies this AuthorizationDocument. Sid *string `json:"sid,omitempty"` - // A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. + // A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. AddressSid *string `json:"address_sid,omitempty"` - Status *string `json:"status,omitempty"` - // Email that this AuthorizationDocument will be sent to for signing. + Status *string `json:"status,omitempty"` + // Email that this AuthorizationDocument will be sent to for signing. Email *string `json:"email,omitempty"` - // Email recipients who will be informed when an Authorization Document has been sent and signed. + // Email recipients who will be informed when an Authorization Document has been sent and signed. CcEmails *[]string `json:"cc_emails,omitempty"` - // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - DateUpdated *time.Time `json:"date_updated,omitempty"` - Url *string `json:"url,omitempty"` - Links *map[string]interface{} `json:"links,omitempty"` + // The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + DateUpdated *time.Time `json:"date_updated,omitempty"` + Url *string `json:"url,omitempty"` + Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_authorization_document_dependent_hosted_number_order_capabilities.go b/rest/numbers/v2/model_numbers_v2_authorization_document_dependent_hosted_number_order_capabilities.go index e85cecabd..0507edc7a 100644 --- a/rest/numbers/v2/model_numbers_v2_authorization_document_dependent_hosted_number_order_capabilities.go +++ b/rest/numbers/v2/model_numbers_v2_authorization_document_dependent_hosted_number_order_capabilities.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV2AuthorizationDocumentDependentHostedNumberOrderCapabilities A mapping of capabilities this hosted phone number will have enabled on Twilio's platform. type NumbersV2AuthorizationDocumentDependentHostedNumberOrderCapabilities struct { - Mms bool `json:"mms,omitempty"` - Sms bool `json:"sms,omitempty"` + Mms bool `json:"mms,omitempty"` + Sms bool `json:"sms,omitempty"` Voice bool `json:"voice,omitempty"` - Fax bool `json:"fax,omitempty"` + Fax bool `json:"fax,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_bulk_hosted_number_order.go b/rest/numbers/v2/model_numbers_v2_bulk_hosted_number_order.go index a6f08c81e..332c3461e 100644 --- a/rest/numbers/v2/model_numbers_v2_bulk_hosted_number_order.go +++ b/rest/numbers/v2/model_numbers_v2_bulk_hosted_number_order.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2BulkHostedNumberOrder struct for NumbersV2BulkHostedNumberOrder type NumbersV2BulkHostedNumberOrder struct { - // A 34 character string that uniquely identifies this BulkHostedNumberOrder. + // A 34 character string that uniquely identifies this BulkHostedNumberOrder. BulkHostingSid *string `json:"bulk_hosting_sid,omitempty"` - RequestStatus *string `json:"request_status,omitempty"` - // A 128 character string that is a human-readable text that describes this resource. + RequestStatus *string `json:"request_status,omitempty"` + // A 128 character string that is a human-readable text that describes this resource. FriendlyName *string `json:"friendly_name,omitempty"` - // Email address used for send notifications about this Bulk hosted number request. + // Email address used for send notifications about this Bulk hosted number request. NotificationEmail *string `json:"notification_email,omitempty"` - // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was completed, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date that this resource was completed, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCompleted *time.Time `json:"date_completed,omitempty"` - // The URL of this BulkHostedNumberOrder resource. + // The URL of this BulkHostedNumberOrder resource. Url *string `json:"url,omitempty"` - // The total count of phone numbers in this Bulk hosting request. + // The total count of phone numbers in this Bulk hosting request. TotalCount *int `json:"total_count,omitempty"` - // Contains a list of all the individual hosting orders and their information, for this Bulk request. Each result object is grouped by its order status. To see a complete list of order status, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'. + // Contains a list of all the individual hosting orders and their information, for this Bulk request. Each result object is grouped by its order status. To see a complete list of order status, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'. Results *[]interface{} `json:"results,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_bundle.go b/rest/numbers/v2/model_numbers_v2_bundle.go index 93fd25bdd..d0ec2381c 100644 --- a/rest/numbers/v2/model_numbers_v2_bundle.go +++ b/rest/numbers/v2/model_numbers_v2_bundle.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2Bundle struct for NumbersV2Bundle type NumbersV2Bundle struct { - // The unique string that we created to identify the Bundle resource. + // The unique string that we created to identify the Bundle resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a regulation that is associated to the Bundle resource. + // The unique string of a regulation that is associated to the Bundle resource. RegulationSid *string `json:"regulation_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + Status *string `json:"status,omitempty"` + // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. ValidUntil *time.Time `json:"valid_until,omitempty"` - // The email address that will receive updates when the Bundle resource changes status. + // The email address that will receive updates when the Bundle resource changes status. Email *string `json:"email,omitempty"` - // The URL we call to inform your application of status changes. + // The URL we call to inform your application of status changes. StatusCallback *string `json:"status_callback,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Bundle resource. + // The absolute URL of the Bundle resource. Url *string `json:"url,omitempty"` - // The URLs of the Assigned Items of the Bundle resource. + // The URLs of the Assigned Items of the Bundle resource. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_bundle_copy.go b/rest/numbers/v2/model_numbers_v2_bundle_copy.go index 7775e88b3..a1667c21f 100644 --- a/rest/numbers/v2/model_numbers_v2_bundle_copy.go +++ b/rest/numbers/v2/model_numbers_v2_bundle_copy.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2BundleCopy struct for NumbersV2BundleCopy type NumbersV2BundleCopy struct { - // The unique string that we created to identify the Bundle resource. + // The unique string that we created to identify the Bundle resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a regulation that is associated to the Bundle resource. + // The unique string of a regulation that is associated to the Bundle resource. RegulationSid *string `json:"regulation_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + Status *string `json:"status,omitempty"` + // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. ValidUntil *time.Time `json:"valid_until,omitempty"` - // The email address that will receive updates when the Bundle resource changes status. + // The email address that will receive updates when the Bundle resource changes status. Email *string `json:"email,omitempty"` - // The URL we call to inform your application of status changes. + // The URL we call to inform your application of status changes. StatusCallback *string `json:"status_callback,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_dependent_hosted_number_order.go b/rest/numbers/v2/model_numbers_v2_dependent_hosted_number_order.go index 8adc18673..32d3c0257 100644 --- a/rest/numbers/v2/model_numbers_v2_dependent_hosted_number_order.go +++ b/rest/numbers/v2/model_numbers_v2_dependent_hosted_number_order.go @@ -13,45 +13,47 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2DependentHostedNumberOrder struct for NumbersV2DependentHostedNumberOrder type NumbersV2DependentHostedNumberOrder struct { - // A 34 character string that uniquely identifies this Authorization Document + // A 34 character string that uniquely identifies this Authorization Document Sid *string `json:"sid,omitempty"` - // A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. + // A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. BulkHostingRequestSid *string `json:"bulk_hosting_request_sid,omitempty"` - // The next step you need to take to complete the hosted number order and request it successfully. + // The next step you need to take to complete the hosted number order and request it successfully. NextStep *string `json:"next_step,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. + // A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. IncomingPhoneNumberSid *string `json:"incoming_phone_number_sid,omitempty"` - // A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. + // A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. AddressSid *string `json:"address_sid,omitempty"` - // A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder. + // A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder. SigningDocumentSid *string `json:"signing_document_sid,omitempty"` - // An E164 formatted phone number hosted by this HostedNumberOrder. - PhoneNumber *string `json:"phone_number,omitempty"` + // An E164 formatted phone number hosted by this HostedNumberOrder. + PhoneNumber *string `json:"phone_number,omitempty"` Capabilities *NumbersV2AuthorizationDocumentDependentHostedNumberOrderCapabilities `json:"capabilities,omitempty"` - // A human readable description of this resource, up to 128 characters. + // A human readable description of this resource, up to 128 characters. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // A message that explains why a hosted_number_order went to status \"action-required\" + Status *string `json:"status,omitempty"` + // A message that explains why a hosted_number_order went to status \"action-required\" FailureReason *string `json:"failure_reason,omitempty"` - // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Email of the owner of this phone number that is being hosted. + // Email of the owner of this phone number that is being hosted. Email *string `json:"email,omitempty"` - // Email recipients who will be informed when an Authorization Document has been sent and signed + // Email recipients who will be informed when an Authorization Document has been sent and signed CcEmails *[]string `json:"cc_emails,omitempty"` - // The title of the person authorized to sign the Authorization Document for this phone number. + // The title of the person authorized to sign the Authorization Document for this phone number. ContactTitle *string `json:"contact_title,omitempty"` - // The contact phone number of the person authorized to sign the Authorization Document. + // The contact phone number of the person authorized to sign the Authorization Document. ContactPhoneNumber *string `json:"contact_phone_number,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_end_user.go b/rest/numbers/v2/model_numbers_v2_end_user.go index 8fcc05074..0ca125e05 100644 --- a/rest/numbers/v2/model_numbers_v2_end_user.go +++ b/rest/numbers/v2/model_numbers_v2_end_user.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2EndUser struct for NumbersV2EndUser type NumbersV2EndUser struct { - // The unique string created by Twilio to identify the End User resource. + // The unique string created by Twilio to identify the End User resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Type *string `json:"type,omitempty"` - // The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. + Type *string `json:"type,omitempty"` + // The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. Attributes *interface{} `json:"attributes,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the End User resource. + // The absolute URL of the End User resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_end_user_type.go b/rest/numbers/v2/model_numbers_v2_end_user_type.go index 0afe714ed..1ec1efe4b 100644 --- a/rest/numbers/v2/model_numbers_v2_end_user_type.go +++ b/rest/numbers/v2/model_numbers_v2_end_user_type.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV2EndUserType struct for NumbersV2EndUserType type NumbersV2EndUserType struct { - // The unique string that identifies the End-User Type resource. + // The unique string that identifies the End-User Type resource. Sid *string `json:"sid,omitempty"` - // A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc + // A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc FriendlyName *string `json:"friendly_name,omitempty"` - // A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. + // A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. MachineName *string `json:"machine_name,omitempty"` - // The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. + // The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. Fields *[]interface{} `json:"fields,omitempty"` - // The absolute URL of the End-User Type resource. + // The absolute URL of the End-User Type resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_evaluation.go b/rest/numbers/v2/model_numbers_v2_evaluation.go index a64e26234..135238daa 100644 --- a/rest/numbers/v2/model_numbers_v2_evaluation.go +++ b/rest/numbers/v2/model_numbers_v2_evaluation.go @@ -13,24 +13,26 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2Evaluation struct for NumbersV2Evaluation type NumbersV2Evaluation struct { - // The unique string that identifies the Evaluation resource. + // The unique string that identifies the Evaluation resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a regulation that is associated to the Bundle resource. + // The unique string of a regulation that is associated to the Bundle resource. RegulationSid *string `json:"regulation_sid,omitempty"` - // The unique string that we created to identify the Bundle resource. + // The unique string that we created to identify the Bundle resource. BundleSid *string `json:"bundle_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The results of the Evaluation which includes the valid and invalid attributes. - Results *[]interface{} `json:"results,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - Url *string `json:"url,omitempty"` + Status *string `json:"status,omitempty"` + // The results of the Evaluation which includes the valid and invalid attributes. + Results *[]interface{} `json:"results,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_hosted_number_order.go b/rest/numbers/v2/model_numbers_v2_hosted_number_order.go index ee421226d..14811c81f 100644 --- a/rest/numbers/v2/model_numbers_v2_hosted_number_order.go +++ b/rest/numbers/v2/model_numbers_v2_hosted_number_order.go @@ -13,47 +13,49 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2HostedNumberOrder struct for NumbersV2HostedNumberOrder type NumbersV2HostedNumberOrder struct { - // A 34 character string that uniquely identifies this HostedNumberOrder. + // A 34 character string that uniquely identifies this HostedNumberOrder. Sid *string `json:"sid,omitempty"` - // A 34 character string that uniquely identifies the account. + // A 34 character string that uniquely identifies the account. AccountSid *string `json:"account_sid,omitempty"` - // A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted. + // A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted. IncomingPhoneNumberSid *string `json:"incoming_phone_number_sid,omitempty"` - // A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. + // A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. AddressSid *string `json:"address_sid,omitempty"` - // A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign. + // A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign. SigningDocumentSid *string `json:"signing_document_sid,omitempty"` - // Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212 - PhoneNumber *string `json:"phone_number,omitempty"` + // Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212 + PhoneNumber *string `json:"phone_number,omitempty"` Capabilities *NumbersV2HostedNumberOrderCapabilities `json:"capabilities,omitempty"` - // A 128 character string that is a human-readable text that describes this resource. + // A 128 character string that is a human-readable text that describes this resource. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // A message that explains why a hosted_number_order went to status \"action-required\" + Status *string `json:"status,omitempty"` + // A message that explains why a hosted_number_order went to status \"action-required\" FailureReason *string `json:"failure_reason,omitempty"` - // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + // The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Email of the owner of this phone number that is being hosted. + // Email of the owner of this phone number that is being hosted. Email *string `json:"email,omitempty"` - // A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. + // A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. CcEmails *[]string `json:"cc_emails,omitempty"` - // The URL of this HostedNumberOrder. + // The URL of this HostedNumberOrder. Url *string `json:"url,omitempty"` - // The title of the person authorized to sign the Authorization Document for this phone number. + // The title of the person authorized to sign the Authorization Document for this phone number. ContactTitle *string `json:"contact_title,omitempty"` - // The contact phone number of the person authorized to sign the Authorization Document. + // The contact phone number of the person authorized to sign the Authorization Document. ContactPhoneNumber *string `json:"contact_phone_number,omitempty"` - // A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. + // A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. BulkHostingRequestSid *string `json:"bulk_hosting_request_sid,omitempty"` - // The next step you need to take to complete the hosted number order and request it successfully. + // The next step you need to take to complete the hosted number order and request it successfully. NextStep *string `json:"next_step,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_hosted_number_order_capabilities.go b/rest/numbers/v2/model_numbers_v2_hosted_number_order_capabilities.go index e7aa3a317..92ff072ea 100644 --- a/rest/numbers/v2/model_numbers_v2_hosted_number_order_capabilities.go +++ b/rest/numbers/v2/model_numbers_v2_hosted_number_order_capabilities.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV2HostedNumberOrderCapabilities Set of booleans describing the capabilities hosted on Twilio's platform. SMS is currently only supported. type NumbersV2HostedNumberOrderCapabilities struct { - Mms bool `json:"mms,omitempty"` - Sms bool `json:"sms,omitempty"` + Mms bool `json:"mms,omitempty"` + Sms bool `json:"sms,omitempty"` Voice bool `json:"voice,omitempty"` - Fax bool `json:"fax,omitempty"` + Fax bool `json:"fax,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_item_assignment.go b/rest/numbers/v2/model_numbers_v2_item_assignment.go index 63d4ee0ae..3f854e444 100644 --- a/rest/numbers/v2/model_numbers_v2_item_assignment.go +++ b/rest/numbers/v2/model_numbers_v2_item_assignment.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2ItemAssignment struct for NumbersV2ItemAssignment type NumbersV2ItemAssignment struct { - // The unique string that we created to identify the Item Assignment resource. + // The unique string that we created to identify the Item Assignment resource. Sid *string `json:"sid,omitempty"` - // The unique string that we created to identify the Bundle resource. + // The unique string that we created to identify the Bundle resource. BundleSid *string `json:"bundle_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of an object bag that holds information of the different items. + // The SID of an object bag that holds information of the different items. ObjectSid *string `json:"object_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Identity resource. + // The absolute URL of the Identity resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_regulation.go b/rest/numbers/v2/model_numbers_v2_regulation.go index 9d9b5ca7d..b533c08aa 100644 --- a/rest/numbers/v2/model_numbers_v2_regulation.go +++ b/rest/numbers/v2/model_numbers_v2_regulation.go @@ -13,20 +13,25 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV2Regulation struct for NumbersV2Regulation type NumbersV2Regulation struct { - // The unique string that identifies the Regulation resource. + // The unique string that identifies the Regulation resource. Sid *string `json:"sid,omitempty"` - // A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business. + // A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business. FriendlyName *string `json:"friendly_name,omitempty"` - // The ISO country code of the phone number's country. + // The ISO country code of the phone number's country. IsoCountry *string `json:"iso_country,omitempty"` - // The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung. - NumberType *string `json:"number_type,omitempty"` + // The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung. + NumberType *string `json:"number_type,omitempty"` EndUserType *string `json:"end_user_type,omitempty"` - // The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type. + // The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type. Requirements *interface{} `json:"requirements,omitempty"` - // The absolute URL of the Regulation resource. + // The absolute URL of the Regulation resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_replace_items.go b/rest/numbers/v2/model_numbers_v2_replace_items.go index 30a027200..413bfc73e 100644 --- a/rest/numbers/v2/model_numbers_v2_replace_items.go +++ b/rest/numbers/v2/model_numbers_v2_replace_items.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2ReplaceItems struct for NumbersV2ReplaceItems type NumbersV2ReplaceItems struct { - // The unique string that we created to identify the Bundle resource. + // The unique string that we created to identify the Bundle resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a regulation that is associated to the Bundle resource. + // The unique string of a regulation that is associated to the Bundle resource. RegulationSid *string `json:"regulation_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + Status *string `json:"status,omitempty"` + // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. ValidUntil *time.Time `json:"valid_until,omitempty"` - // The email address that will receive updates when the Bundle resource changes status. + // The email address that will receive updates when the Bundle resource changes status. Email *string `json:"email,omitempty"` - // The URL we call to inform your application of status changes. + // The URL we call to inform your application of status changes. StatusCallback *string `json:"status_callback,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_supporting_document.go b/rest/numbers/v2/model_numbers_v2_supporting_document.go index 018504af7..5d0ac8a1c 100644 --- a/rest/numbers/v2/model_numbers_v2_supporting_document.go +++ b/rest/numbers/v2/model_numbers_v2_supporting_document.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // NumbersV2SupportingDocument struct for NumbersV2SupportingDocument type NumbersV2SupportingDocument struct { - // The unique string created by Twilio to identify the Supporting Document resource. + // The unique string created by Twilio to identify the Supporting Document resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The image type uploaded in the Supporting Document container. + // The image type uploaded in the Supporting Document container. MimeType *string `json:"mime_type,omitempty"` - Status *string `json:"status,omitempty"` - // The failure reason of the Supporting Document Resource. + Status *string `json:"status,omitempty"` + // The failure reason of the Supporting Document Resource. FailureReason *string `json:"failure_reason,omitempty"` - // The type of the Supporting Document. + // The type of the Supporting Document. Type *string `json:"type,omitempty"` - // The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. + // The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. Attributes *interface{} `json:"attributes,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Supporting Document resource. + // The absolute URL of the Supporting Document resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/model_numbers_v2_supporting_document_type.go b/rest/numbers/v2/model_numbers_v2_supporting_document_type.go index 003f9def7..d4dcb16da 100644 --- a/rest/numbers/v2/model_numbers_v2_supporting_document_type.go +++ b/rest/numbers/v2/model_numbers_v2_supporting_document_type.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // NumbersV2SupportingDocumentType struct for NumbersV2SupportingDocumentType type NumbersV2SupportingDocumentType struct { - // The unique string that identifies the Supporting Document Type resource. + // The unique string that identifies the Supporting Document Type resource. Sid *string `json:"sid,omitempty"` - // A human-readable description of the Supporting Document Type resource. + // A human-readable description of the Supporting Document Type resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The machine-readable description of the Supporting Document Type resource. + // The machine-readable description of the Supporting Document Type resource. MachineName *string `json:"machine_name,omitempty"` - // The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. + // The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. Fields *[]interface{} `json:"fields,omitempty"` - // The absolute URL of the Supporting Document Type resource. + // The absolute URL of the Supporting Document Type resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/numbers/v2/regulatory_compliance_bundles.go b/rest/numbers/v2/regulatory_compliance_bundles.go index cd0a3c8d2..ede415dfb 100644 --- a/rest/numbers/v2/regulatory_compliance_bundles.go +++ b/rest/numbers/v2/regulatory_compliance_bundles.go @@ -18,291 +18,278 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBundle' type CreateBundleParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The email address that will receive updates when the Bundle resource changes status. - Email *string `json:"Email,omitempty"` - // The URL we call to inform your application of status changes. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The unique string of a regulation that is associated to the Bundle resource. - RegulationSid *string `json:"RegulationSid,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - IsoCountry *string `json:"IsoCountry,omitempty"` - // - EndUserType *string `json:"EndUserType,omitempty"` - // The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. - NumberType *string `json:"NumberType,omitempty"` -} - -func (params *CreateBundleParams) SetFriendlyName(FriendlyName string) *CreateBundleParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateBundleParams) SetEmail(Email string) *CreateBundleParams { - params.Email = &Email - return params -} -func (params *CreateBundleParams) SetStatusCallback(StatusCallback string) *CreateBundleParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateBundleParams) SetRegulationSid(RegulationSid string) *CreateBundleParams { - params.RegulationSid = &RegulationSid - return params -} -func (params *CreateBundleParams) SetIsoCountry(IsoCountry string) *CreateBundleParams { - params.IsoCountry = &IsoCountry - return params -} -func (params *CreateBundleParams) SetEndUserType(EndUserType string) *CreateBundleParams { - params.EndUserType = &EndUserType - return params -} -func (params *CreateBundleParams) SetNumberType(NumberType string) *CreateBundleParams { - params.NumberType = &NumberType - return params + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The email address that will receive updates when the Bundle resource changes status. + Email *string `json:"Email,omitempty"` + // The URL we call to inform your application of status changes. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The unique string of a regulation that is associated to the Bundle resource. + RegulationSid *string `json:"RegulationSid,omitempty"` + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. + IsoCountry *string `json:"IsoCountry,omitempty"` + // + EndUserType *string `json:"EndUserType,omitempty"` + // The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. + NumberType *string `json:"NumberType,omitempty"` +} + +func (params *CreateBundleParams) SetFriendlyName(FriendlyName string) (*CreateBundleParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateBundleParams) SetEmail(Email string) (*CreateBundleParams){ + params.Email = &Email + return params +} +func (params *CreateBundleParams) SetStatusCallback(StatusCallback string) (*CreateBundleParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateBundleParams) SetRegulationSid(RegulationSid string) (*CreateBundleParams){ + params.RegulationSid = &RegulationSid + return params +} +func (params *CreateBundleParams) SetIsoCountry(IsoCountry string) (*CreateBundleParams){ + params.IsoCountry = &IsoCountry + return params +} +func (params *CreateBundleParams) SetEndUserType(EndUserType string) (*CreateBundleParams){ + params.EndUserType = &EndUserType + return params +} +func (params *CreateBundleParams) SetNumberType(NumberType string) (*CreateBundleParams){ + params.NumberType = &NumberType + return params } // Create a new Bundle. func (c *ApiService) CreateBundle(params *CreateBundleParams) (*NumbersV2Bundle, error) { - path := "/v2/RegulatoryCompliance/Bundles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.RegulationSid != nil { - data.Set("RegulationSid", *params.RegulationSid) - } - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.EndUserType != nil { - data.Set("EndUserType", *params.EndUserType) - } - if params != nil && params.NumberType != nil { - data.Set("NumberType", *params.NumberType) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NumbersV2Bundle{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/RegulatoryCompliance/Bundles" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.RegulationSid != nil { + data.Set("RegulationSid", *params.RegulationSid) + } + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.EndUserType != nil { + data.Set("EndUserType", *params.EndUserType) + } + if params != nil && params.NumberType != nil { + data.Set("NumberType", *params.NumberType) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2Bundle{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Bundle. -func (c *ApiService) DeleteBundle(Sid string) error { - path := "/v2/RegulatoryCompliance/Bundles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteBundle(Sid string, ) (error) { + path := "/v2/RegulatoryCompliance/Bundles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Bundle instance. -func (c *ApiService) FetchBundle(Sid string) (*NumbersV2Bundle, error) { - path := "/v2/RegulatoryCompliance/Bundles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchBundle(Sid string, ) (*NumbersV2Bundle, error) { + path := "/v2/RegulatoryCompliance/Bundles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2Bundle{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2Bundle{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListBundle' type ListBundleParams struct { - // The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details. - Status *string `json:"Status,omitempty"` - // The string that you assigned to describe the resource. The column can contain 255 variable characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. - RegulationSid *string `json:"RegulationSid,omitempty"` - // The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. - IsoCountry *string `json:"IsoCountry,omitempty"` - // The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. - NumberType *string `json:"NumberType,omitempty"` - // Indicates that the Bundle is a valid Bundle until a specified expiration date. - HasValidUntilDate *bool `json:"HasValidUntilDate,omitempty"` - // Can be `valid-until` or `date-updated`. Defaults to `date-created`. - SortBy *string `json:"SortBy,omitempty"` - // Default is `DESC`. Can be `ASC` or `DESC`. - SortDirection *string `json:"SortDirection,omitempty"` - // Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - ValidUntilDate *time.Time `json:"ValidUntilDate,omitempty"` - // Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - ValidUntilDateBefore *time.Time `json:"ValidUntilDate<,omitempty"` - // Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - ValidUntilDateAfter *time.Time `json:"ValidUntilDate>,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListBundleParams) SetStatus(Status string) *ListBundleParams { - params.Status = &Status - return params -} -func (params *ListBundleParams) SetFriendlyName(FriendlyName string) *ListBundleParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListBundleParams) SetRegulationSid(RegulationSid string) *ListBundleParams { - params.RegulationSid = &RegulationSid - return params -} -func (params *ListBundleParams) SetIsoCountry(IsoCountry string) *ListBundleParams { - params.IsoCountry = &IsoCountry - return params -} -func (params *ListBundleParams) SetNumberType(NumberType string) *ListBundleParams { - params.NumberType = &NumberType - return params -} -func (params *ListBundleParams) SetHasValidUntilDate(HasValidUntilDate bool) *ListBundleParams { - params.HasValidUntilDate = &HasValidUntilDate - return params -} -func (params *ListBundleParams) SetSortBy(SortBy string) *ListBundleParams { - params.SortBy = &SortBy - return params -} -func (params *ListBundleParams) SetSortDirection(SortDirection string) *ListBundleParams { - params.SortDirection = &SortDirection - return params -} -func (params *ListBundleParams) SetValidUntilDate(ValidUntilDate time.Time) *ListBundleParams { - params.ValidUntilDate = &ValidUntilDate - return params -} -func (params *ListBundleParams) SetValidUntilDateBefore(ValidUntilDateBefore time.Time) *ListBundleParams { - params.ValidUntilDateBefore = &ValidUntilDateBefore - return params -} -func (params *ListBundleParams) SetValidUntilDateAfter(ValidUntilDateAfter time.Time) *ListBundleParams { - params.ValidUntilDateAfter = &ValidUntilDateAfter - return params -} -func (params *ListBundleParams) SetPageSize(PageSize int) *ListBundleParams { - params.PageSize = &PageSize - return params -} -func (params *ListBundleParams) SetLimit(Limit int) *ListBundleParams { - params.Limit = &Limit - return params + // The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details. + Status *string `json:"Status,omitempty"` + // The string that you assigned to describe the resource. The column can contain 255 variable characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource. + RegulationSid *string `json:"RegulationSid,omitempty"` + // The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. + IsoCountry *string `json:"IsoCountry,omitempty"` + // The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`. + NumberType *string `json:"NumberType,omitempty"` + // Indicates that the Bundle is a valid Bundle until a specified expiration date. + HasValidUntilDate *bool `json:"HasValidUntilDate,omitempty"` + // Can be `valid-until` or `date-updated`. Defaults to `date-created`. + SortBy *string `json:"SortBy,omitempty"` + // Default is `DESC`. Can be `ASC` or `DESC`. + SortDirection *string `json:"SortDirection,omitempty"` + // Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. + ValidUntilDate *time.Time `json:"ValidUntilDate,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListBundleParams) SetStatus(Status string) (*ListBundleParams){ + params.Status = &Status + return params +} +func (params *ListBundleParams) SetFriendlyName(FriendlyName string) (*ListBundleParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListBundleParams) SetRegulationSid(RegulationSid string) (*ListBundleParams){ + params.RegulationSid = &RegulationSid + return params +} +func (params *ListBundleParams) SetIsoCountry(IsoCountry string) (*ListBundleParams){ + params.IsoCountry = &IsoCountry + return params +} +func (params *ListBundleParams) SetNumberType(NumberType string) (*ListBundleParams){ + params.NumberType = &NumberType + return params +} +func (params *ListBundleParams) SetHasValidUntilDate(HasValidUntilDate bool) (*ListBundleParams){ + params.HasValidUntilDate = &HasValidUntilDate + return params +} +func (params *ListBundleParams) SetSortBy(SortBy string) (*ListBundleParams){ + params.SortBy = &SortBy + return params +} +func (params *ListBundleParams) SetSortDirection(SortDirection string) (*ListBundleParams){ + params.SortDirection = &SortDirection + return params +} +func (params *ListBundleParams) SetValidUntilDate(ValidUntilDate time.Time) (*ListBundleParams){ + params.ValidUntilDate = &ValidUntilDate + return params +} +func (params *ListBundleParams) SetPageSize(PageSize int) (*ListBundleParams){ + params.PageSize = &PageSize + return params +} +func (params *ListBundleParams) SetLimit(Limit int) (*ListBundleParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Bundle records from the API. Request is executed immediately. func (c *ApiService) PageBundle(params *ListBundleParams, pageToken, pageNumber string) (*ListBundleResponse, error) { - path := "/v2/RegulatoryCompliance/Bundles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.RegulationSid != nil { - data.Set("RegulationSid", *params.RegulationSid) - } - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.NumberType != nil { - data.Set("NumberType", *params.NumberType) - } - if params != nil && params.HasValidUntilDate != nil { - data.Set("HasValidUntilDate", fmt.Sprint(*params.HasValidUntilDate)) - } - if params != nil && params.SortBy != nil { - data.Set("SortBy", *params.SortBy) - } - if params != nil && params.SortDirection != nil { - data.Set("SortDirection", *params.SortDirection) - } - if params != nil && params.ValidUntilDate != nil { - data.Set("ValidUntilDate", fmt.Sprint((*params.ValidUntilDate).Format(time.RFC3339))) - } - if params != nil && params.ValidUntilDateBefore != nil { - data.Set("ValidUntilDate<", fmt.Sprint((*params.ValidUntilDateBefore).Format(time.RFC3339))) - } - if params != nil && params.ValidUntilDateAfter != nil { - data.Set("ValidUntilDate>", fmt.Sprint((*params.ValidUntilDateAfter).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBundleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/RegulatoryCompliance/Bundles" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.RegulationSid != nil { + data.Set("RegulationSid", *params.RegulationSid) + } + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.NumberType != nil { + data.Set("NumberType", *params.NumberType) + } + if params != nil && params.HasValidUntilDate != nil { + data.Set("HasValidUntilDate", fmt.Sprint(*params.HasValidUntilDate)) + } + if params != nil && params.SortBy != nil { + data.Set("SortBy", *params.SortBy) + } + if params != nil && params.SortDirection != nil { + data.Set("SortDirection", *params.SortDirection) + } + if params != nil && params.ValidUntilDate != nil { + data.Set("ValidUntilDate", fmt.Sprint((*params.ValidUntilDate).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBundleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Bundle records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -343,6 +330,7 @@ func (c *ApiService) StreamBundle(params *ListBundleParams) (chan NumbersV2Bundl return recordChannel, errorChannel } + func (c *ApiService) streamBundle(response *ListBundleResponse, params *ListBundleParams, recordChannel chan NumbersV2Bundle, errorChannel chan error) { curRecord := 1 @@ -374,84 +362,86 @@ func (c *ApiService) streamBundle(response *ListBundleResponse, params *ListBund } func (c *ApiService) getNextListBundleResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBundleResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListBundleResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateBundle' type UpdateBundleParams struct { - // - Status *string `json:"Status,omitempty"` - // The URL we call to inform your application of status changes. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The email address that will receive updates when the Bundle resource changes status. - Email *string `json:"Email,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The URL we call to inform your application of status changes. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The email address that will receive updates when the Bundle resource changes status. + Email *string `json:"Email,omitempty"` } -func (params *UpdateBundleParams) SetStatus(Status string) *UpdateBundleParams { - params.Status = &Status - return params +func (params *UpdateBundleParams) SetStatus(Status string) (*UpdateBundleParams){ + params.Status = &Status + return params } -func (params *UpdateBundleParams) SetStatusCallback(StatusCallback string) *UpdateBundleParams { - params.StatusCallback = &StatusCallback - return params +func (params *UpdateBundleParams) SetStatusCallback(StatusCallback string) (*UpdateBundleParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *UpdateBundleParams) SetFriendlyName(FriendlyName string) *UpdateBundleParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateBundleParams) SetFriendlyName(FriendlyName string) (*UpdateBundleParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateBundleParams) SetEmail(Email string) *UpdateBundleParams { - params.Email = &Email - return params +func (params *UpdateBundleParams) SetEmail(Email string) (*UpdateBundleParams){ + params.Email = &Email + return params } // Updates a Bundle in an account. func (c *ApiService) UpdateBundle(Sid string, params *UpdateBundleParams) (*NumbersV2Bundle, error) { - path := "/v2/RegulatoryCompliance/Bundles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &NumbersV2Bundle{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/RegulatoryCompliance/Bundles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2Bundle{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/numbers/v2/regulatory_compliance_bundles_copies.go b/rest/numbers/v2/regulatory_compliance_bundles_copies.go index b8e6f66e3..cfd811082 100644 --- a/rest/numbers/v2/regulatory_compliance_bundles_copies.go +++ b/rest/numbers/v2/regulatory_compliance_bundles_copies.go @@ -18,99 +18,100 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBundleCopy' type CreateBundleCopyParams struct { - // The string that you assigned to describe the copied bundle. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The string that you assigned to describe the copied bundle. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateBundleCopyParams) SetFriendlyName(FriendlyName string) *CreateBundleCopyParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateBundleCopyParams) SetFriendlyName(FriendlyName string) (*CreateBundleCopyParams){ + params.FriendlyName = &FriendlyName + return params } // Creates a new copy of a Bundle. It will internally create copies of all the bundle items (identities and documents) of the original bundle func (c *ApiService) CreateBundleCopy(BundleSid string, params *CreateBundleCopyParams) (*NumbersV2BundleCopy, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Copies" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Copies" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &NumbersV2BundleCopy{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &NumbersV2BundleCopy{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListBundleCopy' type ListBundleCopyParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBundleCopyParams) SetPageSize(PageSize int) *ListBundleCopyParams { - params.PageSize = &PageSize - return params +func (params *ListBundleCopyParams) SetPageSize(PageSize int) (*ListBundleCopyParams){ + params.PageSize = &PageSize + return params } -func (params *ListBundleCopyParams) SetLimit(Limit int) *ListBundleCopyParams { - params.Limit = &Limit - return params +func (params *ListBundleCopyParams) SetLimit(Limit int) (*ListBundleCopyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of BundleCopy records from the API. Request is executed immediately. func (c *ApiService) PageBundleCopy(BundleSid string, params *ListBundleCopyParams, pageToken, pageNumber string) (*ListBundleCopyResponse, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Copies" + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Copies" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBundleCopyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListBundleCopyResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists BundleCopy records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -151,6 +152,7 @@ func (c *ApiService) StreamBundleCopy(BundleSid string, params *ListBundleCopyPa return recordChannel, errorChannel } + func (c *ApiService) streamBundleCopy(response *ListBundleCopyResponse, params *ListBundleCopyParams, recordChannel chan NumbersV2BundleCopy, errorChannel chan error) { curRecord := 1 @@ -182,19 +184,20 @@ func (c *ApiService) streamBundleCopy(response *ListBundleCopyResponse, params * } func (c *ApiService) getNextListBundleCopyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBundleCopyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBundleCopyResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/regulatory_compliance_bundles_evaluations.go b/rest/numbers/v2/regulatory_compliance_bundles_evaluations.go index b40de2007..8e777041a 100644 --- a/rest/numbers/v2/regulatory_compliance_bundles_evaluations.go +++ b/rest/numbers/v2/regulatory_compliance_bundles_evaluations.go @@ -18,108 +18,112 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Creates an evaluation for a bundle -func (c *ApiService) CreateEvaluation(BundleSid string) (*NumbersV2Evaluation, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Evaluations" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) +func (c *ApiService) CreateEvaluation(BundleSid string, ) (*NumbersV2Evaluation, error) { + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Evaluations" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2Evaluation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &NumbersV2Evaluation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch specific Evaluation Instance. -func (c *ApiService) FetchEvaluation(BundleSid string, Sid string) (*NumbersV2Evaluation, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Evaluations/{Sid}" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEvaluation(BundleSid string, Sid string, ) (*NumbersV2Evaluation, error) { + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Evaluations/{Sid}" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2Evaluation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &NumbersV2Evaluation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEvaluation' type ListEvaluationParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEvaluationParams) SetPageSize(PageSize int) *ListEvaluationParams { - params.PageSize = &PageSize - return params +func (params *ListEvaluationParams) SetPageSize(PageSize int) (*ListEvaluationParams){ + params.PageSize = &PageSize + return params } -func (params *ListEvaluationParams) SetLimit(Limit int) *ListEvaluationParams { - params.Limit = &Limit - return params +func (params *ListEvaluationParams) SetLimit(Limit int) (*ListEvaluationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Evaluation records from the API. Request is executed immediately. func (c *ApiService) PageEvaluation(BundleSid string, params *ListEvaluationParams, pageToken, pageNumber string) (*ListEvaluationResponse, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Evaluations" + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/Evaluations" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEvaluationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEvaluationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Evaluation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -160,6 +164,7 @@ func (c *ApiService) StreamEvaluation(BundleSid string, params *ListEvaluationPa return recordChannel, errorChannel } + func (c *ApiService) streamEvaluation(response *ListEvaluationResponse, params *ListEvaluationParams, recordChannel chan NumbersV2Evaluation, errorChannel chan error) { curRecord := 1 @@ -191,19 +196,20 @@ func (c *ApiService) streamEvaluation(response *ListEvaluationResponse, params * } func (c *ApiService) getNextListEvaluationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEvaluationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEvaluationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/regulatory_compliance_bundles_item_assignments.go b/rest/numbers/v2/regulatory_compliance_bundles_item_assignments.go index bdc63e88c..ce5ee0424 100644 --- a/rest/numbers/v2/regulatory_compliance_bundles_item_assignments.go +++ b/rest/numbers/v2/regulatory_compliance_bundles_item_assignments.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateItemAssignment' type CreateItemAssignmentParams struct { - // The SID of an object bag that holds information of the different items. - ObjectSid *string `json:"ObjectSid,omitempty"` + // The SID of an object bag that holds information of the different items. + ObjectSid *string `json:"ObjectSid,omitempty"` } -func (params *CreateItemAssignmentParams) SetObjectSid(ObjectSid string) *CreateItemAssignmentParams { - params.ObjectSid = &ObjectSid - return params +func (params *CreateItemAssignmentParams) SetObjectSid(ObjectSid string) (*CreateItemAssignmentParams){ + params.ObjectSid = &ObjectSid + return params } // Create a new Assigned Item. func (c *ApiService) CreateItemAssignment(BundleSid string, params *CreateItemAssignmentParams) (*NumbersV2ItemAssignment, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ObjectSid != nil { - data.Set("ObjectSid", *params.ObjectSid) - } + if params != nil && params.ObjectSid != nil { + data.Set("ObjectSid", *params.ObjectSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &NumbersV2ItemAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &NumbersV2ItemAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an Assignment Item Instance. -func (c *ApiService) DeleteItemAssignment(BundleSid string, Sid string) error { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments/{Sid}" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteItemAssignment(BundleSid string, Sid string, ) (error) { + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments/{Sid}" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific Assigned Item Instance. -func (c *ApiService) FetchItemAssignment(BundleSid string, Sid string) (*NumbersV2ItemAssignment, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments/{Sid}" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchItemAssignment(BundleSid string, Sid string, ) (*NumbersV2ItemAssignment, error) { + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments/{Sid}" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2ItemAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2ItemAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListItemAssignment' type ListItemAssignmentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListItemAssignmentParams) SetPageSize(PageSize int) *ListItemAssignmentParams { - params.PageSize = &PageSize - return params +func (params *ListItemAssignmentParams) SetPageSize(PageSize int) (*ListItemAssignmentParams){ + params.PageSize = &PageSize + return params } -func (params *ListItemAssignmentParams) SetLimit(Limit int) *ListItemAssignmentParams { - params.Limit = &Limit - return params +func (params *ListItemAssignmentParams) SetLimit(Limit int) (*ListItemAssignmentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ItemAssignment records from the API. Request is executed immediately. func (c *ApiService) PageItemAssignment(BundleSid string, params *ListItemAssignmentParams, pageToken, pageNumber string) (*ListItemAssignmentResponse, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments" + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ItemAssignments" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListItemAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListItemAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ItemAssignment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamItemAssignment(BundleSid string, params *ListItemAssi return recordChannel, errorChannel } + func (c *ApiService) streamItemAssignment(response *ListItemAssignmentResponse, params *ListItemAssignmentParams, recordChannel chan NumbersV2ItemAssignment, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamItemAssignment(response *ListItemAssignmentResponse, } func (c *ApiService) getNextListItemAssignmentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListItemAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListItemAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/regulatory_compliance_bundles_replace_items.go b/rest/numbers/v2/regulatory_compliance_bundles_replace_items.go index 47fdfeafd..1acf95c91 100644 --- a/rest/numbers/v2/regulatory_compliance_bundles_replace_items.go +++ b/rest/numbers/v2/regulatory_compliance_bundles_replace_items.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateReplaceItems' type CreateReplaceItemsParams struct { - // The source bundle sid to copy the item assignments from. - FromBundleSid *string `json:"FromBundleSid,omitempty"` + // The source bundle sid to copy the item assignments from. + FromBundleSid *string `json:"FromBundleSid,omitempty"` } -func (params *CreateReplaceItemsParams) SetFromBundleSid(FromBundleSid string) *CreateReplaceItemsParams { - params.FromBundleSid = &FromBundleSid - return params +func (params *CreateReplaceItemsParams) SetFromBundleSid(FromBundleSid string) (*CreateReplaceItemsParams){ + params.FromBundleSid = &FromBundleSid + return params } // Replaces all bundle items in the target bundle (specified in the path) with all the bundle items of the source bundle (specified by the from_bundle_sid body param) func (c *ApiService) CreateReplaceItems(BundleSid string, params *CreateReplaceItemsParams) (*NumbersV2ReplaceItems, error) { - path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ReplaceItems" - path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + path := "/v2/RegulatoryCompliance/Bundles/{BundleSid}/ReplaceItems" + path = strings.Replace(path, "{"+"BundleSid"+"}", BundleSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FromBundleSid != nil { + data.Set("FromBundleSid", *params.FromBundleSid) + } - if params != nil && params.FromBundleSid != nil { - data.Set("FromBundleSid", *params.FromBundleSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV2ReplaceItems{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV2ReplaceItems{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v2/regulatory_compliance_end_user_types.go b/rest/numbers/v2/regulatory_compliance_end_user_types.go index 586950315..0d8392984 100644 --- a/rest/numbers/v2/regulatory_compliance_end_user_types.go +++ b/rest/numbers/v2/regulatory_compliance_end_user_types.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific End-User Type Instance. -func (c *ApiService) FetchEndUserType(Sid string) (*NumbersV2EndUserType, error) { - path := "/v2/RegulatoryCompliance/EndUserTypes/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEndUserType(Sid string, ) (*NumbersV2EndUserType, error) { + path := "/v2/RegulatoryCompliance/EndUserTypes/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2EndUserType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &NumbersV2EndUserType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEndUserType' type ListEndUserTypeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEndUserTypeParams) SetPageSize(PageSize int) *ListEndUserTypeParams { - params.PageSize = &PageSize - return params +func (params *ListEndUserTypeParams) SetPageSize(PageSize int) (*ListEndUserTypeParams){ + params.PageSize = &PageSize + return params } -func (params *ListEndUserTypeParams) SetLimit(Limit int) *ListEndUserTypeParams { - params.Limit = &Limit - return params +func (params *ListEndUserTypeParams) SetLimit(Limit int) (*ListEndUserTypeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of EndUserType records from the API. Request is executed immediately. func (c *ApiService) PageEndUserType(params *ListEndUserTypeParams, pageToken, pageNumber string) (*ListEndUserTypeResponse, error) { - path := "/v2/RegulatoryCompliance/EndUserTypes" + path := "/v2/RegulatoryCompliance/EndUserTypes" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEndUserTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEndUserTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists EndUserType records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamEndUserType(params *ListEndUserTypeParams) (chan Numb return recordChannel, errorChannel } + func (c *ApiService) streamEndUserType(response *ListEndUserTypeResponse, params *ListEndUserTypeParams, recordChannel chan NumbersV2EndUserType, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamEndUserType(response *ListEndUserTypeResponse, params } func (c *ApiService) getNextListEndUserTypeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEndUserTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEndUserTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/regulatory_compliance_end_users.go b/rest/numbers/v2/regulatory_compliance_end_users.go index 334497be3..fcdf201f6 100644 --- a/rest/numbers/v2/regulatory_compliance_end_users.go +++ b/rest/numbers/v2/regulatory_compliance_end_users.go @@ -18,161 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateEndUser' type CreateEndUserParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Type *string `json:"Type,omitempty"` - // The set of parameters that are the attributes of the End User resource which are derived End User Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Type *string `json:"Type,omitempty"` + // The set of parameters that are the attributes of the End User resource which are derived End User Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *CreateEndUserParams) SetFriendlyName(FriendlyName string) *CreateEndUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateEndUserParams) SetFriendlyName(FriendlyName string) (*CreateEndUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateEndUserParams) SetType(Type string) *CreateEndUserParams { - params.Type = &Type - return params +func (params *CreateEndUserParams) SetType(Type string) (*CreateEndUserParams){ + params.Type = &Type + return params } -func (params *CreateEndUserParams) SetAttributes(Attributes interface{}) *CreateEndUserParams { - params.Attributes = &Attributes - return params +func (params *CreateEndUserParams) SetAttributes(Attributes interface{}) (*CreateEndUserParams){ + params.Attributes = &Attributes + return params } // Create a new End User. func (c *ApiService) CreateEndUser(params *CreateEndUserParams) (*NumbersV2EndUser, error) { - path := "/v2/RegulatoryCompliance/EndUsers" + path := "/v2/RegulatoryCompliance/EndUsers" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Attributes", string(v)) + } - data.Set("Attributes", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV2EndUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV2EndUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific End User. -func (c *ApiService) DeleteEndUser(Sid string) error { - path := "/v2/RegulatoryCompliance/EndUsers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteEndUser(Sid string, ) (error) { + path := "/v2/RegulatoryCompliance/EndUsers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific End User Instance. -func (c *ApiService) FetchEndUser(Sid string) (*NumbersV2EndUser, error) { - path := "/v2/RegulatoryCompliance/EndUsers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEndUser(Sid string, ) (*NumbersV2EndUser, error) { + path := "/v2/RegulatoryCompliance/EndUsers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2EndUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2EndUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListEndUser' type ListEndUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEndUserParams) SetPageSize(PageSize int) *ListEndUserParams { - params.PageSize = &PageSize - return params +func (params *ListEndUserParams) SetPageSize(PageSize int) (*ListEndUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListEndUserParams) SetLimit(Limit int) *ListEndUserParams { - params.Limit = &Limit - return params +func (params *ListEndUserParams) SetLimit(Limit int) (*ListEndUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of EndUser records from the API. Request is executed immediately. func (c *ApiService) PageEndUser(params *ListEndUserParams, pageToken, pageNumber string) (*ListEndUserResponse, error) { - path := "/v2/RegulatoryCompliance/EndUsers" + path := "/v2/RegulatoryCompliance/EndUsers" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEndUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEndUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists EndUser records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -213,6 +219,7 @@ func (c *ApiService) StreamEndUser(params *ListEndUserParams) (chan NumbersV2End return recordChannel, errorChannel } + func (c *ApiService) streamEndUser(response *ListEndUserResponse, params *ListEndUserParams, recordChannel chan NumbersV2EndUser, errorChannel chan error) { curRecord := 1 @@ -244,72 +251,74 @@ func (c *ApiService) streamEndUser(response *ListEndUserResponse, params *ListEn } func (c *ApiService) getNextListEndUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEndUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEndUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateEndUser' type UpdateEndUserParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The set of parameters that are the attributes of the End User resource which are derived End User Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The set of parameters that are the attributes of the End User resource which are derived End User Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *UpdateEndUserParams) SetFriendlyName(FriendlyName string) *UpdateEndUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateEndUserParams) SetFriendlyName(FriendlyName string) (*UpdateEndUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateEndUserParams) SetAttributes(Attributes interface{}) *UpdateEndUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateEndUserParams) SetAttributes(Attributes interface{}) (*UpdateEndUserParams){ + params.Attributes = &Attributes + return params } // Update an existing End User. func (c *ApiService) UpdateEndUser(Sid string, params *UpdateEndUserParams) (*NumbersV2EndUser, error) { - path := "/v2/RegulatoryCompliance/EndUsers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/RegulatoryCompliance/EndUsers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Attributes", string(v)) - } + data.Set("Attributes", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &NumbersV2EndUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &NumbersV2EndUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/numbers/v2/regulatory_compliance_regulations.go b/rest/numbers/v2/regulatory_compliance_regulations.go index f4d28ab92..b6d9f23c7 100644 --- a/rest/numbers/v2/regulatory_compliance_regulations.go +++ b/rest/numbers/v2/regulatory_compliance_regulations.go @@ -18,109 +18,112 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch specific Regulation Instance. -func (c *ApiService) FetchRegulation(Sid string) (*NumbersV2Regulation, error) { - path := "/v2/RegulatoryCompliance/Regulations/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchRegulation(Sid string, ) (*NumbersV2Regulation, error) { + path := "/v2/RegulatoryCompliance/Regulations/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2Regulation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &NumbersV2Regulation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRegulation' type ListRegulationParams struct { - // The type of End User the regulation requires - can be `individual` or `business`. - EndUserType *string `json:"EndUserType,omitempty"` - // The ISO country code of the phone number's country. - IsoCountry *string `json:"IsoCountry,omitempty"` - // The type of phone number that the regulatory requiremnt is restricting. - NumberType *string `json:"NumberType,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The type of End User the regulation requires - can be `individual` or `business`. + EndUserType *string `json:"EndUserType,omitempty"` + // The ISO country code of the phone number's country. + IsoCountry *string `json:"IsoCountry,omitempty"` + // The type of phone number that the regulatory requiremnt is restricting. + NumberType *string `json:"NumberType,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRegulationParams) SetEndUserType(EndUserType string) *ListRegulationParams { - params.EndUserType = &EndUserType - return params +func (params *ListRegulationParams) SetEndUserType(EndUserType string) (*ListRegulationParams){ + params.EndUserType = &EndUserType + return params } -func (params *ListRegulationParams) SetIsoCountry(IsoCountry string) *ListRegulationParams { - params.IsoCountry = &IsoCountry - return params +func (params *ListRegulationParams) SetIsoCountry(IsoCountry string) (*ListRegulationParams){ + params.IsoCountry = &IsoCountry + return params } -func (params *ListRegulationParams) SetNumberType(NumberType string) *ListRegulationParams { - params.NumberType = &NumberType - return params +func (params *ListRegulationParams) SetNumberType(NumberType string) (*ListRegulationParams){ + params.NumberType = &NumberType + return params } -func (params *ListRegulationParams) SetPageSize(PageSize int) *ListRegulationParams { - params.PageSize = &PageSize - return params +func (params *ListRegulationParams) SetPageSize(PageSize int) (*ListRegulationParams){ + params.PageSize = &PageSize + return params } -func (params *ListRegulationParams) SetLimit(Limit int) *ListRegulationParams { - params.Limit = &Limit - return params +func (params *ListRegulationParams) SetLimit(Limit int) (*ListRegulationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Regulation records from the API. Request is executed immediately. func (c *ApiService) PageRegulation(params *ListRegulationParams, pageToken, pageNumber string) (*ListRegulationResponse, error) { - path := "/v2/RegulatoryCompliance/Regulations" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.EndUserType != nil { - data.Set("EndUserType", *params.EndUserType) - } - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.NumberType != nil { - data.Set("NumberType", *params.NumberType) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRegulationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/RegulatoryCompliance/Regulations" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.EndUserType != nil { + data.Set("EndUserType", *params.EndUserType) + } + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.NumberType != nil { + data.Set("NumberType", *params.NumberType) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRegulationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Regulation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -161,6 +164,7 @@ func (c *ApiService) StreamRegulation(params *ListRegulationParams) (chan Number return recordChannel, errorChannel } + func (c *ApiService) streamRegulation(response *ListRegulationResponse, params *ListRegulationParams, recordChannel chan NumbersV2Regulation, errorChannel chan error) { curRecord := 1 @@ -192,19 +196,20 @@ func (c *ApiService) streamRegulation(response *ListRegulationResponse, params * } func (c *ApiService) getNextListRegulationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRegulationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRegulationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/regulatory_compliance_supporting_document_types.go b/rest/numbers/v2/regulatory_compliance_supporting_document_types.go index 8891d7476..c60782762 100644 --- a/rest/numbers/v2/regulatory_compliance_supporting_document_types.go +++ b/rest/numbers/v2/regulatory_compliance_supporting_document_types.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Supporting Document Type Instance. -func (c *ApiService) FetchSupportingDocumentType(Sid string) (*NumbersV2SupportingDocumentType, error) { - path := "/v2/RegulatoryCompliance/SupportingDocumentTypes/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSupportingDocumentType(Sid string, ) (*NumbersV2SupportingDocumentType, error) { + path := "/v2/RegulatoryCompliance/SupportingDocumentTypes/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2SupportingDocumentType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &NumbersV2SupportingDocumentType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSupportingDocumentType' type ListSupportingDocumentTypeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSupportingDocumentTypeParams) SetPageSize(PageSize int) *ListSupportingDocumentTypeParams { - params.PageSize = &PageSize - return params +func (params *ListSupportingDocumentTypeParams) SetPageSize(PageSize int) (*ListSupportingDocumentTypeParams){ + params.PageSize = &PageSize + return params } -func (params *ListSupportingDocumentTypeParams) SetLimit(Limit int) *ListSupportingDocumentTypeParams { - params.Limit = &Limit - return params +func (params *ListSupportingDocumentTypeParams) SetLimit(Limit int) (*ListSupportingDocumentTypeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SupportingDocumentType records from the API. Request is executed immediately. func (c *ApiService) PageSupportingDocumentType(params *ListSupportingDocumentTypeParams, pageToken, pageNumber string) (*ListSupportingDocumentTypeResponse, error) { - path := "/v2/RegulatoryCompliance/SupportingDocumentTypes" + path := "/v2/RegulatoryCompliance/SupportingDocumentTypes" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSupportingDocumentTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSupportingDocumentTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SupportingDocumentType records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamSupportingDocumentType(params *ListSupportingDocument return recordChannel, errorChannel } + func (c *ApiService) streamSupportingDocumentType(response *ListSupportingDocumentTypeResponse, params *ListSupportingDocumentTypeParams, recordChannel chan NumbersV2SupportingDocumentType, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamSupportingDocumentType(response *ListSupportingDocume } func (c *ApiService) getNextListSupportingDocumentTypeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSupportingDocumentTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSupportingDocumentTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/numbers/v2/regulatory_compliance_supporting_documents.go b/rest/numbers/v2/regulatory_compliance_supporting_documents.go index 596fc9232..fc16515b1 100644 --- a/rest/numbers/v2/regulatory_compliance_supporting_documents.go +++ b/rest/numbers/v2/regulatory_compliance_supporting_documents.go @@ -18,161 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSupportingDocument' type CreateSupportingDocumentParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The type of the Supporting Document. - Type *string `json:"Type,omitempty"` - // The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The type of the Supporting Document. + Type *string `json:"Type,omitempty"` + // The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *CreateSupportingDocumentParams) SetFriendlyName(FriendlyName string) *CreateSupportingDocumentParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateSupportingDocumentParams) SetFriendlyName(FriendlyName string) (*CreateSupportingDocumentParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateSupportingDocumentParams) SetType(Type string) *CreateSupportingDocumentParams { - params.Type = &Type - return params +func (params *CreateSupportingDocumentParams) SetType(Type string) (*CreateSupportingDocumentParams){ + params.Type = &Type + return params } -func (params *CreateSupportingDocumentParams) SetAttributes(Attributes interface{}) *CreateSupportingDocumentParams { - params.Attributes = &Attributes - return params +func (params *CreateSupportingDocumentParams) SetAttributes(Attributes interface{}) (*CreateSupportingDocumentParams){ + params.Attributes = &Attributes + return params } // Create a new Supporting Document. func (c *ApiService) CreateSupportingDocument(params *CreateSupportingDocumentParams) (*NumbersV2SupportingDocument, error) { - path := "/v2/RegulatoryCompliance/SupportingDocuments" + path := "/v2/RegulatoryCompliance/SupportingDocuments" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Attributes", string(v)) + } - data.Set("Attributes", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &NumbersV2SupportingDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &NumbersV2SupportingDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Supporting Document. -func (c *ApiService) DeleteSupportingDocument(Sid string) error { - path := "/v2/RegulatoryCompliance/SupportingDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSupportingDocument(Sid string, ) (error) { + path := "/v2/RegulatoryCompliance/SupportingDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific Supporting Document Instance. -func (c *ApiService) FetchSupportingDocument(Sid string) (*NumbersV2SupportingDocument, error) { - path := "/v2/RegulatoryCompliance/SupportingDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSupportingDocument(Sid string, ) (*NumbersV2SupportingDocument, error) { + path := "/v2/RegulatoryCompliance/SupportingDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &NumbersV2SupportingDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &NumbersV2SupportingDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSupportingDocument' type ListSupportingDocumentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSupportingDocumentParams) SetPageSize(PageSize int) *ListSupportingDocumentParams { - params.PageSize = &PageSize - return params +func (params *ListSupportingDocumentParams) SetPageSize(PageSize int) (*ListSupportingDocumentParams){ + params.PageSize = &PageSize + return params } -func (params *ListSupportingDocumentParams) SetLimit(Limit int) *ListSupportingDocumentParams { - params.Limit = &Limit - return params +func (params *ListSupportingDocumentParams) SetLimit(Limit int) (*ListSupportingDocumentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SupportingDocument records from the API. Request is executed immediately. func (c *ApiService) PageSupportingDocument(params *ListSupportingDocumentParams, pageToken, pageNumber string) (*ListSupportingDocumentResponse, error) { - path := "/v2/RegulatoryCompliance/SupportingDocuments" + path := "/v2/RegulatoryCompliance/SupportingDocuments" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSupportingDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSupportingDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SupportingDocument records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -213,6 +219,7 @@ func (c *ApiService) StreamSupportingDocument(params *ListSupportingDocumentPara return recordChannel, errorChannel } + func (c *ApiService) streamSupportingDocument(response *ListSupportingDocumentResponse, params *ListSupportingDocumentParams, recordChannel chan NumbersV2SupportingDocument, errorChannel chan error) { curRecord := 1 @@ -244,72 +251,74 @@ func (c *ApiService) streamSupportingDocument(response *ListSupportingDocumentRe } func (c *ApiService) getNextListSupportingDocumentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSupportingDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSupportingDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSupportingDocument' type UpdateSupportingDocumentParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *UpdateSupportingDocumentParams) SetFriendlyName(FriendlyName string) *UpdateSupportingDocumentParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSupportingDocumentParams) SetFriendlyName(FriendlyName string) (*UpdateSupportingDocumentParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateSupportingDocumentParams) SetAttributes(Attributes interface{}) *UpdateSupportingDocumentParams { - params.Attributes = &Attributes - return params +func (params *UpdateSupportingDocumentParams) SetAttributes(Attributes interface{}) (*UpdateSupportingDocumentParams){ + params.Attributes = &Attributes + return params } // Update an existing Supporting Document. func (c *ApiService) UpdateSupportingDocument(Sid string, params *UpdateSupportingDocumentParams) (*NumbersV2SupportingDocument, error) { - path := "/v2/RegulatoryCompliance/SupportingDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/RegulatoryCompliance/SupportingDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Attributes", string(v)) - } + data.Set("Attributes", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &NumbersV2SupportingDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &NumbersV2SupportingDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/oauth/v1/README.md b/rest/oauth/v1/README.md index d48aae185..ab6f65476 100644 --- a/rest/oauth/v1/README.md +++ b/rest/oauth/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/oauth/v1/api_service.go b/rest/oauth/v1/api_service.go index d301cbc4d..895566dac 100644 --- a/rest/oauth/v1/api_service.go +++ b/rest/oauth/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://oauth.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/oauth/v1/certs.go b/rest/oauth/v1/certs.go index 994aad87d..04635dc4a 100644 --- a/rest/oauth/v1/certs.go +++ b/rest/oauth/v1/certs.go @@ -16,27 +16,33 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Fetches public JWKs func (c *ApiService) FetchCerts() (*OauthV1Certs, error) { - path := "/v1/certs" + path := "/v1/certs" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &OauthV1Certs{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &OauthV1Certs{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/oauth/v1/device_code.go b/rest/oauth/v1/device_code.go index d062a6d1b..bd24fb359 100644 --- a/rest/oauth/v1/device_code.go +++ b/rest/oauth/v1/device_code.go @@ -16,64 +16,69 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateDeviceCode' type CreateDeviceCodeParams struct { - // A 34 character string that uniquely identifies this OAuth App. - ClientSid *string `json:"ClientSid,omitempty"` - // An Array of scopes for authorization request - Scopes *[]string `json:"Scopes,omitempty"` - // An array of intended audiences for token requests - Audiences *[]string `json:"Audiences,omitempty"` + // A 34 character string that uniquely identifies this OAuth App. + ClientSid *string `json:"ClientSid,omitempty"` + // An Array of scopes for authorization request + Scopes *[]string `json:"Scopes,omitempty"` + // An array of intended audiences for token requests + Audiences *[]string `json:"Audiences,omitempty"` } -func (params *CreateDeviceCodeParams) SetClientSid(ClientSid string) *CreateDeviceCodeParams { - params.ClientSid = &ClientSid - return params +func (params *CreateDeviceCodeParams) SetClientSid(ClientSid string) (*CreateDeviceCodeParams){ + params.ClientSid = &ClientSid + return params } -func (params *CreateDeviceCodeParams) SetScopes(Scopes []string) *CreateDeviceCodeParams { - params.Scopes = &Scopes - return params +func (params *CreateDeviceCodeParams) SetScopes(Scopes []string) (*CreateDeviceCodeParams){ + params.Scopes = &Scopes + return params } -func (params *CreateDeviceCodeParams) SetAudiences(Audiences []string) *CreateDeviceCodeParams { - params.Audiences = &Audiences - return params +func (params *CreateDeviceCodeParams) SetAudiences(Audiences []string) (*CreateDeviceCodeParams){ + params.Audiences = &Audiences + return params } // Issues a new Access token (optionally identity_token & refresh_token) in exchange of Oauth grant func (c *ApiService) CreateDeviceCode(params *CreateDeviceCodeParams) (*OauthV1DeviceCode, error) { - path := "/v1/device/code" + path := "/v1/device/code" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.ClientSid != nil { + data.Set("ClientSid", *params.ClientSid) + } + if params != nil && params.Scopes != nil { + for _, item := range *params.Scopes { + data.Add("Scopes", item) + } + } + if params != nil && params.Audiences != nil { + for _, item := range *params.Audiences { + data.Add("Audiences", item) + } + } - if params != nil && params.ClientSid != nil { - data.Set("ClientSid", *params.ClientSid) - } - if params != nil && params.Scopes != nil { - for _, item := range *params.Scopes { - data.Add("Scopes", item) - } - } - if params != nil && params.Audiences != nil { - for _, item := range *params.Audiences { - data.Add("Audiences", item) - } - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &OauthV1DeviceCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &OauthV1DeviceCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/oauth/v1/model_oauth_v1_certs.go b/rest/oauth/v1/model_oauth_v1_certs.go index 7aff5bdff..bc68bb9dc 100644 --- a/rest/oauth/v1/model_oauth_v1_certs.go +++ b/rest/oauth/v1/model_oauth_v1_certs.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // OauthV1Certs struct for OauthV1Certs type OauthV1Certs struct { - // A collection of certificates where are signed Twilio-issued tokens. + // A collection of certificates where are signed Twilio-issued tokens. Keys *interface{} `json:"keys,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/oauth/v1/model_oauth_v1_device_code.go b/rest/oauth/v1/model_oauth_v1_device_code.go index 9de591ee0..78ad379a8 100644 --- a/rest/oauth/v1/model_oauth_v1_device_code.go +++ b/rest/oauth/v1/model_oauth_v1_device_code.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // OauthV1DeviceCode struct for OauthV1DeviceCode type OauthV1DeviceCode struct { - // The device verification code. + // The device verification code. DeviceCode *string `json:"device_code,omitempty"` - // The verification code which end user uses to verify authorization request. + // The verification code which end user uses to verify authorization request. UserCode *string `json:"user_code,omitempty"` - // The URI that the end user visits to verify authorization request. + // The URI that the end user visits to verify authorization request. VerificationUri *string `json:"verification_uri,omitempty"` - // The URI with user_code that the end-user alternatively visits to verify authorization request. + // The URI with user_code that the end-user alternatively visits to verify authorization request. VerificationUriComplete *string `json:"verification_uri_complete,omitempty"` - // The expiration time of the device_code and user_code in seconds. + // The expiration time of the device_code and user_code in seconds. ExpiresIn *int64 `json:"expires_in,omitempty"` - // The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. + // The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. Interval *int `json:"interval,omitempty"` } + + diff --git a/rest/oauth/v1/model_oauth_v1_openid_discovery.go b/rest/oauth/v1/model_oauth_v1_openid_discovery.go index 056a6f8ee..63c893230 100644 --- a/rest/oauth/v1/model_oauth_v1_openid_discovery.go +++ b/rest/oauth/v1/model_oauth_v1_openid_discovery.go @@ -13,32 +13,37 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // OauthV1OpenidDiscovery struct for OauthV1OpenidDiscovery type OauthV1OpenidDiscovery struct { - // The URL of the party that will create the token and sign it with its private key. + // The URL of the party that will create the token and sign it with its private key. Issuer *string `json:"issuer,omitempty"` - // The endpoint that validates all authorization requests. + // The endpoint that validates all authorization requests. AuthorizationEndpoint *string `json:"authorization_endpoint,omitempty"` - // The endpoint that validates all device code related authorization requests. + // The endpoint that validates all device code related authorization requests. DeviceAuthorizationEndpoint *string `json:"device_authorization_endpoint,omitempty"` - // The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. + // The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. TokenEndpoint *string `json:"token_endpoint,omitempty"` - // The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. + // The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. UserinfoEndpoint *string `json:"userinfo_endpoint,omitempty"` - // The endpoint used to revoke access or refresh tokens issued by the authorization server. + // The endpoint used to revoke access or refresh tokens issued by the authorization server. RevocationEndpoint *string `json:"revocation_endpoint,omitempty"` - // The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. + // The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. JwkUri *string `json:"jwk_uri,omitempty"` - // A collection of response type supported by authorization server. + // A collection of response type supported by authorization server. ResponseTypeSupported *[]string `json:"response_type_supported,omitempty"` - // A collection of subject by authorization server. + // A collection of subject by authorization server. SubjectTypeSupported *[]string `json:"subject_type_supported,omitempty"` - // A collection of JWS signing algorithms supported by authorization server to sign identity token. + // A collection of JWS signing algorithms supported by authorization server to sign identity token. IdTokenSigningAlgValuesSupported *[]string `json:"id_token_signing_alg_values_supported,omitempty"` - // A collection of scopes supported by authorization server for identity token + // A collection of scopes supported by authorization server for identity token ScopesSupported *[]string `json:"scopes_supported,omitempty"` - // A collection of claims supported by authorization server for identity token + // A collection of claims supported by authorization server for identity token ClaimsSupported *[]string `json:"claims_supported,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/oauth/v1/model_oauth_v1_token.go b/rest/oauth/v1/model_oauth_v1_token.go index 66769b073..545e97ec7 100644 --- a/rest/oauth/v1/model_oauth_v1_token.go +++ b/rest/oauth/v1/model_oauth_v1_token.go @@ -13,20 +13,22 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // OauthV1Token struct for OauthV1Token type OauthV1Token struct { - // Token which carries the necessary information to access a Twilio resource directly. + // Token which carries the necessary information to access a Twilio resource directly. AccessToken *string `json:"access_token,omitempty"` - // Token which carries the information necessary to get a new access token. + // Token which carries the information necessary to get a new access token. RefreshToken *string `json:"refresh_token,omitempty"` - IdToken *string `json:"id_token,omitempty"` - // The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + IdToken *string `json:"id_token,omitempty"` + // The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. RefreshTokenExpiresAt *time.Time `json:"refresh_token_expires_at,omitempty"` - // The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. AccessTokenExpiresAt *time.Time `json:"access_token_expires_at,omitempty"` } + + diff --git a/rest/oauth/v1/model_oauth_v1_user_info.go b/rest/oauth/v1/model_oauth_v1_user_info.go index b476b05f6..e8b740ba3 100644 --- a/rest/oauth/v1/model_oauth_v1_user_info.go +++ b/rest/oauth/v1/model_oauth_v1_user_info.go @@ -13,18 +13,23 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // OauthV1UserInfo struct for OauthV1UserInfo type OauthV1UserInfo struct { - // The URL of the party that will create the token and sign it with its private key. + // The URL of the party that will create the token and sign it with its private key. UserSid *string `json:"user_sid,omitempty"` - // The first name of the end-user. + // The first name of the end-user. FirstName *string `json:"first_name,omitempty"` - // The last name of the end-user. + // The last name of the end-user. LastName *string `json:"last_name,omitempty"` - // The friendly name of the end-user. + // The friendly name of the end-user. FriendlyName *string `json:"friendly_name,omitempty"` - // The end-user's preferred email address. + // The end-user's preferred email address. Email *string `json:"email,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/oauth/v1/token.go b/rest/oauth/v1/token.go index 82ed4a101..2542aa367 100644 --- a/rest/oauth/v1/token.go +++ b/rest/oauth/v1/token.go @@ -16,105 +16,110 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateToken' type CreateTokenParams struct { - // Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. - GrantType *string `json:"GrantType,omitempty"` - // A 34 character string that uniquely identifies this OAuth App. - ClientSid *string `json:"ClientSid,omitempty"` - // The credential for confidential OAuth App. - ClientSecret *string `json:"ClientSecret,omitempty"` - // JWT token related to the authorization code grant type. - Code *string `json:"Code,omitempty"` - // A code which is generation cryptographically. - CodeVerifier *string `json:"CodeVerifier,omitempty"` - // JWT token related to the device code grant type. - DeviceCode *string `json:"DeviceCode,omitempty"` - // JWT token related to the refresh token grant type. - RefreshToken *string `json:"RefreshToken,omitempty"` - // The Id of the device associated with the token (refresh token). - DeviceId *string `json:"DeviceId,omitempty"` + // Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token. + GrantType *string `json:"GrantType,omitempty"` + // A 34 character string that uniquely identifies this OAuth App. + ClientSid *string `json:"ClientSid,omitempty"` + // The credential for confidential OAuth App. + ClientSecret *string `json:"ClientSecret,omitempty"` + // JWT token related to the authorization code grant type. + Code *string `json:"Code,omitempty"` + // A code which is generation cryptographically. + CodeVerifier *string `json:"CodeVerifier,omitempty"` + // JWT token related to the device code grant type. + DeviceCode *string `json:"DeviceCode,omitempty"` + // JWT token related to the refresh token grant type. + RefreshToken *string `json:"RefreshToken,omitempty"` + // The Id of the device associated with the token (refresh token). + DeviceId *string `json:"DeviceId,omitempty"` } -func (params *CreateTokenParams) SetGrantType(GrantType string) *CreateTokenParams { - params.GrantType = &GrantType - return params +func (params *CreateTokenParams) SetGrantType(GrantType string) (*CreateTokenParams){ + params.GrantType = &GrantType + return params } -func (params *CreateTokenParams) SetClientSid(ClientSid string) *CreateTokenParams { - params.ClientSid = &ClientSid - return params +func (params *CreateTokenParams) SetClientSid(ClientSid string) (*CreateTokenParams){ + params.ClientSid = &ClientSid + return params } -func (params *CreateTokenParams) SetClientSecret(ClientSecret string) *CreateTokenParams { - params.ClientSecret = &ClientSecret - return params +func (params *CreateTokenParams) SetClientSecret(ClientSecret string) (*CreateTokenParams){ + params.ClientSecret = &ClientSecret + return params } -func (params *CreateTokenParams) SetCode(Code string) *CreateTokenParams { - params.Code = &Code - return params +func (params *CreateTokenParams) SetCode(Code string) (*CreateTokenParams){ + params.Code = &Code + return params } -func (params *CreateTokenParams) SetCodeVerifier(CodeVerifier string) *CreateTokenParams { - params.CodeVerifier = &CodeVerifier - return params +func (params *CreateTokenParams) SetCodeVerifier(CodeVerifier string) (*CreateTokenParams){ + params.CodeVerifier = &CodeVerifier + return params } -func (params *CreateTokenParams) SetDeviceCode(DeviceCode string) *CreateTokenParams { - params.DeviceCode = &DeviceCode - return params +func (params *CreateTokenParams) SetDeviceCode(DeviceCode string) (*CreateTokenParams){ + params.DeviceCode = &DeviceCode + return params } -func (params *CreateTokenParams) SetRefreshToken(RefreshToken string) *CreateTokenParams { - params.RefreshToken = &RefreshToken - return params +func (params *CreateTokenParams) SetRefreshToken(RefreshToken string) (*CreateTokenParams){ + params.RefreshToken = &RefreshToken + return params } -func (params *CreateTokenParams) SetDeviceId(DeviceId string) *CreateTokenParams { - params.DeviceId = &DeviceId - return params +func (params *CreateTokenParams) SetDeviceId(DeviceId string) (*CreateTokenParams){ + params.DeviceId = &DeviceId + return params } // Issues a new Access token (optionally identity_token & refresh_token) in exchange of Oauth grant func (c *ApiService) CreateToken(params *CreateTokenParams) (*OauthV1Token, error) { - path := "/v1/token" + path := "/v1/token" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.GrantType != nil { + data.Set("GrantType", *params.GrantType) + } + if params != nil && params.ClientSid != nil { + data.Set("ClientSid", *params.ClientSid) + } + if params != nil && params.ClientSecret != nil { + data.Set("ClientSecret", *params.ClientSecret) + } + if params != nil && params.Code != nil { + data.Set("Code", *params.Code) + } + if params != nil && params.CodeVerifier != nil { + data.Set("CodeVerifier", *params.CodeVerifier) + } + if params != nil && params.DeviceCode != nil { + data.Set("DeviceCode", *params.DeviceCode) + } + if params != nil && params.RefreshToken != nil { + data.Set("RefreshToken", *params.RefreshToken) + } + if params != nil && params.DeviceId != nil { + data.Set("DeviceId", *params.DeviceId) + } - if params != nil && params.GrantType != nil { - data.Set("GrantType", *params.GrantType) - } - if params != nil && params.ClientSid != nil { - data.Set("ClientSid", *params.ClientSid) - } - if params != nil && params.ClientSecret != nil { - data.Set("ClientSecret", *params.ClientSecret) - } - if params != nil && params.Code != nil { - data.Set("Code", *params.Code) - } - if params != nil && params.CodeVerifier != nil { - data.Set("CodeVerifier", *params.CodeVerifier) - } - if params != nil && params.DeviceCode != nil { - data.Set("DeviceCode", *params.DeviceCode) - } - if params != nil && params.RefreshToken != nil { - data.Set("RefreshToken", *params.RefreshToken) - } - if params != nil && params.DeviceId != nil { - data.Set("DeviceId", *params.DeviceId) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &OauthV1Token{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &OauthV1Token{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/oauth/v1/userinfo.go b/rest/oauth/v1/userinfo.go index cf2e5f835..d9fa84768 100644 --- a/rest/oauth/v1/userinfo.go +++ b/rest/oauth/v1/userinfo.go @@ -16,27 +16,33 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Retrieves the consented UserInfo and other claims about the logged-in subject (end-user). func (c *ApiService) FetchUserInfo() (*OauthV1UserInfo, error) { - path := "/v1/userinfo" + path := "/v1/userinfo" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &OauthV1UserInfo{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &OauthV1UserInfo{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/oauth/v1/well_known_openid_configuration.go b/rest/oauth/v1/well_known_openid_configuration.go index 1c4bd6f5c..7be1a739a 100644 --- a/rest/oauth/v1/well_known_openid_configuration.go +++ b/rest/oauth/v1/well_known_openid_configuration.go @@ -16,27 +16,33 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Fetch configuration details about the OpenID Connect Authorization Server func (c *ApiService) FetchOpenidDiscovery() (*OauthV1OpenidDiscovery, error) { - path := "/v1/.well-known/openid-configuration" + path := "/v1/.well-known/openid-configuration" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &OauthV1OpenidDiscovery{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &OauthV1OpenidDiscovery{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/pricing/v1/README.md b/rest/pricing/v1/README.md index b4df74842..995972d62 100644 --- a/rest/pricing/v1/README.md +++ b/rest/pricing/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/pricing/v1/api_service.go b/rest/pricing/v1/api_service.go index dd1d948c5..085a8fc80 100644 --- a/rest/pricing/v1/api_service.go +++ b/rest/pricing/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://pricing.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/pricing/v1/docs/ListMessagingCountryResponseMeta.md b/rest/pricing/v1/docs/ListMessagingCountryResponseMeta.md index 05b515649..d98948f79 100644 --- a/rest/pricing/v1/docs/ListMessagingCountryResponseMeta.md +++ b/rest/pricing/v1/docs/ListMessagingCountryResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/pricing/v1/messaging_countries.go b/rest/pricing/v1/messaging_countries.go index 44948443b..572c59a18 100644 --- a/rest/pricing/v1/messaging_countries.go +++ b/rest/pricing/v1/messaging_countries.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchMessagingCountry(IsoCountry string) (*PricingV1MessagingCountryInstance, error) { - path := "/v1/Messaging/Countries/{IsoCountry}" - path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchMessagingCountry(IsoCountry string, ) (*PricingV1MessagingCountryInstance, error) { + path := "/v1/Messaging/Countries/{IsoCountry}" + path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &PricingV1MessagingCountryInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &PricingV1MessagingCountryInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMessagingCountry' type ListMessagingCountryParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessagingCountryParams) SetPageSize(PageSize int) *ListMessagingCountryParams { - params.PageSize = &PageSize - return params +func (params *ListMessagingCountryParams) SetPageSize(PageSize int) (*ListMessagingCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessagingCountryParams) SetLimit(Limit int) *ListMessagingCountryParams { - params.Limit = &Limit - return params +func (params *ListMessagingCountryParams) SetLimit(Limit int) (*ListMessagingCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of MessagingCountry records from the API. Request is executed immediately. func (c *ApiService) PageMessagingCountry(params *ListMessagingCountryParams, pageToken, pageNumber string) (*ListMessagingCountryResponse, error) { - path := "/v1/Messaging/Countries" + path := "/v1/Messaging/Countries" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessagingCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessagingCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists MessagingCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamMessagingCountry(params *ListMessagingCountryParams) return recordChannel, errorChannel } + func (c *ApiService) streamMessagingCountry(response *ListMessagingCountryResponse, params *ListMessagingCountryParams, recordChannel chan PricingV1MessagingCountry, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamMessagingCountry(response *ListMessagingCountryRespon } func (c *ApiService) getNextListMessagingCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMessagingCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMessagingCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/pricing/v1/model_list_messaging_country_response.go b/rest/pricing/v1/model_list_messaging_country_response.go index 9fa64bf53..5e5a5df57 100644 --- a/rest/pricing/v1/model_list_messaging_country_response.go +++ b/rest/pricing/v1/model_list_messaging_country_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessagingCountryResponse struct for ListMessagingCountryResponse type ListMessagingCountryResponse struct { - Countries []PricingV1MessagingCountry `json:"countries,omitempty"` - Meta ListMessagingCountryResponseMeta `json:"meta,omitempty"` + Countries []PricingV1MessagingCountry `json:"countries,omitempty"` + Meta ListMessagingCountryResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/pricing/v1/model_list_messaging_country_response_meta.go b/rest/pricing/v1/model_list_messaging_country_response_meta.go index aedea6d4a..7ce2d8da4 100644 --- a/rest/pricing/v1/model_list_messaging_country_response_meta.go +++ b/rest/pricing/v1/model_list_messaging_country_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessagingCountryResponseMeta struct for ListMessagingCountryResponseMeta type ListMessagingCountryResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_list_phone_number_country_response.go b/rest/pricing/v1/model_list_phone_number_country_response.go index 601fe827c..2817820a5 100644 --- a/rest/pricing/v1/model_list_phone_number_country_response.go +++ b/rest/pricing/v1/model_list_phone_number_country_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListPhoneNumberCountryResponse struct for ListPhoneNumberCountryResponse type ListPhoneNumberCountryResponse struct { - Countries []PricingV1PhoneNumberCountry `json:"countries,omitempty"` - Meta ListMessagingCountryResponseMeta `json:"meta,omitempty"` + Countries []PricingV1PhoneNumberCountry `json:"countries,omitempty"` + Meta ListMessagingCountryResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/pricing/v1/model_list_voice_country_response.go b/rest/pricing/v1/model_list_voice_country_response.go index a6cb96f32..307edf299 100644 --- a/rest/pricing/v1/model_list_voice_country_response.go +++ b/rest/pricing/v1/model_list_voice_country_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVoiceCountryResponse struct for ListVoiceCountryResponse type ListVoiceCountryResponse struct { - Countries []PricingV1VoiceCountry `json:"countries,omitempty"` - Meta ListMessagingCountryResponseMeta `json:"meta,omitempty"` + Countries []PricingV1VoiceCountry `json:"countries,omitempty"` + Meta ListMessagingCountryResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_messaging.go b/rest/pricing/v1/model_pricing_v1_messaging.go index 926b7482f..8a6b8c4f8 100644 --- a/rest/pricing/v1/model_pricing_v1_messaging.go +++ b/rest/pricing/v1/model_pricing_v1_messaging.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1Messaging struct for PricingV1Messaging type PricingV1Messaging struct { - Name *string `json:"name,omitempty"` - Url *string `json:"url,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_messaging_country.go b/rest/pricing/v1/model_pricing_v1_messaging_country.go index 15e903113..be14bbcfe 100644 --- a/rest/pricing/v1/model_pricing_v1_messaging_country.go +++ b/rest/pricing/v1/model_pricing_v1_messaging_country.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1MessagingCountry struct for PricingV1MessagingCountry type PricingV1MessagingCountry struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_messaging_country_instance.go b/rest/pricing/v1/model_pricing_v1_messaging_country_instance.go index cff0190bd..eb9198eee 100644 --- a/rest/pricing/v1/model_pricing_v1_messaging_country_instance.go +++ b/rest/pricing/v1/model_pricing_v1_messaging_country_instance.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1MessagingCountryInstance struct for PricingV1MessagingCountryInstance type PricingV1MessagingCountryInstance struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The list of [OutboundSMSPrice](https://www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country. + // The list of [OutboundSMSPrice](https://www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country. OutboundSmsPrices *[]PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices `json:"outbound_sms_prices,omitempty"` - // The list of [InboundPrice](https://www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country + // The list of [InboundPrice](https://www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country InboundSmsPrices *[]PricingV1MessagingMessagingCountryInstanceInboundSmsPrices `json:"inbound_sms_prices,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_inbound_sms_prices.go b/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_inbound_sms_prices.go index 94b111d33..d8861b97f 100644 --- a/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_inbound_sms_prices.go +++ b/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_inbound_sms_prices.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1MessagingMessagingCountryInstanceInboundSmsPrices struct for PricingV1MessagingMessagingCountryInstanceInboundSmsPrices type PricingV1MessagingMessagingCountryInstanceInboundSmsPrices struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV1MessagingMessagingCountryInstanceInboundSmsPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV1MessagingMessagingCountryInstanceInboundSmsPrices) Unma return } + diff --git a/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices.go b/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices.go index ba18dd183..5bae885b4 100644 --- a/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices.go +++ b/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices struct for PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices type PricingV1MessagingMessagingCountryInstanceOutboundSmsPrices struct { - Carrier string `json:"carrier,omitempty"` - Mcc string `json:"mcc,omitempty"` - Mnc string `json:"mnc,omitempty"` - Prices []PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices `json:"prices,omitempty"` + Carrier string `json:"carrier,omitempty"` + Mcc string `json:"mcc,omitempty"` + Mnc string `json:"mnc,omitempty"` + Prices []PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices `json:"prices,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices_prices.go b/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices_prices.go index 5907f8db6..94a7ed322 100644 --- a/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices_prices.go +++ b/rest/pricing/v1/model_pricing_v1_messaging_messaging_country_instance_outbound_sms_prices_prices.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices struct for PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices type PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV1MessagingMessagingCountryInstanceOutboundSmsPricesPrice return } + diff --git a/rest/pricing/v1/model_pricing_v1_phone_number.go b/rest/pricing/v1/model_pricing_v1_phone_number.go index 2926b527c..9d197ec01 100644 --- a/rest/pricing/v1/model_pricing_v1_phone_number.go +++ b/rest/pricing/v1/model_pricing_v1_phone_number.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1PhoneNumber struct for PricingV1PhoneNumber type PricingV1PhoneNumber struct { - Name *string `json:"name,omitempty"` - Url *string `json:"url,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_phone_number_country.go b/rest/pricing/v1/model_pricing_v1_phone_number_country.go index 37edd8d4d..d4662b855 100644 --- a/rest/pricing/v1/model_pricing_v1_phone_number_country.go +++ b/rest/pricing/v1/model_pricing_v1_phone_number_country.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1PhoneNumberCountry struct for PricingV1PhoneNumberCountry type PricingV1PhoneNumberCountry struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_phone_number_country_instance.go b/rest/pricing/v1/model_pricing_v1_phone_number_country_instance.go index 105a3bb4c..4cf937389 100644 --- a/rest/pricing/v1/model_pricing_v1_phone_number_country_instance.go +++ b/rest/pricing/v1/model_pricing_v1_phone_number_country_instance.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1PhoneNumberCountryInstance struct for PricingV1PhoneNumberCountryInstance type PricingV1PhoneNumberCountryInstance struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The list of [PhoneNumberPrice](https://www.twilio.com/docs/phone-numbers/pricing#phone-number-price) records. + // The list of [PhoneNumberPrice](https://www.twilio.com/docs/phone-numbers/pricing#phone-number-price) records. PhoneNumberPrices *[]PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices `json:"phone_number_prices,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_phone_number_phone_number_country_instance_phone_number_prices.go b/rest/pricing/v1/model_pricing_v1_phone_number_phone_number_country_instance_phone_number_prices.go index 4f4ef0aa1..9a6627b0c 100644 --- a/rest/pricing/v1/model_pricing_v1_phone_number_phone_number_country_instance_phone_number_prices.go +++ b/rest/pricing/v1/model_pricing_v1_phone_number_phone_number_country_instance_phone_number_prices.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices struct for PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices type PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV1PhoneNumberPhoneNumberCountryInstancePhoneNumberPrices) return } + diff --git a/rest/pricing/v1/model_pricing_v1_voice.go b/rest/pricing/v1/model_pricing_v1_voice.go index a9543614e..9442d040c 100644 --- a/rest/pricing/v1/model_pricing_v1_voice.go +++ b/rest/pricing/v1/model_pricing_v1_voice.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1Voice struct for PricingV1Voice type PricingV1Voice struct { - Name *string `json:"name,omitempty"` - Url *string `json:"url,omitempty"` + Name *string `json:"name,omitempty"` + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_voice_country.go b/rest/pricing/v1/model_pricing_v1_voice_country.go index 0ffd273c7..083961262 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_country.go +++ b/rest/pricing/v1/model_pricing_v1_voice_country.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1VoiceCountry struct for PricingV1VoiceCountry type PricingV1VoiceCountry struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_voice_country_instance.go b/rest/pricing/v1/model_pricing_v1_voice_country_instance.go index 9ba8e305d..6896e3f26 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_country_instance.go +++ b/rest/pricing/v1/model_pricing_v1_voice_country_instance.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1VoiceCountryInstance struct for PricingV1VoiceCountryInstance type PricingV1VoiceCountryInstance struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The list of OutboundPrefixPrice records, which include a list of the `prefixes`, the `friendly_name`, `base_price`, and the `current_price` for those prefixes. + // The list of OutboundPrefixPrice records, which include a list of the `prefixes`, the `friendly_name`, `base_price`, and the `current_price` for those prefixes. OutboundPrefixPrices *[]PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices `json:"outbound_prefix_prices,omitempty"` - // The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. + // The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. InboundCallPrices *[]PricingV1VoiceVoiceCountryInstanceInboundCallPrices `json:"inbound_call_prices,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_voice_number.go b/rest/pricing/v1/model_pricing_v1_voice_number.go index e8ac54035..52116c28f 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_number.go +++ b/rest/pricing/v1/model_pricing_v1_voice_number.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV1VoiceNumber struct for PricingV1VoiceNumber type PricingV1VoiceNumber struct { - // The phone number. + // The phone number. Number *string `json:"number,omitempty"` - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - IsoCountry *string `json:"iso_country,omitempty"` + // The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + IsoCountry *string `json:"iso_country,omitempty"` OutboundCallPrice *PricingV1VoiceVoiceNumberOutboundCallPrice `json:"outbound_call_price,omitempty"` - InboundCallPrice *PricingV1VoiceVoiceNumberInboundCallPrice `json:"inbound_call_price,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + InboundCallPrice *PricingV1VoiceVoiceNumberInboundCallPrice `json:"inbound_call_price,omitempty"` + // The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_inbound_call_prices.go b/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_inbound_call_prices.go index 35852d7b5..62db00e7e 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_inbound_call_prices.go +++ b/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_inbound_call_prices.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1VoiceVoiceCountryInstanceInboundCallPrices struct for PricingV1VoiceVoiceCountryInstanceInboundCallPrices type PricingV1VoiceVoiceCountryInstanceInboundCallPrices struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV1VoiceVoiceCountryInstanceInboundCallPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV1VoiceVoiceCountryInstanceInboundCallPrices) UnmarshalJS return } + diff --git a/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_outbound_prefix_prices.go b/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_outbound_prefix_prices.go index 7a32eee41..c3f2aad1b 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_outbound_prefix_prices.go +++ b/rest/pricing/v1/model_pricing_v1_voice_voice_country_instance_outbound_prefix_prices.go @@ -13,27 +13,24 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices struct for PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices type PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices struct { - Prefixes []string `json:"prefixes,omitempty"` - BasePrice float32 `json:"base_price,omitempty"` - CurrentPrice float32 `json:"current_price,omitempty"` - FriendlyName string `json:"friendly_name,omitempty"` + Prefixes []string `json:"prefixes,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` + CurrentPrice float32 `json:"current_price,omitempty"` + FriendlyName string `json:"friendly_name,omitempty"` } func (response *PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - Prefixes []string `json:"prefixes"` - BasePrice interface{} `json:"base_price"` + Prefixes []string `json:"prefixes"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - FriendlyName string `json:"friendly_name"` + FriendlyName string `json:"friendly_name"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -41,7 +38,7 @@ func (response *PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices) Unmarsha } *response = PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices{ - Prefixes: raw.Prefixes, + Prefixes: raw.Prefixes, FriendlyName: raw.FriendlyName, } @@ -59,3 +56,4 @@ func (response *PricingV1VoiceVoiceCountryInstanceOutboundPrefixPrices) Unmarsha return } + diff --git a/rest/pricing/v1/model_pricing_v1_voice_voice_number_inbound_call_price.go b/rest/pricing/v1/model_pricing_v1_voice_voice_number_inbound_call_price.go index acd6158af..3e1140170 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_voice_number_inbound_call_price.go +++ b/rest/pricing/v1/model_pricing_v1_voice_voice_number_inbound_call_price.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1VoiceVoiceNumberInboundCallPrice The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. If `null`, the Phone Number is not a Twilio number owned by this account. type PricingV1VoiceVoiceNumberInboundCallPrice struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV1VoiceVoiceNumberInboundCallPrice) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV1VoiceVoiceNumberInboundCallPrice) UnmarshalJSON(bytes [ return } + diff --git a/rest/pricing/v1/model_pricing_v1_voice_voice_number_outbound_call_price.go b/rest/pricing/v1/model_pricing_v1_voice_voice_number_outbound_call_price.go index ffd05ec35..64c6bb404 100644 --- a/rest/pricing/v1/model_pricing_v1_voice_voice_number_outbound_call_price.go +++ b/rest/pricing/v1/model_pricing_v1_voice_voice_number_outbound_call_price.go @@ -13,22 +13,19 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV1VoiceVoiceNumberOutboundCallPrice The OutboundCallPrice record, which includes a list of `origination_prefixes` and the `base_price` and `current_price` for those prefixes. type PricingV1VoiceVoiceNumberOutboundCallPrice struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` } func (response *PricingV1VoiceVoiceNumberOutboundCallPrice) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` }{} @@ -36,7 +33,8 @@ func (response *PricingV1VoiceVoiceNumberOutboundCallPrice) UnmarshalJSON(bytes return err } - *response = PricingV1VoiceVoiceNumberOutboundCallPrice{} + *response = PricingV1VoiceVoiceNumberOutboundCallPrice{ + } responseBasePrice, err := client.UnmarshalFloat32(&raw.BasePrice) if err != nil { @@ -52,3 +50,4 @@ func (response *PricingV1VoiceVoiceNumberOutboundCallPrice) UnmarshalJSON(bytes return } + diff --git a/rest/pricing/v1/phone_numbers_countries.go b/rest/pricing/v1/phone_numbers_countries.go index 45e54bb34..1563d58bc 100644 --- a/rest/pricing/v1/phone_numbers_countries.go +++ b/rest/pricing/v1/phone_numbers_countries.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchPhoneNumberCountry(IsoCountry string) (*PricingV1PhoneNumberCountryInstance, error) { - path := "/v1/PhoneNumbers/Countries/{IsoCountry}" - path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchPhoneNumberCountry(IsoCountry string, ) (*PricingV1PhoneNumberCountryInstance, error) { + path := "/v1/PhoneNumbers/Countries/{IsoCountry}" + path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &PricingV1PhoneNumberCountryInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &PricingV1PhoneNumberCountryInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListPhoneNumberCountry' type ListPhoneNumberCountryParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListPhoneNumberCountryParams) SetPageSize(PageSize int) *ListPhoneNumberCountryParams { - params.PageSize = &PageSize - return params +func (params *ListPhoneNumberCountryParams) SetPageSize(PageSize int) (*ListPhoneNumberCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListPhoneNumberCountryParams) SetLimit(Limit int) *ListPhoneNumberCountryParams { - params.Limit = &Limit - return params +func (params *ListPhoneNumberCountryParams) SetLimit(Limit int) (*ListPhoneNumberCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of PhoneNumberCountry records from the API. Request is executed immediately. func (c *ApiService) PagePhoneNumberCountry(params *ListPhoneNumberCountryParams, pageToken, pageNumber string) (*ListPhoneNumberCountryResponse, error) { - path := "/v1/PhoneNumbers/Countries" + path := "/v1/PhoneNumbers/Countries" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListPhoneNumberCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListPhoneNumberCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists PhoneNumberCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamPhoneNumberCountry(params *ListPhoneNumberCountryPara return recordChannel, errorChannel } + func (c *ApiService) streamPhoneNumberCountry(response *ListPhoneNumberCountryResponse, params *ListPhoneNumberCountryParams, recordChannel chan PricingV1PhoneNumberCountry, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamPhoneNumberCountry(response *ListPhoneNumberCountryRe } func (c *ApiService) getNextListPhoneNumberCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPhoneNumberCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPhoneNumberCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/pricing/v1/voice_countries.go b/rest/pricing/v1/voice_countries.go index 97a5dce22..bbaee887b 100644 --- a/rest/pricing/v1/voice_countries.go +++ b/rest/pricing/v1/voice_countries.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchVoiceCountry(IsoCountry string) (*PricingV1VoiceCountryInstance, error) { - path := "/v1/Voice/Countries/{IsoCountry}" - path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchVoiceCountry(IsoCountry string, ) (*PricingV1VoiceCountryInstance, error) { + path := "/v1/Voice/Countries/{IsoCountry}" + path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &PricingV1VoiceCountryInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &PricingV1VoiceCountryInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListVoiceCountry' type ListVoiceCountryParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVoiceCountryParams) SetPageSize(PageSize int) *ListVoiceCountryParams { - params.PageSize = &PageSize - return params +func (params *ListVoiceCountryParams) SetPageSize(PageSize int) (*ListVoiceCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListVoiceCountryParams) SetLimit(Limit int) *ListVoiceCountryParams { - params.Limit = &Limit - return params +func (params *ListVoiceCountryParams) SetLimit(Limit int) (*ListVoiceCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of VoiceCountry records from the API. Request is executed immediately. func (c *ApiService) PageVoiceCountry(params *ListVoiceCountryParams, pageToken, pageNumber string) (*ListVoiceCountryResponse, error) { - path := "/v1/Voice/Countries" + path := "/v1/Voice/Countries" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListVoiceCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListVoiceCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists VoiceCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamVoiceCountry(params *ListVoiceCountryParams) (chan Pr return recordChannel, errorChannel } + func (c *ApiService) streamVoiceCountry(response *ListVoiceCountryResponse, params *ListVoiceCountryParams, recordChannel chan PricingV1VoiceCountry, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamVoiceCountry(response *ListVoiceCountryResponse, para } func (c *ApiService) getNextListVoiceCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVoiceCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVoiceCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/pricing/v1/voice_numbers.go b/rest/pricing/v1/voice_numbers.go index a7993a1bb..4d22cb846 100644 --- a/rest/pricing/v1/voice_numbers.go +++ b/rest/pricing/v1/voice_numbers.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchVoiceNumber(Number string) (*PricingV1VoiceNumber, error) { - path := "/v1/Voice/Numbers/{Number}" - path = strings.Replace(path, "{"+"Number"+"}", Number, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchVoiceNumber(Number string, ) (*PricingV1VoiceNumber, error) { + path := "/v1/Voice/Numbers/{Number}" + path = strings.Replace(path, "{"+"Number"+"}", Number, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &PricingV1VoiceNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &PricingV1VoiceNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/pricing/v2/README.md b/rest/pricing/v2/README.md index 320b57091..3b917e764 100644 --- a/rest/pricing/v2/README.md +++ b/rest/pricing/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/pricing/v2/api_service.go b/rest/pricing/v2/api_service.go index dd1d948c5..085a8fc80 100644 --- a/rest/pricing/v2/api_service.go +++ b/rest/pricing/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://pricing.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/pricing/v2/docs/ListTrunkingCountryResponseMeta.md b/rest/pricing/v2/docs/ListTrunkingCountryResponseMeta.md index 4b6e3a465..3979c487c 100644 --- a/rest/pricing/v2/docs/ListTrunkingCountryResponseMeta.md +++ b/rest/pricing/v2/docs/ListTrunkingCountryResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/pricing/v2/model_list_trunking_country_response.go b/rest/pricing/v2/model_list_trunking_country_response.go index bb2adc148..afd82062e 100644 --- a/rest/pricing/v2/model_list_trunking_country_response.go +++ b/rest/pricing/v2/model_list_trunking_country_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrunkingCountryResponse struct for ListTrunkingCountryResponse type ListTrunkingCountryResponse struct { - Countries []PricingV2TrunkingCountry `json:"countries,omitempty"` - Meta ListTrunkingCountryResponseMeta `json:"meta,omitempty"` + Countries []PricingV2TrunkingCountry `json:"countries,omitempty"` + Meta ListTrunkingCountryResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/pricing/v2/model_list_trunking_country_response_meta.go b/rest/pricing/v2/model_list_trunking_country_response_meta.go index 7e9ddbbcf..2380c4344 100644 --- a/rest/pricing/v2/model_list_trunking_country_response_meta.go +++ b/rest/pricing/v2/model_list_trunking_country_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrunkingCountryResponseMeta struct for ListTrunkingCountryResponseMeta type ListTrunkingCountryResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_list_voice_country_response.go b/rest/pricing/v2/model_list_voice_country_response.go index 96bad3ddc..fabbd415c 100644 --- a/rest/pricing/v2/model_list_voice_country_response.go +++ b/rest/pricing/v2/model_list_voice_country_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVoiceCountryResponse struct for ListVoiceCountryResponse type ListVoiceCountryResponse struct { - Countries []PricingV2VoiceCountry `json:"countries,omitempty"` - Meta ListTrunkingCountryResponseMeta `json:"meta,omitempty"` + Countries []PricingV2VoiceCountry `json:"countries,omitempty"` + Meta ListTrunkingCountryResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_trunking_country.go b/rest/pricing/v2/model_pricing_v2_trunking_country.go index f00fa83ce..0da58ed23 100644 --- a/rest/pricing/v2/model_pricing_v2_trunking_country.go +++ b/rest/pricing/v2/model_pricing_v2_trunking_country.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2TrunkingCountry struct for PricingV2TrunkingCountry type PricingV2TrunkingCountry struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_trunking_country_instance.go b/rest/pricing/v2/model_pricing_v2_trunking_country_instance.go index 87c1f55eb..1e56fcffd 100644 --- a/rest/pricing/v2/model_pricing_v2_trunking_country_instance.go +++ b/rest/pricing/v2/model_pricing_v2_trunking_country_instance.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2TrunkingCountryInstance struct for PricingV2TrunkingCountryInstance type PricingV2TrunkingCountryInstance struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The list of [TerminatingPrefixPrice](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. + // The list of [TerminatingPrefixPrice](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. TerminatingPrefixPrices *[]PricingV2TrunkingCountryInstanceTerminatingPrefixPrices `json:"terminating_prefix_prices,omitempty"` - // The list of [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. + // The list of [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. OriginatingCallPrices *[]PricingV2TrunkingCountryInstanceOriginatingCallPrices `json:"originating_call_prices,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_trunking_country_instance_originating_call_prices.go b/rest/pricing/v2/model_pricing_v2_trunking_country_instance_originating_call_prices.go index ecdfc6448..7e24a4d35 100644 --- a/rest/pricing/v2/model_pricing_v2_trunking_country_instance_originating_call_prices.go +++ b/rest/pricing/v2/model_pricing_v2_trunking_country_instance_originating_call_prices.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV2TrunkingCountryInstanceOriginatingCallPrices struct for PricingV2TrunkingCountryInstanceOriginatingCallPrices type PricingV2TrunkingCountryInstanceOriginatingCallPrices struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV2TrunkingCountryInstanceOriginatingCallPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV2TrunkingCountryInstanceOriginatingCallPrices) Unmarshal return } + diff --git a/rest/pricing/v2/model_pricing_v2_trunking_country_instance_terminating_prefix_prices.go b/rest/pricing/v2/model_pricing_v2_trunking_country_instance_terminating_prefix_prices.go index 0f32edf21..ad9faef76 100644 --- a/rest/pricing/v2/model_pricing_v2_trunking_country_instance_terminating_prefix_prices.go +++ b/rest/pricing/v2/model_pricing_v2_trunking_country_instance_terminating_prefix_prices.go @@ -13,29 +13,26 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV2TrunkingCountryInstanceTerminatingPrefixPrices struct for PricingV2TrunkingCountryInstanceTerminatingPrefixPrices type PricingV2TrunkingCountryInstanceTerminatingPrefixPrices struct { OriginationPrefixes []string `json:"origination_prefixes,omitempty"` DestinationPrefixes []string `json:"destination_prefixes,omitempty"` - BasePrice float32 `json:"base_price,omitempty"` - CurrentPrice float32 `json:"current_price,omitempty"` - FriendlyName string `json:"friendly_name,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` + CurrentPrice float32 `json:"current_price,omitempty"` + FriendlyName string `json:"friendly_name,omitempty"` } func (response *PricingV2TrunkingCountryInstanceTerminatingPrefixPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - OriginationPrefixes []string `json:"origination_prefixes"` - DestinationPrefixes []string `json:"destination_prefixes"` - BasePrice interface{} `json:"base_price"` - CurrentPrice interface{} `json:"current_price"` - FriendlyName string `json:"friendly_name"` + OriginationPrefixes []string `json:"origination_prefixes"` + DestinationPrefixes []string `json:"destination_prefixes"` + BasePrice interface{} `json:"base_price"` + CurrentPrice interface{} `json:"current_price"` + FriendlyName string `json:"friendly_name"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -45,7 +42,7 @@ func (response *PricingV2TrunkingCountryInstanceTerminatingPrefixPrices) Unmarsh *response = PricingV2TrunkingCountryInstanceTerminatingPrefixPrices{ OriginationPrefixes: raw.OriginationPrefixes, DestinationPrefixes: raw.DestinationPrefixes, - FriendlyName: raw.FriendlyName, + FriendlyName: raw.FriendlyName, } responseBasePrice, err := client.UnmarshalFloat32(&raw.BasePrice) @@ -62,3 +59,4 @@ func (response *PricingV2TrunkingCountryInstanceTerminatingPrefixPrices) Unmarsh return } + diff --git a/rest/pricing/v2/model_pricing_v2_trunking_number.go b/rest/pricing/v2/model_pricing_v2_trunking_number.go index f397b8109..42d01c06d 100644 --- a/rest/pricing/v2/model_pricing_v2_trunking_number.go +++ b/rest/pricing/v2/model_pricing_v2_trunking_number.go @@ -13,21 +13,26 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2TrunkingNumber struct for PricingV2TrunkingNumber type PricingV2TrunkingNumber struct { - // The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. DestinationNumber *string `json:"destination_number,omitempty"` - // The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. OriginationNumber *string `json:"origination_number,omitempty"` - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) - IsoCountry *string `json:"iso_country,omitempty"` + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + IsoCountry *string `json:"iso_country,omitempty"` TerminatingPrefixPrices *[]PricingV2TrunkingCountryInstanceTerminatingPrefixPrices `json:"terminating_prefix_prices,omitempty"` - OriginatingCallPrice *PricingV2TrunkingNumberOriginatingCallPrice `json:"originating_call_price,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + OriginatingCallPrice *PricingV2TrunkingNumberOriginatingCallPrice `json:"originating_call_price,omitempty"` + // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_trunking_number_originating_call_price.go b/rest/pricing/v2/model_pricing_v2_trunking_number_originating_call_price.go index 3e735fe43..a07b6fd5f 100644 --- a/rest/pricing/v2/model_pricing_v2_trunking_number_originating_call_price.go +++ b/rest/pricing/v2/model_pricing_v2_trunking_number_originating_call_price.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV2TrunkingNumberOriginatingCallPrice The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. type PricingV2TrunkingNumberOriginatingCallPrice struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV2TrunkingNumberOriginatingCallPrice) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV2TrunkingNumberOriginatingCallPrice) UnmarshalJSON(bytes return } + diff --git a/rest/pricing/v2/model_pricing_v2_voice.go b/rest/pricing/v2/model_pricing_v2_voice.go index 823615aaa..158f71a0c 100644 --- a/rest/pricing/v2/model_pricing_v2_voice.go +++ b/rest/pricing/v2/model_pricing_v2_voice.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2Voice struct for PricingV2Voice type PricingV2Voice struct { - // The resource name. + // The resource name. Name *string `json:"name,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of the related Countries and Numbers resources. + // The URLs of the related Countries and Numbers resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_voice_country.go b/rest/pricing/v2/model_pricing_v2_voice_country.go index 91ce7218e..3e991ee5a 100644 --- a/rest/pricing/v2/model_pricing_v2_voice_country.go +++ b/rest/pricing/v2/model_pricing_v2_voice_country.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2VoiceCountry struct for PricingV2VoiceCountry type PricingV2VoiceCountry struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_voice_country_instance.go b/rest/pricing/v2/model_pricing_v2_voice_country_instance.go index 88aea9e96..84b6ca0ee 100644 --- a/rest/pricing/v2/model_pricing_v2_voice_country_instance.go +++ b/rest/pricing/v2/model_pricing_v2_voice_country_instance.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2VoiceCountryInstance struct for PricingV2VoiceCountryInstance type PricingV2VoiceCountryInstance struct { - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCountry *string `json:"iso_country,omitempty"` - // The list of [OutboundPrefixPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. + // The list of [OutboundPrefixPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. OutboundPrefixPrices *[]PricingV2TrunkingCountryInstanceTerminatingPrefixPrices `json:"outbound_prefix_prices,omitempty"` - // The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. + // The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. InboundCallPrices *[]PricingV2TrunkingCountryInstanceOriginatingCallPrices `json:"inbound_call_prices,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_voice_number.go b/rest/pricing/v2/model_pricing_v2_voice_number.go index 1c3dd621b..26ec351b4 100644 --- a/rest/pricing/v2/model_pricing_v2_voice_number.go +++ b/rest/pricing/v2/model_pricing_v2_voice_number.go @@ -13,22 +13,27 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // PricingV2VoiceNumber struct for PricingV2VoiceNumber type PricingV2VoiceNumber struct { - // The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. DestinationNumber *string `json:"destination_number,omitempty"` - // The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. OriginationNumber *string `json:"origination_number,omitempty"` - // The name of the country. + // The name of the country. Country *string `json:"country,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) IsoCountry *string `json:"iso_country,omitempty"` - // The list of [OutboundCallPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-call-price-with-origin) records. + // The list of [OutboundCallPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-call-price-with-origin) records. OutboundCallPrices *[]PricingV2VoiceVoiceNumberOutboundCallPrices `json:"outbound_call_prices,omitempty"` - InboundCallPrice *PricingV2VoiceVoiceNumberInboundCallPrice `json:"inbound_call_price,omitempty"` - // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + InboundCallPrice *PricingV2VoiceVoiceNumberInboundCallPrice `json:"inbound_call_price,omitempty"` + // The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). PriceUnit *string `json:"price_unit,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/pricing/v2/model_pricing_v2_voice_voice_number_inbound_call_price.go b/rest/pricing/v2/model_pricing_v2_voice_voice_number_inbound_call_price.go index f606b5803..d66b4a558 100644 --- a/rest/pricing/v2/model_pricing_v2_voice_voice_number_inbound_call_price.go +++ b/rest/pricing/v2/model_pricing_v2_voice_voice_number_inbound_call_price.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV2VoiceVoiceNumberInboundCallPrice The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record. type PricingV2VoiceVoiceNumberInboundCallPrice struct { - BasePrice float32 `json:"base_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` CurrentPrice float32 `json:"current_price,omitempty"` - NumberType string `json:"number_type,omitempty"` + NumberType string `json:"number_type,omitempty"` } func (response *PricingV2VoiceVoiceNumberInboundCallPrice) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` + BasePrice interface{} `json:"base_price"` CurrentPrice interface{} `json:"current_price"` - NumberType string `json:"number_type"` + NumberType string `json:"number_type"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV2VoiceVoiceNumberInboundCallPrice) UnmarshalJSON(bytes [ return } + diff --git a/rest/pricing/v2/model_pricing_v2_voice_voice_number_outbound_call_prices.go b/rest/pricing/v2/model_pricing_v2_voice_voice_number_outbound_call_prices.go index 45f75da31..36a2b16c2 100644 --- a/rest/pricing/v2/model_pricing_v2_voice_voice_number_outbound_call_prices.go +++ b/rest/pricing/v2/model_pricing_v2_voice_voice_number_outbound_call_prices.go @@ -13,25 +13,22 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // PricingV2VoiceVoiceNumberOutboundCallPrices struct for PricingV2VoiceVoiceNumberOutboundCallPrices type PricingV2VoiceVoiceNumberOutboundCallPrices struct { - BasePrice float32 `json:"base_price,omitempty"` - CurrentPrice float32 `json:"current_price,omitempty"` + BasePrice float32 `json:"base_price,omitempty"` + CurrentPrice float32 `json:"current_price,omitempty"` OriginationPrefixes []string `json:"origination_prefixes,omitempty"` } func (response *PricingV2VoiceVoiceNumberOutboundCallPrices) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - BasePrice interface{} `json:"base_price"` - CurrentPrice interface{} `json:"current_price"` - OriginationPrefixes []string `json:"origination_prefixes"` + BasePrice interface{} `json:"base_price"` + CurrentPrice interface{} `json:"current_price"` + OriginationPrefixes []string `json:"origination_prefixes"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -56,3 +53,4 @@ func (response *PricingV2VoiceVoiceNumberOutboundCallPrices) UnmarshalJSON(bytes return } + diff --git a/rest/pricing/v2/trunking_countries.go b/rest/pricing/v2/trunking_countries.go index 4a8b32d7c..03384061e 100644 --- a/rest/pricing/v2/trunking_countries.go +++ b/rest/pricing/v2/trunking_countries.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Country. -func (c *ApiService) FetchTrunkingCountry(IsoCountry string) (*PricingV2TrunkingCountryInstance, error) { - path := "/v2/Trunking/Countries/{IsoCountry}" - path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) +func (c *ApiService) FetchTrunkingCountry(IsoCountry string, ) (*PricingV2TrunkingCountryInstance, error) { + path := "/v2/Trunking/Countries/{IsoCountry}" + path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &PricingV2TrunkingCountryInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &PricingV2TrunkingCountryInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTrunkingCountry' type ListTrunkingCountryParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTrunkingCountryParams) SetPageSize(PageSize int) *ListTrunkingCountryParams { - params.PageSize = &PageSize - return params +func (params *ListTrunkingCountryParams) SetPageSize(PageSize int) (*ListTrunkingCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListTrunkingCountryParams) SetLimit(Limit int) *ListTrunkingCountryParams { - params.Limit = &Limit - return params +func (params *ListTrunkingCountryParams) SetLimit(Limit int) (*ListTrunkingCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TrunkingCountry records from the API. Request is executed immediately. func (c *ApiService) PageTrunkingCountry(params *ListTrunkingCountryParams, pageToken, pageNumber string) (*ListTrunkingCountryResponse, error) { - path := "/v2/Trunking/Countries" + path := "/v2/Trunking/Countries" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTrunkingCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTrunkingCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists TrunkingCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamTrunkingCountry(params *ListTrunkingCountryParams) (c return recordChannel, errorChannel } + func (c *ApiService) streamTrunkingCountry(response *ListTrunkingCountryResponse, params *ListTrunkingCountryParams, recordChannel chan PricingV2TrunkingCountry, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamTrunkingCountry(response *ListTrunkingCountryResponse } func (c *ApiService) getNextListTrunkingCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrunkingCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrunkingCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/pricing/v2/trunking_numbers.go b/rest/pricing/v2/trunking_numbers.go index 7ecd14fe0..e0e013998 100644 --- a/rest/pricing/v2/trunking_numbers.go +++ b/rest/pricing/v2/trunking_numbers.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchTrunkingNumber' type FetchTrunkingNumberParams struct { - // The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. - OriginationNumber *string `json:"OriginationNumber,omitempty"` + // The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. + OriginationNumber *string `json:"OriginationNumber,omitempty"` } -func (params *FetchTrunkingNumberParams) SetOriginationNumber(OriginationNumber string) *FetchTrunkingNumberParams { - params.OriginationNumber = &OriginationNumber - return params +func (params *FetchTrunkingNumberParams) SetOriginationNumber(OriginationNumber string) (*FetchTrunkingNumberParams){ + params.OriginationNumber = &OriginationNumber + return params } // Fetch pricing information for a specific destination and, optionally, origination phone number. func (c *ApiService) FetchTrunkingNumber(DestinationNumber string, params *FetchTrunkingNumberParams) (*PricingV2TrunkingNumber, error) { - path := "/v2/Trunking/Numbers/{DestinationNumber}" - path = strings.Replace(path, "{"+"DestinationNumber"+"}", DestinationNumber, -1) + path := "/v2/Trunking/Numbers/{DestinationNumber}" + path = strings.Replace(path, "{"+"DestinationNumber"+"}", DestinationNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.OriginationNumber != nil { + data.Set("OriginationNumber", *params.OriginationNumber) + } - if params != nil && params.OriginationNumber != nil { - data.Set("OriginationNumber", *params.OriginationNumber) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &PricingV2TrunkingNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &PricingV2TrunkingNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/pricing/v2/voice_countries.go b/rest/pricing/v2/voice_countries.go index 21ba246d8..0f62f7563 100644 --- a/rest/pricing/v2/voice_countries.go +++ b/rest/pricing/v2/voice_countries.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Country. -func (c *ApiService) FetchVoiceCountry(IsoCountry string) (*PricingV2VoiceCountryInstance, error) { - path := "/v2/Voice/Countries/{IsoCountry}" - path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) +func (c *ApiService) FetchVoiceCountry(IsoCountry string, ) (*PricingV2VoiceCountryInstance, error) { + path := "/v2/Voice/Countries/{IsoCountry}" + path = strings.Replace(path, "{"+"IsoCountry"+"}", IsoCountry, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &PricingV2VoiceCountryInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &PricingV2VoiceCountryInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListVoiceCountry' type ListVoiceCountryParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVoiceCountryParams) SetPageSize(PageSize int) *ListVoiceCountryParams { - params.PageSize = &PageSize - return params +func (params *ListVoiceCountryParams) SetPageSize(PageSize int) (*ListVoiceCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListVoiceCountryParams) SetLimit(Limit int) *ListVoiceCountryParams { - params.Limit = &Limit - return params +func (params *ListVoiceCountryParams) SetLimit(Limit int) (*ListVoiceCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of VoiceCountry records from the API. Request is executed immediately. func (c *ApiService) PageVoiceCountry(params *ListVoiceCountryParams, pageToken, pageNumber string) (*ListVoiceCountryResponse, error) { - path := "/v2/Voice/Countries" + path := "/v2/Voice/Countries" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListVoiceCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListVoiceCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists VoiceCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamVoiceCountry(params *ListVoiceCountryParams) (chan Pr return recordChannel, errorChannel } + func (c *ApiService) streamVoiceCountry(response *ListVoiceCountryResponse, params *ListVoiceCountryParams, recordChannel chan PricingV2VoiceCountry, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamVoiceCountry(response *ListVoiceCountryResponse, para } func (c *ApiService) getNextListVoiceCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVoiceCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVoiceCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/pricing/v2/voice_numbers.go b/rest/pricing/v2/voice_numbers.go index bb56cee05..bed52fba6 100644 --- a/rest/pricing/v2/voice_numbers.go +++ b/rest/pricing/v2/voice_numbers.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchVoiceNumber' type FetchVoiceNumberParams struct { - // The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. - OriginationNumber *string `json:"OriginationNumber,omitempty"` + // The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. + OriginationNumber *string `json:"OriginationNumber,omitempty"` } -func (params *FetchVoiceNumberParams) SetOriginationNumber(OriginationNumber string) *FetchVoiceNumberParams { - params.OriginationNumber = &OriginationNumber - return params +func (params *FetchVoiceNumberParams) SetOriginationNumber(OriginationNumber string) (*FetchVoiceNumberParams){ + params.OriginationNumber = &OriginationNumber + return params } // Fetch pricing information for a specific destination and, optionally, origination phone number. func (c *ApiService) FetchVoiceNumber(DestinationNumber string, params *FetchVoiceNumberParams) (*PricingV2VoiceNumber, error) { - path := "/v2/Voice/Numbers/{DestinationNumber}" - path = strings.Replace(path, "{"+"DestinationNumber"+"}", DestinationNumber, -1) + path := "/v2/Voice/Numbers/{DestinationNumber}" + path = strings.Replace(path, "{"+"DestinationNumber"+"}", DestinationNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.OriginationNumber != nil { + data.Set("OriginationNumber", *params.OriginationNumber) + } - if params != nil && params.OriginationNumber != nil { - data.Set("OriginationNumber", *params.OriginationNumber) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &PricingV2VoiceNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &PricingV2VoiceNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/proxy/v1/README.md b/rest/proxy/v1/README.md index 1258aec3f..867c70ca0 100644 --- a/rest/proxy/v1/README.md +++ b/rest/proxy/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/proxy/v1/api_service.go b/rest/proxy/v1/api_service.go index 8a6c62264..8a6e2c528 100644 --- a/rest/proxy/v1/api_service.go +++ b/rest/proxy/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://proxy.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/proxy/v1/docs/ListInteractionResponseMeta.md b/rest/proxy/v1/docs/ListInteractionResponseMeta.md index 61f940442..61b92d9ec 100644 --- a/rest/proxy/v1/docs/ListInteractionResponseMeta.md +++ b/rest/proxy/v1/docs/ListInteractionResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/proxy/v1/model_list_interaction_response.go b/rest/proxy/v1/model_list_interaction_response.go index 06d3bbf53..4f3690387 100644 --- a/rest/proxy/v1/model_list_interaction_response.go +++ b/rest/proxy/v1/model_list_interaction_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInteractionResponse struct for ListInteractionResponse type ListInteractionResponse struct { - Interactions []ProxyV1Interaction `json:"interactions,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + Interactions []ProxyV1Interaction `json:"interactions,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_interaction_response_meta.go b/rest/proxy/v1/model_list_interaction_response_meta.go index 44ffdf711..10897703e 100644 --- a/rest/proxy/v1/model_list_interaction_response_meta.go +++ b/rest/proxy/v1/model_list_interaction_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListInteractionResponseMeta struct for ListInteractionResponseMeta type ListInteractionResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_message_interaction_response.go b/rest/proxy/v1/model_list_message_interaction_response.go index cdca4be63..e84e812ca 100644 --- a/rest/proxy/v1/model_list_message_interaction_response.go +++ b/rest/proxy/v1/model_list_message_interaction_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessageInteractionResponse struct for ListMessageInteractionResponse type ListMessageInteractionResponse struct { Interactions []ProxyV1MessageInteraction `json:"interactions,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_participant_response.go b/rest/proxy/v1/model_list_participant_response.go index dbacc5bec..4f78010a0 100644 --- a/rest/proxy/v1/model_list_participant_response.go +++ b/rest/proxy/v1/model_list_participant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListParticipantResponse struct for ListParticipantResponse type ListParticipantResponse struct { - Participants []ProxyV1Participant `json:"participants,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + Participants []ProxyV1Participant `json:"participants,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_phone_number_response.go b/rest/proxy/v1/model_list_phone_number_response.go index b0e19c168..717709e36 100644 --- a/rest/proxy/v1/model_list_phone_number_response.go +++ b/rest/proxy/v1/model_list_phone_number_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListPhoneNumberResponse struct for ListPhoneNumberResponse type ListPhoneNumberResponse struct { - PhoneNumbers []ProxyV1PhoneNumber `json:"phone_numbers,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + PhoneNumbers []ProxyV1PhoneNumber `json:"phone_numbers,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_service_response.go b/rest/proxy/v1/model_list_service_response.go index f002e1cdc..bbb366ee5 100644 --- a/rest/proxy/v1/model_list_service_response.go +++ b/rest/proxy/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []ProxyV1Service `json:"services,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + Services []ProxyV1Service `json:"services,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_session_response.go b/rest/proxy/v1/model_list_session_response.go index 2c467fe28..724d713e0 100644 --- a/rest/proxy/v1/model_list_session_response.go +++ b/rest/proxy/v1/model_list_session_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSessionResponse struct for ListSessionResponse type ListSessionResponse struct { - Sessions []ProxyV1Session `json:"sessions,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + Sessions []ProxyV1Session `json:"sessions,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_list_short_code_response.go b/rest/proxy/v1/model_list_short_code_response.go index 4db41f7bb..26a7057b2 100644 --- a/rest/proxy/v1/model_list_short_code_response.go +++ b/rest/proxy/v1/model_list_short_code_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListShortCodeResponse struct for ListShortCodeResponse type ListShortCodeResponse struct { - ShortCodes []ProxyV1ShortCode `json:"short_codes,omitempty"` - Meta ListInteractionResponseMeta `json:"meta,omitempty"` + ShortCodes []ProxyV1ShortCode `json:"short_codes,omitempty"` + Meta ListInteractionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_interaction.go b/rest/proxy/v1/model_proxy_v1_interaction.go index f066d64f9..250645423 100644 --- a/rest/proxy/v1/model_proxy_v1_interaction.go +++ b/rest/proxy/v1/model_proxy_v1_interaction.go @@ -13,46 +13,48 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1Interaction struct for ProxyV1Interaction type ProxyV1Interaction struct { - // The unique string that we created to identify the Interaction resource. + // The unique string that we created to identify the Interaction resource. Sid *string `json:"sid,omitempty"` - // The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. + // The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. SessionSid *string `json:"session_sid,omitempty"` - // The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + // The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Interaction resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Interaction resource. AccountSid *string `json:"account_sid,omitempty"` - // A JSON string that includes the message body of message interactions (e.g. `{\"body\": \"hello\"}`) or the call duration (when available) of a call (e.g. `{\"duration\": \"5\"}`). + // A JSON string that includes the message body of message interactions (e.g. `{\"body\": \"hello\"}`) or the call duration (when available) of a call (e.g. `{\"duration\": \"5\"}`). Data *string `json:"data,omitempty"` Type *string `json:"type,omitempty"` - // The SID of the inbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. + // The SID of the inbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. InboundParticipantSid *string `json:"inbound_participant_sid,omitempty"` - // The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message. - InboundResourceSid *string `json:"inbound_resource_sid,omitempty"` + // The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message. + InboundResourceSid *string `json:"inbound_resource_sid,omitempty"` InboundResourceStatus *string `json:"inbound_resource_status,omitempty"` - // The inbound resource type. Can be [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + // The inbound resource type. Can be [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). InboundResourceType *string `json:"inbound_resource_type,omitempty"` - // The URL of the Twilio inbound resource + // The URL of the Twilio inbound resource InboundResourceUrl *string `json:"inbound_resource_url,omitempty"` - // The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant)). + // The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant)). OutboundParticipantSid *string `json:"outbound_participant_sid,omitempty"` - // The SID of the outbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). - OutboundResourceSid *string `json:"outbound_resource_sid,omitempty"` + // The SID of the outbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + OutboundResourceSid *string `json:"outbound_resource_sid,omitempty"` OutboundResourceStatus *string `json:"outbound_resource_status,omitempty"` - // The outbound resource type. Can be: [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + // The outbound resource type. Can be: [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). OutboundResourceType *string `json:"outbound_resource_type,omitempty"` - // The URL of the Twilio outbound resource. + // The URL of the Twilio outbound resource. OutboundResourceUrl *string `json:"outbound_resource_url,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Interaction was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Interaction was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Interaction resource. + // The absolute URL of the Interaction resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_message_interaction.go b/rest/proxy/v1/model_proxy_v1_message_interaction.go index 50464c3cf..8e72615e7 100644 --- a/rest/proxy/v1/model_proxy_v1_message_interaction.go +++ b/rest/proxy/v1/model_proxy_v1_message_interaction.go @@ -13,48 +13,50 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1MessageInteraction struct for ProxyV1MessageInteraction type ProxyV1MessageInteraction struct { - // The unique string that we created to identify the MessageInteraction resource. + // The unique string that we created to identify the MessageInteraction resource. Sid *string `json:"sid,omitempty"` - // The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. + // The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. SessionSid *string `json:"session_sid,omitempty"` - // The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + // The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageInteraction resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageInteraction resource. AccountSid *string `json:"account_sid,omitempty"` - // A JSON string that includes the message body sent to the participant. (e.g. `{\"body\": \"hello\"}`) + // A JSON string that includes the message body sent to the participant. (e.g. `{\"body\": \"hello\"}`) Data *string `json:"data,omitempty"` Type *string `json:"type,omitempty"` - // The SID of the [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. + // The SID of the [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. ParticipantSid *string `json:"participant_sid,omitempty"` - // Always empty for created Message Interactions. + // Always empty for created Message Interactions. InboundParticipantSid *string `json:"inbound_participant_sid,omitempty"` - // Always empty for created Message Interactions. - InboundResourceSid *string `json:"inbound_resource_sid,omitempty"` + // Always empty for created Message Interactions. + InboundResourceSid *string `json:"inbound_resource_sid,omitempty"` InboundResourceStatus *string `json:"inbound_resource_status,omitempty"` - // Always empty for created Message Interactions. + // Always empty for created Message Interactions. InboundResourceType *string `json:"inbound_resource_type,omitempty"` - // Always empty for created Message Interactions. + // Always empty for created Message Interactions. InboundResourceUrl *string `json:"inbound_resource_url,omitempty"` - // The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. + // The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. OutboundParticipantSid *string `json:"outbound_participant_sid,omitempty"` - // The SID of the outbound [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. - OutboundResourceSid *string `json:"outbound_resource_sid,omitempty"` + // The SID of the outbound [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. + OutboundResourceSid *string `json:"outbound_resource_sid,omitempty"` OutboundResourceStatus *string `json:"outbound_resource_status,omitempty"` - // The outbound resource type. This value is always `Message`. + // The outbound resource type. This value is always `Message`. OutboundResourceType *string `json:"outbound_resource_type,omitempty"` - // The URL of the Twilio message resource. + // The URL of the Twilio message resource. OutboundResourceUrl *string `json:"outbound_resource_url,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the MessageInteraction resource. + // The absolute URL of the MessageInteraction resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_participant.go b/rest/proxy/v1/model_proxy_v1_participant.go index 0ac3ef15c..fee678818 100644 --- a/rest/proxy/v1/model_proxy_v1_participant.go +++ b/rest/proxy/v1/model_proxy_v1_participant.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1Participant struct for ProxyV1Participant type ProxyV1Participant struct { - // The unique string that we created to identify the Participant resource. + // The unique string that we created to identify the Participant resource. Sid *string `json:"sid,omitempty"` - // The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. + // The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. SessionSid *string `json:"session_sid,omitempty"` - // The SID of the resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + // The SID of the resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the participant. This value must be 255 characters or fewer. Supports UTF-8 characters. **This value should not have PII.** + // The string that you assigned to describe the participant. This value must be 255 characters or fewer. Supports UTF-8 characters. **This value should not have PII.** FriendlyName *string `json:"friendly_name,omitempty"` - // The phone number or channel identifier of the Participant. This value must be 191 characters or fewer. Supports UTF-8 characters. + // The phone number or channel identifier of the Participant. This value must be 191 characters or fewer. Supports UTF-8 characters. Identifier *string `json:"identifier,omitempty"` - // The phone number or short code (masked number) of the participant's partner. The participant will call or message the partner participant at this number. + // The phone number or short code (masked number) of the participant's partner. The participant will call or message the partner participant at this number. ProxyIdentifier *string `json:"proxy_identifier,omitempty"` - // The SID of the Proxy Identifier assigned to the Participant. + // The SID of the Proxy Identifier assigned to the Participant. ProxyIdentifierSid *string `json:"proxy_identifier_sid,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Participant was removed from the session. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Participant was removed from the session. DateDeleted *time.Time `json:"date_deleted,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Participant resource. + // The absolute URL of the Participant resource. Url *string `json:"url,omitempty"` - // The URLs to resources related the participant. + // The URLs to resources related the participant. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_phone_number.go b/rest/proxy/v1/model_proxy_v1_phone_number.go index ec4bd5f96..f2fc6421c 100644 --- a/rest/proxy/v1/model_proxy_v1_phone_number.go +++ b/rest/proxy/v1/model_proxy_v1_phone_number.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1PhoneNumber struct for ProxyV1PhoneNumber type ProxyV1PhoneNumber struct { - // The unique string that we created to identify the PhoneNumber resource. + // The unique string that we created to identify the PhoneNumber resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the PhoneNumber resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + // The SID of the PhoneNumber resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. ServiceSid *string `json:"service_sid,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The ISO Country Code for the phone number. - IsoCountry *string `json:"iso_country,omitempty"` + // The ISO Country Code for the phone number. + IsoCountry *string `json:"iso_country,omitempty"` Capabilities *ProxyV1ServicePhoneNumberCapabilities `json:"capabilities,omitempty"` - // The absolute URL of the PhoneNumber resource. + // The absolute URL of the PhoneNumber resource. Url *string `json:"url,omitempty"` - // Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + // Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. IsReserved *bool `json:"is_reserved,omitempty"` - // The number of open session assigned to the number. See the [How many Phone Numbers do I need?](https://www.twilio.com/docs/proxy/phone-numbers-needed) guide for more information. + // The number of open session assigned to the number. See the [How many Phone Numbers do I need?](https://www.twilio.com/docs/proxy/phone-numbers-needed) guide for more information. InUse *int `json:"in_use,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_service.go b/rest/proxy/v1/model_proxy_v1_service.go index 21f01a951..1cff93253 100644 --- a/rest/proxy/v1/model_proxy_v1_service.go +++ b/rest/proxy/v1/model_proxy_v1_service.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1Service struct for ProxyV1Service type ProxyV1Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** + // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. + // The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. ChatInstanceSid *string `json:"chat_instance_sid,omitempty"` - // The URL we call when the interaction status changes. + // The URL we call when the interaction status changes. CallbackUrl *string `json:"callback_url,omitempty"` - // The default `ttl` value for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. - DefaultTtl *int `json:"default_ttl,omitempty"` + // The default `ttl` value for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. + DefaultTtl *int `json:"default_ttl,omitempty"` NumberSelectionBehavior *string `json:"number_selection_behavior,omitempty"` - GeoMatchLevel *string `json:"geo_match_level,omitempty"` - // The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. + GeoMatchLevel *string `json:"geo_match_level,omitempty"` + // The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. InterceptCallbackUrl *string `json:"intercept_callback_url,omitempty"` - // The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. + // The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. OutOfSessionCallbackUrl *string `json:"out_of_session_callback_url,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The URLs of resources related to the Service. + // The URLs of resources related to the Service. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_service_phone_number_capabilities.go b/rest/proxy/v1/model_proxy_v1_service_phone_number_capabilities.go index b87012aa1..860b36530 100644 --- a/rest/proxy/v1/model_proxy_v1_service_phone_number_capabilities.go +++ b/rest/proxy/v1/model_proxy_v1_service_phone_number_capabilities.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ProxyV1ServicePhoneNumberCapabilities The capabilities of the phone number. type ProxyV1ServicePhoneNumberCapabilities struct { - Mms bool `json:"mms,omitempty"` - Sms bool `json:"sms,omitempty"` + Mms bool `json:"mms,omitempty"` + Sms bool `json:"sms,omitempty"` Voice bool `json:"voice,omitempty"` - Fax bool `json:"fax,omitempty"` + Fax bool `json:"fax,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_service_short_code_capabilities.go b/rest/proxy/v1/model_proxy_v1_service_short_code_capabilities.go index 4dfb16af0..d5bb1dc89 100644 --- a/rest/proxy/v1/model_proxy_v1_service_short_code_capabilities.go +++ b/rest/proxy/v1/model_proxy_v1_service_short_code_capabilities.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ProxyV1ServiceShortCodeCapabilities The capabilities of the short code. type ProxyV1ServiceShortCodeCapabilities struct { - Mms bool `json:"mms,omitempty"` - Sms bool `json:"sms,omitempty"` + Mms bool `json:"mms,omitempty"` + Sms bool `json:"sms,omitempty"` Voice bool `json:"voice,omitempty"` - Fax bool `json:"fax,omitempty"` + Fax bool `json:"fax,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_session.go b/rest/proxy/v1/model_proxy_v1_session.go index 970dbc132..1d08176b7 100644 --- a/rest/proxy/v1/model_proxy_v1_session.go +++ b/rest/proxy/v1/model_proxy_v1_session.go @@ -13,41 +13,43 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1Session struct for ProxyV1Session type ProxyV1Session struct { - // The unique string that we created to identify the Session resource. + // The unique string that we created to identify the Session resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/proxy/api/service) the session is associated with. + // The SID of the [Service](https://www.twilio.com/docs/proxy/api/service) the session is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. AccountSid *string `json:"account_sid,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session started. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session started. DateStarted *time.Time `json:"date_started,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session ended. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session ended. DateEnded *time.Time `json:"date_ended,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction. DateLastInteraction *time.Time `json:"date_last_interaction,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. DateExpiry *time.Time `json:"date_expiry,omitempty"` - // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** + // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** UniqueName *string `json:"unique_name,omitempty"` - Status *string `json:"status,omitempty"` - // The reason the Session ended. + Status *string `json:"status,omitempty"` + // The reason the Session ended. ClosedReason *string `json:"closed_reason,omitempty"` - // The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. - Ttl *int `json:"ttl,omitempty"` + // The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. + Ttl *int `json:"ttl,omitempty"` Mode *string `json:"mode,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Session resource. + // The absolute URL of the Session resource. Url *string `json:"url,omitempty"` - // The URLs of resources related to the Session. + // The URLs of resources related to the Session. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/proxy/v1/model_proxy_v1_short_code.go b/rest/proxy/v1/model_proxy_v1_short_code.go index ce7136b2d..563398005 100644 --- a/rest/proxy/v1/model_proxy_v1_short_code.go +++ b/rest/proxy/v1/model_proxy_v1_short_code.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ProxyV1ShortCode struct for ProxyV1ShortCode type ProxyV1ShortCode struct { - // The unique string that we created to identify the ShortCode resource. + // The unique string that we created to identify the ShortCode resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the ShortCode resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + // The SID of the ShortCode resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. ServiceSid *string `json:"service_sid,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The short code's number. + // The short code's number. ShortCode *string `json:"short_code,omitempty"` - // The ISO Country Code for the short code. - IsoCountry *string `json:"iso_country,omitempty"` + // The ISO Country Code for the short code. + IsoCountry *string `json:"iso_country,omitempty"` Capabilities *ProxyV1ServiceShortCodeCapabilities `json:"capabilities,omitempty"` - // The absolute URL of the ShortCode resource. + // The absolute URL of the ShortCode resource. Url *string `json:"url,omitempty"` - // Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + // Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. IsReserved *bool `json:"is_reserved,omitempty"` } + + diff --git a/rest/proxy/v1/services.go b/rest/proxy/v1/services.go index 20600cde4..fa5cb6a14 100644 --- a/rest/proxy/v1/services.go +++ b/rest/proxy/v1/services.go @@ -18,200 +18,206 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** - UniqueName *string `json:"UniqueName,omitempty"` - // The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. - DefaultTtl *int `json:"DefaultTtl,omitempty"` - // The URL we should call when the interaction status changes. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // - GeoMatchLevel *string `json:"GeoMatchLevel,omitempty"` - // - NumberSelectionBehavior *string `json:"NumberSelectionBehavior,omitempty"` - // The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. - InterceptCallbackUrl *string `json:"InterceptCallbackUrl,omitempty"` - // The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. - OutOfSessionCallbackUrl *string `json:"OutOfSessionCallbackUrl,omitempty"` - // The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. - ChatInstanceSid *string `json:"ChatInstanceSid,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** + UniqueName *string `json:"UniqueName,omitempty"` + // The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. + DefaultTtl *int `json:"DefaultTtl,omitempty"` + // The URL we should call when the interaction status changes. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // + GeoMatchLevel *string `json:"GeoMatchLevel,omitempty"` + // + NumberSelectionBehavior *string `json:"NumberSelectionBehavior,omitempty"` + // The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. + InterceptCallbackUrl *string `json:"InterceptCallbackUrl,omitempty"` + // The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. + OutOfSessionCallbackUrl *string `json:"OutOfSessionCallbackUrl,omitempty"` + // The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. + ChatInstanceSid *string `json:"ChatInstanceSid,omitempty"` } -func (params *CreateServiceParams) SetUniqueName(UniqueName string) *CreateServiceParams { - params.UniqueName = &UniqueName - return params +func (params *CreateServiceParams) SetUniqueName(UniqueName string) (*CreateServiceParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateServiceParams) SetDefaultTtl(DefaultTtl int) *CreateServiceParams { - params.DefaultTtl = &DefaultTtl - return params +func (params *CreateServiceParams) SetDefaultTtl(DefaultTtl int) (*CreateServiceParams){ + params.DefaultTtl = &DefaultTtl + return params } -func (params *CreateServiceParams) SetCallbackUrl(CallbackUrl string) *CreateServiceParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *CreateServiceParams) SetCallbackUrl(CallbackUrl string) (*CreateServiceParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *CreateServiceParams) SetGeoMatchLevel(GeoMatchLevel string) *CreateServiceParams { - params.GeoMatchLevel = &GeoMatchLevel - return params +func (params *CreateServiceParams) SetGeoMatchLevel(GeoMatchLevel string) (*CreateServiceParams){ + params.GeoMatchLevel = &GeoMatchLevel + return params } -func (params *CreateServiceParams) SetNumberSelectionBehavior(NumberSelectionBehavior string) *CreateServiceParams { - params.NumberSelectionBehavior = &NumberSelectionBehavior - return params +func (params *CreateServiceParams) SetNumberSelectionBehavior(NumberSelectionBehavior string) (*CreateServiceParams){ + params.NumberSelectionBehavior = &NumberSelectionBehavior + return params } -func (params *CreateServiceParams) SetInterceptCallbackUrl(InterceptCallbackUrl string) *CreateServiceParams { - params.InterceptCallbackUrl = &InterceptCallbackUrl - return params +func (params *CreateServiceParams) SetInterceptCallbackUrl(InterceptCallbackUrl string) (*CreateServiceParams){ + params.InterceptCallbackUrl = &InterceptCallbackUrl + return params } -func (params *CreateServiceParams) SetOutOfSessionCallbackUrl(OutOfSessionCallbackUrl string) *CreateServiceParams { - params.OutOfSessionCallbackUrl = &OutOfSessionCallbackUrl - return params +func (params *CreateServiceParams) SetOutOfSessionCallbackUrl(OutOfSessionCallbackUrl string) (*CreateServiceParams){ + params.OutOfSessionCallbackUrl = &OutOfSessionCallbackUrl + return params } -func (params *CreateServiceParams) SetChatInstanceSid(ChatInstanceSid string) *CreateServiceParams { - params.ChatInstanceSid = &ChatInstanceSid - return params +func (params *CreateServiceParams) SetChatInstanceSid(ChatInstanceSid string) (*CreateServiceParams){ + params.ChatInstanceSid = &ChatInstanceSid + return params } // Create a new Service for Twilio Proxy func (c *ApiService) CreateService(params *CreateServiceParams) (*ProxyV1Service, error) { - path := "/v1/Services" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DefaultTtl != nil { - data.Set("DefaultTtl", fmt.Sprint(*params.DefaultTtl)) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.GeoMatchLevel != nil { - data.Set("GeoMatchLevel", *params.GeoMatchLevel) - } - if params != nil && params.NumberSelectionBehavior != nil { - data.Set("NumberSelectionBehavior", *params.NumberSelectionBehavior) - } - if params != nil && params.InterceptCallbackUrl != nil { - data.Set("InterceptCallbackUrl", *params.InterceptCallbackUrl) - } - if params != nil && params.OutOfSessionCallbackUrl != nil { - data.Set("OutOfSessionCallbackUrl", *params.OutOfSessionCallbackUrl) - } - if params != nil && params.ChatInstanceSid != nil { - data.Set("ChatInstanceSid", *params.ChatInstanceSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ProxyV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DefaultTtl != nil { + data.Set("DefaultTtl", fmt.Sprint(*params.DefaultTtl)) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.GeoMatchLevel != nil { + data.Set("GeoMatchLevel", *params.GeoMatchLevel) + } + if params != nil && params.NumberSelectionBehavior != nil { + data.Set("NumberSelectionBehavior", *params.NumberSelectionBehavior) + } + if params != nil && params.InterceptCallbackUrl != nil { + data.Set("InterceptCallbackUrl", *params.InterceptCallbackUrl) + } + if params != nil && params.OutOfSessionCallbackUrl != nil { + data.Set("OutOfSessionCallbackUrl", *params.OutOfSessionCallbackUrl) + } + if params != nil && params.ChatInstanceSid != nil { + data.Set("ChatInstanceSid", *params.ChatInstanceSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ProxyV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Service. -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Service. -func (c *ApiService) FetchService(Sid string) (*ProxyV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchService(Sid string, ) (*ProxyV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ProxyV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ProxyV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -252,6 +258,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan ProxyV1Servi return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan ProxyV1Service, errorChannel chan error) { curRecord := 1 @@ -283,120 +290,122 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** - UniqueName *string `json:"UniqueName,omitempty"` - // The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. - DefaultTtl *int `json:"DefaultTtl,omitempty"` - // The URL we should call when the interaction status changes. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // - GeoMatchLevel *string `json:"GeoMatchLevel,omitempty"` - // - NumberSelectionBehavior *string `json:"NumberSelectionBehavior,omitempty"` - // The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. - InterceptCallbackUrl *string `json:"InterceptCallbackUrl,omitempty"` - // The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. - OutOfSessionCallbackUrl *string `json:"OutOfSessionCallbackUrl,omitempty"` - // The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. - ChatInstanceSid *string `json:"ChatInstanceSid,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** + UniqueName *string `json:"UniqueName,omitempty"` + // The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. + DefaultTtl *int `json:"DefaultTtl,omitempty"` + // The URL we should call when the interaction status changes. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // + GeoMatchLevel *string `json:"GeoMatchLevel,omitempty"` + // + NumberSelectionBehavior *string `json:"NumberSelectionBehavior,omitempty"` + // The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. + InterceptCallbackUrl *string `json:"InterceptCallbackUrl,omitempty"` + // The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/en-us/serverless/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. + OutOfSessionCallbackUrl *string `json:"OutOfSessionCallbackUrl,omitempty"` + // The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. + ChatInstanceSid *string `json:"ChatInstanceSid,omitempty"` } -func (params *UpdateServiceParams) SetUniqueName(UniqueName string) *UpdateServiceParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateServiceParams) SetUniqueName(UniqueName string) (*UpdateServiceParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateServiceParams) SetDefaultTtl(DefaultTtl int) *UpdateServiceParams { - params.DefaultTtl = &DefaultTtl - return params +func (params *UpdateServiceParams) SetDefaultTtl(DefaultTtl int) (*UpdateServiceParams){ + params.DefaultTtl = &DefaultTtl + return params } -func (params *UpdateServiceParams) SetCallbackUrl(CallbackUrl string) *UpdateServiceParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *UpdateServiceParams) SetCallbackUrl(CallbackUrl string) (*UpdateServiceParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *UpdateServiceParams) SetGeoMatchLevel(GeoMatchLevel string) *UpdateServiceParams { - params.GeoMatchLevel = &GeoMatchLevel - return params +func (params *UpdateServiceParams) SetGeoMatchLevel(GeoMatchLevel string) (*UpdateServiceParams){ + params.GeoMatchLevel = &GeoMatchLevel + return params } -func (params *UpdateServiceParams) SetNumberSelectionBehavior(NumberSelectionBehavior string) *UpdateServiceParams { - params.NumberSelectionBehavior = &NumberSelectionBehavior - return params +func (params *UpdateServiceParams) SetNumberSelectionBehavior(NumberSelectionBehavior string) (*UpdateServiceParams){ + params.NumberSelectionBehavior = &NumberSelectionBehavior + return params } -func (params *UpdateServiceParams) SetInterceptCallbackUrl(InterceptCallbackUrl string) *UpdateServiceParams { - params.InterceptCallbackUrl = &InterceptCallbackUrl - return params +func (params *UpdateServiceParams) SetInterceptCallbackUrl(InterceptCallbackUrl string) (*UpdateServiceParams){ + params.InterceptCallbackUrl = &InterceptCallbackUrl + return params } -func (params *UpdateServiceParams) SetOutOfSessionCallbackUrl(OutOfSessionCallbackUrl string) *UpdateServiceParams { - params.OutOfSessionCallbackUrl = &OutOfSessionCallbackUrl - return params +func (params *UpdateServiceParams) SetOutOfSessionCallbackUrl(OutOfSessionCallbackUrl string) (*UpdateServiceParams){ + params.OutOfSessionCallbackUrl = &OutOfSessionCallbackUrl + return params } -func (params *UpdateServiceParams) SetChatInstanceSid(ChatInstanceSid string) *UpdateServiceParams { - params.ChatInstanceSid = &ChatInstanceSid - return params +func (params *UpdateServiceParams) SetChatInstanceSid(ChatInstanceSid string) (*UpdateServiceParams){ + params.ChatInstanceSid = &ChatInstanceSid + return params } // Update a specific Service. func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*ProxyV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DefaultTtl != nil { - data.Set("DefaultTtl", fmt.Sprint(*params.DefaultTtl)) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.GeoMatchLevel != nil { - data.Set("GeoMatchLevel", *params.GeoMatchLevel) - } - if params != nil && params.NumberSelectionBehavior != nil { - data.Set("NumberSelectionBehavior", *params.NumberSelectionBehavior) - } - if params != nil && params.InterceptCallbackUrl != nil { - data.Set("InterceptCallbackUrl", *params.InterceptCallbackUrl) - } - if params != nil && params.OutOfSessionCallbackUrl != nil { - data.Set("OutOfSessionCallbackUrl", *params.OutOfSessionCallbackUrl) - } - if params != nil && params.ChatInstanceSid != nil { - data.Set("ChatInstanceSid", *params.ChatInstanceSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ProxyV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DefaultTtl != nil { + data.Set("DefaultTtl", fmt.Sprint(*params.DefaultTtl)) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.GeoMatchLevel != nil { + data.Set("GeoMatchLevel", *params.GeoMatchLevel) + } + if params != nil && params.NumberSelectionBehavior != nil { + data.Set("NumberSelectionBehavior", *params.NumberSelectionBehavior) + } + if params != nil && params.InterceptCallbackUrl != nil { + data.Set("InterceptCallbackUrl", *params.InterceptCallbackUrl) + } + if params != nil && params.OutOfSessionCallbackUrl != nil { + data.Set("OutOfSessionCallbackUrl", *params.OutOfSessionCallbackUrl) + } + if params != nil && params.ChatInstanceSid != nil { + data.Set("ChatInstanceSid", *params.ChatInstanceSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ProxyV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/proxy/v1/services_phone_numbers.go b/rest/proxy/v1/services_phone_numbers.go index be0ae2d89..98e24dc59 100644 --- a/rest/proxy/v1/services_phone_numbers.go +++ b/rest/proxy/v1/services_phone_numbers.go @@ -18,160 +18,165 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePhoneNumber' type CreatePhoneNumberParams struct { - // The SID of a Twilio [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the Twilio Number you would like to assign to your Proxy Service. - Sid *string `json:"Sid,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. - PhoneNumber *string `json:"PhoneNumber,omitempty"` - // Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. - IsReserved *bool `json:"IsReserved,omitempty"` + // The SID of a Twilio [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the Twilio Number you would like to assign to your Proxy Service. + Sid *string `json:"Sid,omitempty"` + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. + PhoneNumber *string `json:"PhoneNumber,omitempty"` + // Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + IsReserved *bool `json:"IsReserved,omitempty"` } -func (params *CreatePhoneNumberParams) SetSid(Sid string) *CreatePhoneNumberParams { - params.Sid = &Sid - return params +func (params *CreatePhoneNumberParams) SetSid(Sid string) (*CreatePhoneNumberParams){ + params.Sid = &Sid + return params } -func (params *CreatePhoneNumberParams) SetPhoneNumber(PhoneNumber string) *CreatePhoneNumberParams { - params.PhoneNumber = &PhoneNumber - return params +func (params *CreatePhoneNumberParams) SetPhoneNumber(PhoneNumber string) (*CreatePhoneNumberParams){ + params.PhoneNumber = &PhoneNumber + return params } -func (params *CreatePhoneNumberParams) SetIsReserved(IsReserved bool) *CreatePhoneNumberParams { - params.IsReserved = &IsReserved - return params +func (params *CreatePhoneNumberParams) SetIsReserved(IsReserved bool) (*CreatePhoneNumberParams){ + params.IsReserved = &IsReserved + return params } // Add a Phone Number to a Service's Proxy Number Pool. func (c *ApiService) CreatePhoneNumber(ServiceSid string, params *CreatePhoneNumberParams) (*ProxyV1PhoneNumber, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/PhoneNumbers" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Sid != nil { - data.Set("Sid", *params.Sid) - } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - if params != nil && params.IsReserved != nil { - data.Set("IsReserved", fmt.Sprint(*params.IsReserved)) - } + if params != nil && params.Sid != nil { + data.Set("Sid", *params.Sid) + } + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } + if params != nil && params.IsReserved != nil { + data.Set("IsReserved", fmt.Sprint(*params.IsReserved)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ProxyV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ProxyV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Phone Number from a Service. -func (c *ApiService) DeletePhoneNumber(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeletePhoneNumber(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Phone Number. -func (c *ApiService) FetchPhoneNumber(ServiceSid string, Sid string) (*ProxyV1PhoneNumber, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchPhoneNumber(ServiceSid string, Sid string, ) (*ProxyV1PhoneNumber, error) { + path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ProxyV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ProxyV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListPhoneNumber' type ListPhoneNumberParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListPhoneNumberParams) SetPageSize(PageSize int) *ListPhoneNumberParams { - params.PageSize = &PageSize - return params +func (params *ListPhoneNumberParams) SetPageSize(PageSize int) (*ListPhoneNumberParams){ + params.PageSize = &PageSize + return params } -func (params *ListPhoneNumberParams) SetLimit(Limit int) *ListPhoneNumberParams { - params.Limit = &Limit - return params +func (params *ListPhoneNumberParams) SetLimit(Limit int) (*ListPhoneNumberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of PhoneNumber records from the API. Request is executed immediately. func (c *ApiService) PagePhoneNumber(ServiceSid string, params *ListPhoneNumberParams, pageToken, pageNumber string) (*ListPhoneNumberResponse, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers" + path := "/v1/Services/{ServiceSid}/PhoneNumbers" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListPhoneNumberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists PhoneNumber records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -212,6 +217,7 @@ func (c *ApiService) StreamPhoneNumber(ServiceSid string, params *ListPhoneNumbe return recordChannel, errorChannel } + func (c *ApiService) streamPhoneNumber(response *ListPhoneNumberResponse, params *ListPhoneNumberParams, recordChannel chan ProxyV1PhoneNumber, errorChannel chan error) { curRecord := 1 @@ -243,58 +249,60 @@ func (c *ApiService) streamPhoneNumber(response *ListPhoneNumberResponse, params } func (c *ApiService) getNextListPhoneNumberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPhoneNumberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdatePhoneNumber' type UpdatePhoneNumberParams struct { - // Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. - IsReserved *bool `json:"IsReserved,omitempty"` + // Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + IsReserved *bool `json:"IsReserved,omitempty"` } -func (params *UpdatePhoneNumberParams) SetIsReserved(IsReserved bool) *UpdatePhoneNumberParams { - params.IsReserved = &IsReserved - return params +func (params *UpdatePhoneNumberParams) SetIsReserved(IsReserved bool) (*UpdatePhoneNumberParams){ + params.IsReserved = &IsReserved + return params } // Update a specific Proxy Number. func (c *ApiService) UpdatePhoneNumber(ServiceSid string, Sid string, params *UpdatePhoneNumberParams) (*ProxyV1PhoneNumber, error) { - path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IsReserved != nil { - data.Set("IsReserved", fmt.Sprint(*params.IsReserved)) - } + if params != nil && params.IsReserved != nil { + data.Set("IsReserved", fmt.Sprint(*params.IsReserved)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ProxyV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ProxyV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/proxy/v1/services_sessions.go b/rest/proxy/v1/services_sessions.go index 6b1cff4d7..2024fc33b 100644 --- a/rest/proxy/v1/services_sessions.go +++ b/rest/proxy/v1/services_sessions.go @@ -18,196 +18,200 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSession' type CreateSessionParams struct { - // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** - UniqueName *string `json:"UniqueName,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. - DateExpiry *time.Time `json:"DateExpiry,omitempty"` - // The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. - Ttl *int `json:"Ttl,omitempty"` - // - Mode *string `json:"Mode,omitempty"` - // - Status *string `json:"Status,omitempty"` - // The Participant objects to include in the new session. - Participants *[]interface{} `json:"Participants,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** + UniqueName *string `json:"UniqueName,omitempty"` + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. + DateExpiry *time.Time `json:"DateExpiry,omitempty"` + // The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. + Ttl *int `json:"Ttl,omitempty"` + // + Mode *string `json:"Mode,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The Participant objects to include in the new session. + Participants *[]interface{} `json:"Participants,omitempty"` } -func (params *CreateSessionParams) SetUniqueName(UniqueName string) *CreateSessionParams { - params.UniqueName = &UniqueName - return params +func (params *CreateSessionParams) SetUniqueName(UniqueName string) (*CreateSessionParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateSessionParams) SetDateExpiry(DateExpiry time.Time) *CreateSessionParams { - params.DateExpiry = &DateExpiry - return params +func (params *CreateSessionParams) SetDateExpiry(DateExpiry time.Time) (*CreateSessionParams){ + params.DateExpiry = &DateExpiry + return params } -func (params *CreateSessionParams) SetTtl(Ttl int) *CreateSessionParams { - params.Ttl = &Ttl - return params +func (params *CreateSessionParams) SetTtl(Ttl int) (*CreateSessionParams){ + params.Ttl = &Ttl + return params } -func (params *CreateSessionParams) SetMode(Mode string) *CreateSessionParams { - params.Mode = &Mode - return params +func (params *CreateSessionParams) SetMode(Mode string) (*CreateSessionParams){ + params.Mode = &Mode + return params } -func (params *CreateSessionParams) SetStatus(Status string) *CreateSessionParams { - params.Status = &Status - return params +func (params *CreateSessionParams) SetStatus(Status string) (*CreateSessionParams){ + params.Status = &Status + return params } -func (params *CreateSessionParams) SetParticipants(Participants []interface{}) *CreateSessionParams { - params.Participants = &Participants - return params +func (params *CreateSessionParams) SetParticipants(Participants []interface{}) (*CreateSessionParams){ + params.Participants = &Participants + return params } // Create a new Session func (c *ApiService) CreateSession(ServiceSid string, params *CreateSessionParams) (*ProxyV1Session, error) { - path := "/v1/Services/{ServiceSid}/Sessions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Sessions" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DateExpiry != nil { + data.Set("DateExpiry", fmt.Sprint((*params.DateExpiry).Format(time.RFC3339))) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.Mode != nil { + data.Set("Mode", *params.Mode) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Participants != nil { + for _, item := range *params.Participants { + v, err := json.Marshal(item) + + if err != nil { + return nil, err + } + + data.Add("Participants", string(v)) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ProxyV1Session{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// Delete a specific Session. +func (c *ApiService) DeleteSession(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Sessions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DateExpiry != nil { - data.Set("DateExpiry", fmt.Sprint((*params.DateExpiry).Format(time.RFC3339))) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.Mode != nil { - data.Set("Mode", *params.Mode) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Participants != nil { - for _, item := range *params.Participants { - v, err := json.Marshal(item) + data := url.Values{} + headers := make(map[string]interface{}) - if err != nil { - return nil, err - } - data.Add("Participants", string(v)) - } - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ProxyV1Session{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return nil } -// Delete a specific Session. -func (c *ApiService) DeleteSession(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Sessions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() +// Fetch a specific Session. +func (c *ApiService) FetchSession(ServiceSid string, Sid string, ) (*ProxyV1Session, error) { + path := "/v1/Services/{ServiceSid}/Sessions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// Fetch a specific Session. -func (c *ApiService) FetchSession(ServiceSid string, Sid string) (*ProxyV1Session, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ProxyV1Session{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ProxyV1Session{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSession' type ListSessionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSessionParams) SetPageSize(PageSize int) *ListSessionParams { - params.PageSize = &PageSize - return params +func (params *ListSessionParams) SetPageSize(PageSize int) (*ListSessionParams){ + params.PageSize = &PageSize + return params } -func (params *ListSessionParams) SetLimit(Limit int) *ListSessionParams { - params.Limit = &Limit - return params +func (params *ListSessionParams) SetLimit(Limit int) (*ListSessionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Session records from the API. Request is executed immediately. func (c *ApiService) PageSession(ServiceSid string, params *ListSessionParams, pageToken, pageNumber string) (*ListSessionResponse, error) { - path := "/v1/Services/{ServiceSid}/Sessions" + path := "/v1/Services/{ServiceSid}/Sessions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSessionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSessionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Session records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -248,6 +252,7 @@ func (c *ApiService) StreamSession(ServiceSid string, params *ListSessionParams) return recordChannel, errorChannel } + func (c *ApiService) streamSession(response *ListSessionResponse, params *ListSessionParams, recordChannel chan ProxyV1Session, errorChannel chan error) { curRecord := 1 @@ -279,76 +284,78 @@ func (c *ApiService) streamSession(response *ListSessionResponse, params *ListSe } func (c *ApiService) getNextListSessionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSessionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSessionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSession' type UpdateSessionParams struct { - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. - DateExpiry *time.Time `json:"DateExpiry,omitempty"` - // The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. - Ttl *int `json:"Ttl,omitempty"` - // - Status *string `json:"Status,omitempty"` + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. + DateExpiry *time.Time `json:"DateExpiry,omitempty"` + // The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. + Ttl *int `json:"Ttl,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateSessionParams) SetDateExpiry(DateExpiry time.Time) *UpdateSessionParams { - params.DateExpiry = &DateExpiry - return params +func (params *UpdateSessionParams) SetDateExpiry(DateExpiry time.Time) (*UpdateSessionParams){ + params.DateExpiry = &DateExpiry + return params } -func (params *UpdateSessionParams) SetTtl(Ttl int) *UpdateSessionParams { - params.Ttl = &Ttl - return params +func (params *UpdateSessionParams) SetTtl(Ttl int) (*UpdateSessionParams){ + params.Ttl = &Ttl + return params } -func (params *UpdateSessionParams) SetStatus(Status string) *UpdateSessionParams { - params.Status = &Status - return params +func (params *UpdateSessionParams) SetStatus(Status string) (*UpdateSessionParams){ + params.Status = &Status + return params } // Update a specific Session. func (c *ApiService) UpdateSession(ServiceSid string, Sid string, params *UpdateSessionParams) (*ProxyV1Session, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Sessions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.DateExpiry != nil { - data.Set("DateExpiry", fmt.Sprint((*params.DateExpiry).Format(time.RFC3339))) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.DateExpiry != nil { + data.Set("DateExpiry", fmt.Sprint((*params.DateExpiry).Format(time.RFC3339))) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ProxyV1Session{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ProxyV1Session{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/proxy/v1/services_sessions_interactions.go b/rest/proxy/v1/services_sessions_interactions.go index 106d43666..088125a25 100644 --- a/rest/proxy/v1/services_sessions_interactions.go +++ b/rest/proxy/v1/services_sessions_interactions.go @@ -18,107 +18,111 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific Interaction. -func (c *ApiService) DeleteInteraction(ServiceSid string, SessionSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteInteraction(ServiceSid string, SessionSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a list of Interactions for a given [Session](https://www.twilio.com/docs/proxy/api/session). -func (c *ApiService) FetchInteraction(ServiceSid string, SessionSid string, Sid string) (*ProxyV1Interaction, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchInteraction(ServiceSid string, SessionSid string, Sid string, ) (*ProxyV1Interaction, error) { + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ProxyV1Interaction{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ProxyV1Interaction{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListInteraction' type ListInteractionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListInteractionParams) SetPageSize(PageSize int) *ListInteractionParams { - params.PageSize = &PageSize - return params +func (params *ListInteractionParams) SetPageSize(PageSize int) (*ListInteractionParams){ + params.PageSize = &PageSize + return params } -func (params *ListInteractionParams) SetLimit(Limit int) *ListInteractionParams { - params.Limit = &Limit - return params +func (params *ListInteractionParams) SetLimit(Limit int) (*ListInteractionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Interaction records from the API. Request is executed immediately. func (c *ApiService) PageInteraction(ServiceSid string, SessionSid string, params *ListInteractionParams, pageToken, pageNumber string) (*ListInteractionResponse, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions" + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Interactions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListInteractionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListInteractionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Interaction records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -159,6 +163,7 @@ func (c *ApiService) StreamInteraction(ServiceSid string, SessionSid string, par return recordChannel, errorChannel } + func (c *ApiService) streamInteraction(response *ListInteractionResponse, params *ListInteractionParams, recordChannel chan ProxyV1Interaction, errorChannel chan error) { curRecord := 1 @@ -190,19 +195,20 @@ func (c *ApiService) streamInteraction(response *ListInteractionResponse, params } func (c *ApiService) getNextListInteractionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListInteractionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListInteractionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/proxy/v1/services_sessions_participants.go b/rest/proxy/v1/services_sessions_participants.go index dd9262e19..2b68eb4b0 100644 --- a/rest/proxy/v1/services_sessions_participants.go +++ b/rest/proxy/v1/services_sessions_participants.go @@ -18,173 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateParticipant' type CreateParticipantParams struct { - // The phone number of the Participant. - Identifier *string `json:"Identifier,omitempty"` - // The string that you assigned to describe the participant. This value must be 255 characters or fewer. **This value should not have PII.** - FriendlyName *string `json:"FriendlyName,omitempty"` - // The proxy phone number to use for the Participant. If not specified, Proxy will select a number from the pool. - ProxyIdentifier *string `json:"ProxyIdentifier,omitempty"` - // The SID of the Proxy Identifier to assign to the Participant. - ProxyIdentifierSid *string `json:"ProxyIdentifierSid,omitempty"` + // The phone number of the Participant. + Identifier *string `json:"Identifier,omitempty"` + // The string that you assigned to describe the participant. This value must be 255 characters or fewer. **This value should not have PII.** + FriendlyName *string `json:"FriendlyName,omitempty"` + // The proxy phone number to use for the Participant. If not specified, Proxy will select a number from the pool. + ProxyIdentifier *string `json:"ProxyIdentifier,omitempty"` + // The SID of the Proxy Identifier to assign to the Participant. + ProxyIdentifierSid *string `json:"ProxyIdentifierSid,omitempty"` } -func (params *CreateParticipantParams) SetIdentifier(Identifier string) *CreateParticipantParams { - params.Identifier = &Identifier - return params +func (params *CreateParticipantParams) SetIdentifier(Identifier string) (*CreateParticipantParams){ + params.Identifier = &Identifier + return params } -func (params *CreateParticipantParams) SetFriendlyName(FriendlyName string) *CreateParticipantParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateParticipantParams) SetFriendlyName(FriendlyName string) (*CreateParticipantParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateParticipantParams) SetProxyIdentifier(ProxyIdentifier string) *CreateParticipantParams { - params.ProxyIdentifier = &ProxyIdentifier - return params +func (params *CreateParticipantParams) SetProxyIdentifier(ProxyIdentifier string) (*CreateParticipantParams){ + params.ProxyIdentifier = &ProxyIdentifier + return params } -func (params *CreateParticipantParams) SetProxyIdentifierSid(ProxyIdentifierSid string) *CreateParticipantParams { - params.ProxyIdentifierSid = &ProxyIdentifierSid - return params +func (params *CreateParticipantParams) SetProxyIdentifierSid(ProxyIdentifierSid string) (*CreateParticipantParams){ + params.ProxyIdentifierSid = &ProxyIdentifierSid + return params } // Add a new Participant to the Session func (c *ApiService) CreateParticipant(ServiceSid string, SessionSid string, params *CreateParticipantParams) (*ProxyV1Participant, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identifier != nil { - data.Set("Identifier", *params.Identifier) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ProxyIdentifier != nil { - data.Set("ProxyIdentifier", *params.ProxyIdentifier) - } - if params != nil && params.ProxyIdentifierSid != nil { - data.Set("ProxyIdentifierSid", *params.ProxyIdentifierSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ProxyV1Participant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identifier != nil { + data.Set("Identifier", *params.Identifier) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ProxyIdentifier != nil { + data.Set("ProxyIdentifier", *params.ProxyIdentifier) + } + if params != nil && params.ProxyIdentifierSid != nil { + data.Set("ProxyIdentifierSid", *params.ProxyIdentifierSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ProxyV1Participant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Participant. This is a soft-delete. The participant remains associated with the session and cannot be re-added. Participants are only permanently deleted when the [Session](https://www.twilio.com/docs/proxy/api/session) is deleted. -func (c *ApiService) DeleteParticipant(ServiceSid string, SessionSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteParticipant(ServiceSid string, SessionSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Participant. -func (c *ApiService) FetchParticipant(ServiceSid string, SessionSid string, Sid string) (*ProxyV1Participant, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchParticipant(ServiceSid string, SessionSid string, Sid string, ) (*ProxyV1Participant, error) { + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ProxyV1Participant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ProxyV1Participant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListParticipant' type ListParticipantParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListParticipantParams) SetPageSize(PageSize int) *ListParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListParticipantParams) SetPageSize(PageSize int) (*ListParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListParticipantParams) SetLimit(Limit int) *ListParticipantParams { - params.Limit = &Limit - return params +func (params *ListParticipantParams) SetLimit(Limit int) (*ListParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Participant records from the API. Request is executed immediately. func (c *ApiService) PageParticipant(ServiceSid string, SessionSid string, params *ListParticipantParams, pageToken, pageNumber string) (*ListParticipantResponse, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants" + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Participant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +230,7 @@ func (c *ApiService) StreamParticipant(ServiceSid string, SessionSid string, par return recordChannel, errorChannel } + func (c *ApiService) streamParticipant(response *ListParticipantResponse, params *ListParticipantParams, recordChannel chan ProxyV1Participant, errorChannel chan error) { curRecord := 1 @@ -256,19 +262,20 @@ func (c *ApiService) streamParticipant(response *ListParticipantResponse, params } func (c *ApiService) getNextListParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/proxy/v1/services_sessions_participants_message_interactions.go b/rest/proxy/v1/services_sessions_participants_message_interactions.go index e942021e0..9c94b7cfe 100644 --- a/rest/proxy/v1/services_sessions_participants_message_interactions.go +++ b/rest/proxy/v1/services_sessions_participants_message_interactions.go @@ -18,140 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessageInteraction' type CreateMessageInteractionParams struct { - // The message to send to the participant - Body *string `json:"Body,omitempty"` - // Reserved. Not currently supported. - MediaUrl *[]string `json:"MediaUrl,omitempty"` + // The message to send to the participant + Body *string `json:"Body,omitempty"` + // Reserved. Not currently supported. + MediaUrl *[]string `json:"MediaUrl,omitempty"` } -func (params *CreateMessageInteractionParams) SetBody(Body string) *CreateMessageInteractionParams { - params.Body = &Body - return params +func (params *CreateMessageInteractionParams) SetBody(Body string) (*CreateMessageInteractionParams){ + params.Body = &Body + return params } -func (params *CreateMessageInteractionParams) SetMediaUrl(MediaUrl []string) *CreateMessageInteractionParams { - params.MediaUrl = &MediaUrl - return params +func (params *CreateMessageInteractionParams) SetMediaUrl(MediaUrl []string) (*CreateMessageInteractionParams){ + params.MediaUrl = &MediaUrl + return params } // Create a new message Interaction to send directly from your system to one [Participant](https://www.twilio.com/docs/proxy/api/participant). The `inbound` properties for the Interaction will always be empty. func (c *ApiService) CreateMessageInteraction(ServiceSid string, SessionSid string, ParticipantSid string, params *CreateMessageInteractionParams) (*ProxyV1MessageInteraction, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{ParticipantSid}/MessageInteractions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{ParticipantSid}/MessageInteractions" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Body != nil { - data.Set("Body", *params.Body) - } - if params != nil && params.MediaUrl != nil { - for _, item := range *params.MediaUrl { - data.Add("MediaUrl", item) - } - } + if params != nil && params.Body != nil { + data.Set("Body", *params.Body) + } + if params != nil && params.MediaUrl != nil { + for _, item := range *params.MediaUrl { + data.Add("MediaUrl", item) + } + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ProxyV1MessageInteraction{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ProxyV1MessageInteraction{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) FetchMessageInteraction(ServiceSid string, SessionSid string, ParticipantSid string, Sid string) (*ProxyV1MessageInteraction, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{ParticipantSid}/MessageInteractions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchMessageInteraction(ServiceSid string, SessionSid string, ParticipantSid string, Sid string, ) (*ProxyV1MessageInteraction, error) { + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{ParticipantSid}/MessageInteractions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ProxyV1MessageInteraction{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ProxyV1MessageInteraction{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMessageInteraction' type ListMessageInteractionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessageInteractionParams) SetPageSize(PageSize int) *ListMessageInteractionParams { - params.PageSize = &PageSize - return params +func (params *ListMessageInteractionParams) SetPageSize(PageSize int) (*ListMessageInteractionParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessageInteractionParams) SetLimit(Limit int) *ListMessageInteractionParams { - params.Limit = &Limit - return params +func (params *ListMessageInteractionParams) SetLimit(Limit int) (*ListMessageInteractionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of MessageInteraction records from the API. Request is executed immediately. func (c *ApiService) PageMessageInteraction(ServiceSid string, SessionSid string, ParticipantSid string, params *ListMessageInteractionParams, pageToken, pageNumber string) (*ListMessageInteractionResponse, error) { - path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{ParticipantSid}/MessageInteractions" + path := "/v1/Services/{ServiceSid}/Sessions/{SessionSid}/Participants/{ParticipantSid}/MessageInteractions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"SessionSid"+"}", SessionSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessageInteractionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessageInteractionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists MessageInteraction records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -192,6 +195,7 @@ func (c *ApiService) StreamMessageInteraction(ServiceSid string, SessionSid stri return recordChannel, errorChannel } + func (c *ApiService) streamMessageInteraction(response *ListMessageInteractionResponse, params *ListMessageInteractionParams, recordChannel chan ProxyV1MessageInteraction, errorChannel chan error) { curRecord := 1 @@ -223,19 +227,20 @@ func (c *ApiService) streamMessageInteraction(response *ListMessageInteractionRe } func (c *ApiService) getNextListMessageInteractionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMessageInteractionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMessageInteractionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/proxy/v1/services_short_codes.go b/rest/proxy/v1/services_short_codes.go index 34c743506..bf6038702 100644 --- a/rest/proxy/v1/services_short_codes.go +++ b/rest/proxy/v1/services_short_codes.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateShortCode' type CreateShortCodeParams struct { - // The SID of a Twilio [ShortCode](https://www.twilio.com/docs/sms/api/short-code) resource that represents the short code you would like to assign to your Proxy Service. - Sid *string `json:"Sid,omitempty"` + // The SID of a Twilio [ShortCode](https://www.twilio.com/docs/sms/api/short-code) resource that represents the short code you would like to assign to your Proxy Service. + Sid *string `json:"Sid,omitempty"` } -func (params *CreateShortCodeParams) SetSid(Sid string) *CreateShortCodeParams { - params.Sid = &Sid - return params +func (params *CreateShortCodeParams) SetSid(Sid string) (*CreateShortCodeParams){ + params.Sid = &Sid + return params } // Add a Short Code to the Proxy Number Pool for the Service. func (c *ApiService) CreateShortCode(ServiceSid string, params *CreateShortCodeParams) (*ProxyV1ShortCode, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/ShortCodes" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Sid != nil { - data.Set("Sid", *params.Sid) - } + if params != nil && params.Sid != nil { + data.Set("Sid", *params.Sid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ProxyV1ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ProxyV1ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Short Code from a Service. -func (c *ApiService) DeleteShortCode(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteShortCode(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific Short Code. -func (c *ApiService) FetchShortCode(ServiceSid string, Sid string) (*ProxyV1ShortCode, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchShortCode(ServiceSid string, Sid string, ) (*ProxyV1ShortCode, error) { + path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ProxyV1ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ProxyV1ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListShortCode' type ListShortCodeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListShortCodeParams) SetPageSize(PageSize int) *ListShortCodeParams { - params.PageSize = &PageSize - return params +func (params *ListShortCodeParams) SetPageSize(PageSize int) (*ListShortCodeParams){ + params.PageSize = &PageSize + return params } -func (params *ListShortCodeParams) SetLimit(Limit int) *ListShortCodeParams { - params.Limit = &Limit - return params +func (params *ListShortCodeParams) SetLimit(Limit int) (*ListShortCodeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ShortCode records from the API. Request is executed immediately. func (c *ApiService) PageShortCode(ServiceSid string, params *ListShortCodeParams, pageToken, pageNumber string) (*ListShortCodeResponse, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes" + path := "/v1/Services/{ServiceSid}/ShortCodes" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListShortCodeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListShortCodeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ShortCode records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamShortCode(ServiceSid string, params *ListShortCodePar return recordChannel, errorChannel } + func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *ListShortCodeParams, recordChannel chan ProxyV1ShortCode, errorChannel chan error) { curRecord := 1 @@ -225,58 +231,60 @@ func (c *ApiService) streamShortCode(response *ListShortCodeResponse, params *Li } func (c *ApiService) getNextListShortCodeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListShortCodeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListShortCodeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateShortCode' type UpdateShortCodeParams struct { - // Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. - IsReserved *bool `json:"IsReserved,omitempty"` + // Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + IsReserved *bool `json:"IsReserved,omitempty"` } -func (params *UpdateShortCodeParams) SetIsReserved(IsReserved bool) *UpdateShortCodeParams { - params.IsReserved = &IsReserved - return params +func (params *UpdateShortCodeParams) SetIsReserved(IsReserved bool) (*UpdateShortCodeParams){ + params.IsReserved = &IsReserved + return params } // Update a specific Short Code. func (c *ApiService) UpdateShortCode(ServiceSid string, Sid string, params *UpdateShortCodeParams) (*ProxyV1ShortCode, error) { - path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/ShortCodes/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IsReserved != nil { - data.Set("IsReserved", fmt.Sprint(*params.IsReserved)) - } + if params != nil && params.IsReserved != nil { + data.Set("IsReserved", fmt.Sprint(*params.IsReserved)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ProxyV1ShortCode{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ProxyV1ShortCode{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/routes/v2/README.md b/rest/routes/v2/README.md index 5b03d7f65..549c32cdf 100644 --- a/rest/routes/v2/README.md +++ b/rest/routes/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/routes/v2/api_service.go b/rest/routes/v2/api_service.go index c563e84c9..291c356bf 100644 --- a/rest/routes/v2/api_service.go +++ b/rest/routes/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://routes.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/routes/v2/model_routes_v2_phone_number.go b/rest/routes/v2/model_routes_v2_phone_number.go index fe3547506..7a3e4e276 100644 --- a/rest/routes/v2/model_routes_v2_phone_number.go +++ b/rest/routes/v2/model_routes_v2_phone_number.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // RoutesV2PhoneNumber struct for RoutesV2PhoneNumber type RoutesV2PhoneNumber struct { - // The phone number in E.164 format + // The phone number in E.164 format PhoneNumber *string `json:"phone_number,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // A 34 character string that uniquely identifies the Inbound Processing Region assignments for this phone number. + // A 34 character string that uniquely identifies the Inbound Processing Region assignments for this phone number. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters. + // A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // The Inbound Processing Region used for this phone number for voice. + // The Inbound Processing Region used for this phone number for voice. VoiceRegion *string `json:"voice_region,omitempty"` - // The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format. + // The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format. + // The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/routes/v2/model_routes_v2_sip_domain.go b/rest/routes/v2/model_routes_v2_sip_domain.go index 17b35300a..02bba747d 100644 --- a/rest/routes/v2/model_routes_v2_sip_domain.go +++ b/rest/routes/v2/model_routes_v2_sip_domain.go @@ -13,19 +13,21 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // RoutesV2SipDomain struct for RoutesV2SipDomain type RoutesV2SipDomain struct { - SipDomain *string `json:"sip_domain,omitempty"` - Url *string `json:"url,omitempty"` - Sid *string `json:"sid,omitempty"` - AccountSid *string `json:"account_sid,omitempty"` - FriendlyName *string `json:"friendly_name,omitempty"` - VoiceRegion *string `json:"voice_region,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - DateUpdated *time.Time `json:"date_updated,omitempty"` + SipDomain *string `json:"sip_domain,omitempty"` + Url *string `json:"url,omitempty"` + Sid *string `json:"sid,omitempty"` + AccountSid *string `json:"account_sid,omitempty"` + FriendlyName *string `json:"friendly_name,omitempty"` + VoiceRegion *string `json:"voice_region,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/routes/v2/model_routes_v2_trunks.go b/rest/routes/v2/model_routes_v2_trunks.go index 39409e1c6..7efed02fa 100644 --- a/rest/routes/v2/model_routes_v2_trunks.go +++ b/rest/routes/v2/model_routes_v2_trunks.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // RoutesV2Trunks struct for RoutesV2Trunks type RoutesV2Trunks struct { - // The absolute URL of the SIP Trunk + // The absolute URL of the SIP Trunk SipTrunkDomain *string `json:"sip_trunk_domain,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk. + // A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters. + // A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // The Inbound Processing Region used for this SIP Trunk for voice. + // The Inbound Processing Region used for this SIP Trunk for voice. VoiceRegion *string `json:"voice_region,omitempty"` - // The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format. + // The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format. + // The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/routes/v2/phone_numbers.go b/rest/routes/v2/phone_numbers.go index 7614b6d2a..44cded2d1 100644 --- a/rest/routes/v2/phone_numbers.go +++ b/rest/routes/v2/phone_numbers.go @@ -16,76 +16,82 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch the Inbound Processing Region assigned to a phone number. -func (c *ApiService) FetchPhoneNumber(PhoneNumber string) (*RoutesV2PhoneNumber, error) { - path := "/v2/PhoneNumbers/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) +func (c *ApiService) FetchPhoneNumber(PhoneNumber string, ) (*RoutesV2PhoneNumber, error) { + path := "/v2/PhoneNumbers/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &RoutesV2PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &RoutesV2PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdatePhoneNumber' type UpdatePhoneNumberParams struct { - // The Inbound Processing Region used for this phone number for voice - VoiceRegion *string `json:"VoiceRegion,omitempty"` - // A human readable description of this resource, up to 64 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The Inbound Processing Region used for this phone number for voice + VoiceRegion *string `json:"VoiceRegion,omitempty"` + // A human readable description of this resource, up to 64 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdatePhoneNumberParams) SetVoiceRegion(VoiceRegion string) *UpdatePhoneNumberParams { - params.VoiceRegion = &VoiceRegion - return params +func (params *UpdatePhoneNumberParams) SetVoiceRegion(VoiceRegion string) (*UpdatePhoneNumberParams){ + params.VoiceRegion = &VoiceRegion + return params } -func (params *UpdatePhoneNumberParams) SetFriendlyName(FriendlyName string) *UpdatePhoneNumberParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdatePhoneNumberParams) SetFriendlyName(FriendlyName string) (*UpdatePhoneNumberParams){ + params.FriendlyName = &FriendlyName + return params } // Assign an Inbound Processing Region to a phone number. func (c *ApiService) UpdatePhoneNumber(PhoneNumber string, params *UpdatePhoneNumberParams) (*RoutesV2PhoneNumber, error) { - path := "/v2/PhoneNumbers/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + path := "/v2/PhoneNumbers/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.VoiceRegion != nil { + data.Set("VoiceRegion", *params.VoiceRegion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.VoiceRegion != nil { - data.Set("VoiceRegion", *params.VoiceRegion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &RoutesV2PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &RoutesV2PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/routes/v2/sip_domains.go b/rest/routes/v2/sip_domains.go index bdaa766ef..71228dc08 100644 --- a/rest/routes/v2/sip_domains.go +++ b/rest/routes/v2/sip_domains.go @@ -16,76 +16,82 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchSipDomain(SipDomain string) (*RoutesV2SipDomain, error) { - path := "/v2/SipDomains/{SipDomain}" - path = strings.Replace(path, "{"+"SipDomain"+"}", SipDomain, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchSipDomain(SipDomain string, ) (*RoutesV2SipDomain, error) { + path := "/v2/SipDomains/{SipDomain}" + path = strings.Replace(path, "{"+"SipDomain"+"}", SipDomain, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &RoutesV2SipDomain{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &RoutesV2SipDomain{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateSipDomain' type UpdateSipDomainParams struct { - // - VoiceRegion *string `json:"VoiceRegion,omitempty"` - // - FriendlyName *string `json:"FriendlyName,omitempty"` + // + VoiceRegion *string `json:"VoiceRegion,omitempty"` + // + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateSipDomainParams) SetVoiceRegion(VoiceRegion string) *UpdateSipDomainParams { - params.VoiceRegion = &VoiceRegion - return params +func (params *UpdateSipDomainParams) SetVoiceRegion(VoiceRegion string) (*UpdateSipDomainParams){ + params.VoiceRegion = &VoiceRegion + return params } -func (params *UpdateSipDomainParams) SetFriendlyName(FriendlyName string) *UpdateSipDomainParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSipDomainParams) SetFriendlyName(FriendlyName string) (*UpdateSipDomainParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateSipDomain(SipDomain string, params *UpdateSipDomainParams) (*RoutesV2SipDomain, error) { - path := "/v2/SipDomains/{SipDomain}" - path = strings.Replace(path, "{"+"SipDomain"+"}", SipDomain, -1) + path := "/v2/SipDomains/{SipDomain}" + path = strings.Replace(path, "{"+"SipDomain"+"}", SipDomain, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.VoiceRegion != nil { + data.Set("VoiceRegion", *params.VoiceRegion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.VoiceRegion != nil { - data.Set("VoiceRegion", *params.VoiceRegion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &RoutesV2SipDomain{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &RoutesV2SipDomain{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/routes/v2/trunks.go b/rest/routes/v2/trunks.go index e5734e5fa..72280e4cb 100644 --- a/rest/routes/v2/trunks.go +++ b/rest/routes/v2/trunks.go @@ -16,76 +16,82 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch the Inbound Processing Region assigned to a SIP Trunk. -func (c *ApiService) FetchTrunks(SipTrunkDomain string) (*RoutesV2Trunks, error) { - path := "/v2/Trunks/{SipTrunkDomain}" - path = strings.Replace(path, "{"+"SipTrunkDomain"+"}", SipTrunkDomain, -1) +func (c *ApiService) FetchTrunks(SipTrunkDomain string, ) (*RoutesV2Trunks, error) { + path := "/v2/Trunks/{SipTrunkDomain}" + path = strings.Replace(path, "{"+"SipTrunkDomain"+"}", SipTrunkDomain, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &RoutesV2Trunks{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &RoutesV2Trunks{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateTrunks' type UpdateTrunksParams struct { - // The Inbound Processing Region used for this SIP Trunk for voice - VoiceRegion *string `json:"VoiceRegion,omitempty"` - // A human readable description of this resource, up to 64 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` + // The Inbound Processing Region used for this SIP Trunk for voice + VoiceRegion *string `json:"VoiceRegion,omitempty"` + // A human readable description of this resource, up to 64 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateTrunksParams) SetVoiceRegion(VoiceRegion string) *UpdateTrunksParams { - params.VoiceRegion = &VoiceRegion - return params +func (params *UpdateTrunksParams) SetVoiceRegion(VoiceRegion string) (*UpdateTrunksParams){ + params.VoiceRegion = &VoiceRegion + return params } -func (params *UpdateTrunksParams) SetFriendlyName(FriendlyName string) *UpdateTrunksParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateTrunksParams) SetFriendlyName(FriendlyName string) (*UpdateTrunksParams){ + params.FriendlyName = &FriendlyName + return params } // Assign an Inbound Processing Region to a SIP Trunk func (c *ApiService) UpdateTrunks(SipTrunkDomain string, params *UpdateTrunksParams) (*RoutesV2Trunks, error) { - path := "/v2/Trunks/{SipTrunkDomain}" - path = strings.Replace(path, "{"+"SipTrunkDomain"+"}", SipTrunkDomain, -1) + path := "/v2/Trunks/{SipTrunkDomain}" + path = strings.Replace(path, "{"+"SipTrunkDomain"+"}", SipTrunkDomain, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.VoiceRegion != nil { + data.Set("VoiceRegion", *params.VoiceRegion) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.VoiceRegion != nil { - data.Set("VoiceRegion", *params.VoiceRegion) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &RoutesV2Trunks{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &RoutesV2Trunks{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/serverless/v1/README.md b/rest/serverless/v1/README.md index 7c54d1685..530ab2524 100644 --- a/rest/serverless/v1/README.md +++ b/rest/serverless/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/serverless/v1/api_service.go b/rest/serverless/v1/api_service.go index 7ff947e82..33f5d7e21 100644 --- a/rest/serverless/v1/api_service.go +++ b/rest/serverless/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://serverless.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/serverless/v1/docs/ListAssetResponseMeta.md b/rest/serverless/v1/docs/ListAssetResponseMeta.md index afc73efd8..481498612 100644 --- a/rest/serverless/v1/docs/ListAssetResponseMeta.md +++ b/rest/serverless/v1/docs/ListAssetResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/serverless/v1/model_list_asset_response.go b/rest/serverless/v1/model_list_asset_response.go index 7e609cadf..d41623bc5 100644 --- a/rest/serverless/v1/model_list_asset_response.go +++ b/rest/serverless/v1/model_list_asset_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAssetResponse struct for ListAssetResponse type ListAssetResponse struct { - Assets []ServerlessV1Asset `json:"assets,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Assets []ServerlessV1Asset `json:"assets,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_asset_response_meta.go b/rest/serverless/v1/model_list_asset_response_meta.go index 7296a5abb..c097e2adc 100644 --- a/rest/serverless/v1/model_list_asset_response_meta.go +++ b/rest/serverless/v1/model_list_asset_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAssetResponseMeta struct for ListAssetResponseMeta type ListAssetResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_asset_version_response.go b/rest/serverless/v1/model_list_asset_version_response.go index 31a753edf..62fb8241a 100644 --- a/rest/serverless/v1/model_list_asset_version_response.go +++ b/rest/serverless/v1/model_list_asset_version_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAssetVersionResponse struct for ListAssetVersionResponse type ListAssetVersionResponse struct { AssetVersions []ServerlessV1AssetVersion `json:"asset_versions,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_build_response.go b/rest/serverless/v1/model_list_build_response.go index 92ea4aefc..2362d06a7 100644 --- a/rest/serverless/v1/model_list_build_response.go +++ b/rest/serverless/v1/model_list_build_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBuildResponse struct for ListBuildResponse type ListBuildResponse struct { - Builds []ServerlessV1Build `json:"builds,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Builds []ServerlessV1Build `json:"builds,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_deployment_response.go b/rest/serverless/v1/model_list_deployment_response.go index e51dbddc6..fd757fb75 100644 --- a/rest/serverless/v1/model_list_deployment_response.go +++ b/rest/serverless/v1/model_list_deployment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDeploymentResponse struct for ListDeploymentResponse type ListDeploymentResponse struct { Deployments []ServerlessV1Deployment `json:"deployments,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_environment_response.go b/rest/serverless/v1/model_list_environment_response.go index b5006b183..57d00904a 100644 --- a/rest/serverless/v1/model_list_environment_response.go +++ b/rest/serverless/v1/model_list_environment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEnvironmentResponse struct for ListEnvironmentResponse type ListEnvironmentResponse struct { Environments []ServerlessV1Environment `json:"environments,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_function_response.go b/rest/serverless/v1/model_list_function_response.go index fc8a24ee9..a242690d1 100644 --- a/rest/serverless/v1/model_list_function_response.go +++ b/rest/serverless/v1/model_list_function_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFunctionResponse struct for ListFunctionResponse type ListFunctionResponse struct { Functions []ServerlessV1Function `json:"functions,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_function_version_response.go b/rest/serverless/v1/model_list_function_version_response.go index 3b650db14..e55261dd4 100644 --- a/rest/serverless/v1/model_list_function_version_response.go +++ b/rest/serverless/v1/model_list_function_version_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFunctionVersionResponse struct for ListFunctionVersionResponse type ListFunctionVersionResponse struct { FunctionVersions []ServerlessV1FunctionVersion `json:"function_versions,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_log_response.go b/rest/serverless/v1/model_list_log_response.go index 2be60a5a8..edf120843 100644 --- a/rest/serverless/v1/model_list_log_response.go +++ b/rest/serverless/v1/model_list_log_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListLogResponse struct for ListLogResponse type ListLogResponse struct { - Logs []ServerlessV1Log `json:"logs,omitempty"` + Logs []ServerlessV1Log `json:"logs,omitempty"` Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_service_response.go b/rest/serverless/v1/model_list_service_response.go index 758e5a38f..db1310bd9 100644 --- a/rest/serverless/v1/model_list_service_response.go +++ b/rest/serverless/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { Services []ServerlessV1Service `json:"services,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_list_variable_response.go b/rest/serverless/v1/model_list_variable_response.go index de305a5b6..754b1aa7f 100644 --- a/rest/serverless/v1/model_list_variable_response.go +++ b/rest/serverless/v1/model_list_variable_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVariableResponse struct for ListVariableResponse type ListVariableResponse struct { Variables []ServerlessV1Variable `json:"variables,omitempty"` - Meta ListAssetResponseMeta `json:"meta,omitempty"` + Meta ListAssetResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_asset.go b/rest/serverless/v1/model_serverless_v1_asset.go index 504f4983a..22b8498af 100644 --- a/rest/serverless/v1/model_serverless_v1_asset.go +++ b/rest/serverless/v1/model_serverless_v1_asset.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Asset struct for ServerlessV1Asset type ServerlessV1Asset struct { - // The unique string that we created to identify the Asset resource. + // The unique string that we created to identify the Asset resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Asset resource is associated with. + // The SID of the Service that the Asset resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters. + // The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the Asset resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Asset resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Asset resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Asset resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Asset resource. + // The absolute URL of the Asset resource. Url *string `json:"url,omitempty"` - // The URLs of the Asset resource's nested resources. + // The URLs of the Asset resource's nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_asset_version.go b/rest/serverless/v1/model_serverless_v1_asset_version.go index 2b862f3a8..eb1d07c44 100644 --- a/rest/serverless/v1/model_serverless_v1_asset_version.go +++ b/rest/serverless/v1/model_serverless_v1_asset_version.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1AssetVersion struct for ServerlessV1AssetVersion type ServerlessV1AssetVersion struct { - // The unique string that we created to identify the Asset Version resource. + // The unique string that we created to identify the Asset Version resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset Version resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset Version resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Asset Version resource is associated with. + // The SID of the Service that the Asset Version resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Asset resource that is the parent of the Asset Version. + // The SID of the Asset resource that is the parent of the Asset Version. AssetSid *string `json:"asset_sid,omitempty"` - // The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. - Path *string `json:"path,omitempty"` + // The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. + Path *string `json:"path,omitempty"` Visibility *string `json:"visibility,omitempty"` - // The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Asset Version resource. + // The absolute URL of the Asset Version resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_build.go b/rest/serverless/v1/model_serverless_v1_build.go index 60689636e..60006b9a8 100644 --- a/rest/serverless/v1/model_serverless_v1_build.go +++ b/rest/serverless/v1/model_serverless_v1_build.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Build struct for ServerlessV1Build type ServerlessV1Build struct { - // The unique string that we created to identify the Build resource. + // The unique string that we created to identify the Build resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Build resource is associated with. + // The SID of the Service that the Build resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The list of Asset Version resource SIDs that are included in the Build. + Status *string `json:"status,omitempty"` + // The list of Asset Version resource SIDs that are included in the Build. AssetVersions *[]interface{} `json:"asset_versions,omitempty"` - // The list of Function Version resource SIDs that are included in the Build. + // The list of Function Version resource SIDs that are included in the Build. FunctionVersions *[]interface{} `json:"function_versions,omitempty"` - // A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. + // A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. Dependencies *[]interface{} `json:"dependencies,omitempty"` - Runtime *string `json:"runtime,omitempty"` - // The date and time in GMT when the Build resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Runtime *string `json:"runtime,omitempty"` + // The date and time in GMT when the Build resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Build resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Build resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Build resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the Build resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_build_status.go b/rest/serverless/v1/model_serverless_v1_build_status.go index cc34d27a8..23380b7bf 100644 --- a/rest/serverless/v1/model_serverless_v1_build_status.go +++ b/rest/serverless/v1/model_serverless_v1_build_status.go @@ -13,16 +13,21 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ServerlessV1BuildStatus struct for ServerlessV1BuildStatus type ServerlessV1BuildStatus struct { - // The unique string that we created to identify the Build resource. + // The unique string that we created to identify the Build resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Build resource is associated with. + // The SID of the Service that the Build resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The absolute URL of the Build Status resource. + Status *string `json:"status,omitempty"` + // The absolute URL of the Build Status resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_deployment.go b/rest/serverless/v1/model_serverless_v1_deployment.go index b5eaa2614..856da4169 100644 --- a/rest/serverless/v1/model_serverless_v1_deployment.go +++ b/rest/serverless/v1/model_serverless_v1_deployment.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Deployment struct for ServerlessV1Deployment type ServerlessV1Deployment struct { - // The unique string that we created to identify the Deployment resource. + // The unique string that we created to identify the Deployment resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Deployment resource is associated with. + // The SID of the Service that the Deployment resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Environment for the Deployment. + // The SID of the Environment for the Deployment. EnvironmentSid *string `json:"environment_sid,omitempty"` - // The SID of the Build for the deployment. + // The SID of the Build for the deployment. BuildSid *string `json:"build_sid,omitempty"` - // The date and time in GMT when the Deployment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Deployment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Deployment resource. + // The absolute URL of the Deployment resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_environment.go b/rest/serverless/v1/model_serverless_v1_environment.go index fa373deec..311038f0f 100644 --- a/rest/serverless/v1/model_serverless_v1_environment.go +++ b/rest/serverless/v1/model_serverless_v1_environment.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Environment struct for ServerlessV1Environment type ServerlessV1Environment struct { - // The unique string that we created to identify the Environment resource. + // The unique string that we created to identify the Environment resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Environment resource is associated with. + // The SID of the Service that the Environment resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the build deployed in the environment. + // The SID of the build deployed in the environment. BuildSid *string `json:"build_sid,omitempty"` - // A user-defined string that uniquely identifies the Environment resource. + // A user-defined string that uniquely identifies the Environment resource. UniqueName *string `json:"unique_name,omitempty"` - // A URL-friendly name that represents the environment and forms part of the domain name. + // A URL-friendly name that represents the environment and forms part of the domain name. DomainSuffix *string `json:"domain_suffix,omitempty"` - // The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix. + // The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix. DomainName *string `json:"domain_name,omitempty"` - // The date and time in GMT when the Environment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Environment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Environment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Environment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Environment resource. + // The absolute URL of the Environment resource. Url *string `json:"url,omitempty"` - // The URLs of the Environment resource's nested resources. + // The URLs of the Environment resource's nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_function.go b/rest/serverless/v1/model_serverless_v1_function.go index 29645151b..5e3ee0bba 100644 --- a/rest/serverless/v1/model_serverless_v1_function.go +++ b/rest/serverless/v1/model_serverless_v1_function.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Function struct for ServerlessV1Function type ServerlessV1Function struct { - // The unique string that we created to identify the Function resource. + // The unique string that we created to identify the Function resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Function resource is associated with. + // The SID of the Service that the Function resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The string that you assigned to describe the Function resource. It can be a maximum of 255 characters. + // The string that you assigned to describe the Function resource. It can be a maximum of 255 characters. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the Function resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Function resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Function resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Function resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Function resource. + // The absolute URL of the Function resource. Url *string `json:"url,omitempty"` - // The URLs of nested resources of the Function resource. + // The URLs of nested resources of the Function resource. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_function_version.go b/rest/serverless/v1/model_serverless_v1_function_version.go index f0d5f2eff..d7900aaf7 100644 --- a/rest/serverless/v1/model_serverless_v1_function_version.go +++ b/rest/serverless/v1/model_serverless_v1_function_version.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1FunctionVersion struct for ServerlessV1FunctionVersion type ServerlessV1FunctionVersion struct { - // The unique string that we created to identify the Function Version resource. + // The unique string that we created to identify the Function Version resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Function Version resource is associated with. + // The SID of the Service that the Function Version resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Function resource that is the parent of the Function Version resource. + // The SID of the Function resource that is the parent of the Function Version resource. FunctionSid *string `json:"function_sid,omitempty"` - // The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. - Path *string `json:"path,omitempty"` + // The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. + Path *string `json:"path,omitempty"` Visibility *string `json:"visibility,omitempty"` - // The date and time in GMT when the Function Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Function Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Function Version resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the Function Version resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_function_version_content.go b/rest/serverless/v1/model_serverless_v1_function_version_content.go index e788b19d9..f39459921 100644 --- a/rest/serverless/v1/model_serverless_v1_function_version_content.go +++ b/rest/serverless/v1/model_serverless_v1_function_version_content.go @@ -13,18 +13,23 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ServerlessV1FunctionVersionContent struct for ServerlessV1FunctionVersionContent type ServerlessV1FunctionVersionContent struct { - // The unique string that we created to identify the Function Version resource. + // The unique string that we created to identify the Function Version resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Function Version resource is associated with. + // The SID of the Service that the Function Version resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Function that is the parent of the Function Version. + // The SID of the Function that is the parent of the Function Version. FunctionSid *string `json:"function_sid,omitempty"` - // The content of the Function Version resource. + // The content of the Function Version resource. Content *string `json:"content,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_log.go b/rest/serverless/v1/model_serverless_v1_log.go index 292c02e2f..69d738983 100644 --- a/rest/serverless/v1/model_serverless_v1_log.go +++ b/rest/serverless/v1/model_serverless_v1_log.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Log struct for ServerlessV1Log type ServerlessV1Log struct { - // The unique string that we created to identify the Log resource. + // The unique string that we created to identify the Log resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Log resource is associated with. + // The SID of the Service that the Log resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the environment in which the log occurred. + // The SID of the environment in which the log occurred. EnvironmentSid *string `json:"environment_sid,omitempty"` - // The SID of the build that corresponds to the log. + // The SID of the build that corresponds to the log. BuildSid *string `json:"build_sid,omitempty"` - // The SID of the deployment that corresponds to the log. + // The SID of the deployment that corresponds to the log. DeploymentSid *string `json:"deployment_sid,omitempty"` - // The SID of the function whose invocation produced the log. + // The SID of the function whose invocation produced the log. FunctionSid *string `json:"function_sid,omitempty"` - // The SID of the request associated with the log. + // The SID of the request associated with the log. RequestSid *string `json:"request_sid,omitempty"` - Level *string `json:"level,omitempty"` - // The log message. + Level *string `json:"level,omitempty"` + // The log message. Message *string `json:"message,omitempty"` - // The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Log resource. + // The absolute URL of the Log resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_service.go b/rest/serverless/v1/model_serverless_v1_service.go index 5a82e85d2..a515dd18f 100644 --- a/rest/serverless/v1/model_serverless_v1_service.go +++ b/rest/serverless/v1/model_serverless_v1_service.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Service struct for ServerlessV1Service type ServerlessV1Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the Service resource. + // The string that you assigned to describe the Service resource. FriendlyName *string `json:"friendly_name,omitempty"` - // A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource's `sid` in the URL to address the Service resource. + // A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource's `sid` in the URL to address the Service resource. UniqueName *string `json:"unique_name,omitempty"` - // Whether to inject Account credentials into a function invocation context. + // Whether to inject Account credentials into a function invocation context. IncludeCredentials *bool `json:"include_credentials,omitempty"` - // Whether the Service resource's properties and subresources can be edited via the UI. + // Whether the Service resource's properties and subresources can be edited via the UI. UiEditable *bool `json:"ui_editable,omitempty"` - // The base domain name for this Service, which is a combination of the unique name and a randomly generated string. + // The base domain name for this Service, which is a combination of the unique name and a randomly generated string. DomainBase *string `json:"domain_base,omitempty"` - // The date and time in GMT when the Service resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Service resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The URLs of the Service's nested resources. + // The URLs of the Service's nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/serverless/v1/model_serverless_v1_variable.go b/rest/serverless/v1/model_serverless_v1_variable.go index a57b73838..a370dc29e 100644 --- a/rest/serverless/v1/model_serverless_v1_variable.go +++ b/rest/serverless/v1/model_serverless_v1_variable.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // ServerlessV1Variable struct for ServerlessV1Variable type ServerlessV1Variable struct { - // The unique string that we created to identify the Variable resource. + // The unique string that we created to identify the Variable resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Service that the Variable resource is associated with. + // The SID of the Service that the Variable resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Environment in which the Variable exists. + // The SID of the Environment in which the Variable exists. EnvironmentSid *string `json:"environment_sid,omitempty"` - // A string by which the Variable resource can be referenced. + // A string by which the Variable resource can be referenced. Key *string `json:"key,omitempty"` - // A string that contains the actual value of the Variable. + // A string that contains the actual value of the Variable. Value *string `json:"value,omitempty"` - // The date and time in GMT when the Variable resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Variable resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Variable resource. + // The absolute URL of the Variable resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/serverless/v1/services.go b/rest/serverless/v1/services.go index cc1c5abca..9c523d291 100644 --- a/rest/serverless/v1/services.go +++ b/rest/serverless/v1/services.go @@ -18,164 +18,170 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the `sid` in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique. - UniqueName *string `json:"UniqueName,omitempty"` - // A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether to inject Account credentials into a function invocation context. The default value is `true`. - IncludeCredentials *bool `json:"IncludeCredentials,omitempty"` - // Whether the Service's properties and subresources can be edited via the UI. The default value is `false`. - UiEditable *bool `json:"UiEditable,omitempty"` + // A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the `sid` in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique. + UniqueName *string `json:"UniqueName,omitempty"` + // A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether to inject Account credentials into a function invocation context. The default value is `true`. + IncludeCredentials *bool `json:"IncludeCredentials,omitempty"` + // Whether the Service's properties and subresources can be edited via the UI. The default value is `false`. + UiEditable *bool `json:"UiEditable,omitempty"` } -func (params *CreateServiceParams) SetUniqueName(UniqueName string) *CreateServiceParams { - params.UniqueName = &UniqueName - return params +func (params *CreateServiceParams) SetUniqueName(UniqueName string) (*CreateServiceParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateServiceParams) SetIncludeCredentials(IncludeCredentials bool) *CreateServiceParams { - params.IncludeCredentials = &IncludeCredentials - return params +func (params *CreateServiceParams) SetIncludeCredentials(IncludeCredentials bool) (*CreateServiceParams){ + params.IncludeCredentials = &IncludeCredentials + return params } -func (params *CreateServiceParams) SetUiEditable(UiEditable bool) *CreateServiceParams { - params.UiEditable = &UiEditable - return params +func (params *CreateServiceParams) SetUiEditable(UiEditable bool) (*CreateServiceParams){ + params.UiEditable = &UiEditable + return params } // Create a new Service resource. func (c *ApiService) CreateService(params *CreateServiceParams) (*ServerlessV1Service, error) { - path := "/v1/Services" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.IncludeCredentials != nil { - data.Set("IncludeCredentials", fmt.Sprint(*params.IncludeCredentials)) - } - if params != nil && params.UiEditable != nil { - data.Set("UiEditable", fmt.Sprint(*params.UiEditable)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ServerlessV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.IncludeCredentials != nil { + data.Set("IncludeCredentials", fmt.Sprint(*params.IncludeCredentials)) + } + if params != nil && params.UiEditable != nil { + data.Set("UiEditable", fmt.Sprint(*params.UiEditable)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ServerlessV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a Service resource. -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Retrieve a specific Service resource. -func (c *ApiService) FetchService(Sid string) (*ServerlessV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchService(Sid string, ) (*ServerlessV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ServerlessV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -216,6 +222,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan ServerlessV1 return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan ServerlessV1Service, errorChannel chan error) { curRecord := 1 @@ -247,75 +254,77 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // Whether to inject Account credentials into a function invocation context. - IncludeCredentials *bool `json:"IncludeCredentials,omitempty"` - // A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether the Service resource's properties and subresources can be edited via the UI. The default value is `false`. - UiEditable *bool `json:"UiEditable,omitempty"` + // Whether to inject Account credentials into a function invocation context. + IncludeCredentials *bool `json:"IncludeCredentials,omitempty"` + // A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether the Service resource's properties and subresources can be edited via the UI. The default value is `false`. + UiEditable *bool `json:"UiEditable,omitempty"` } -func (params *UpdateServiceParams) SetIncludeCredentials(IncludeCredentials bool) *UpdateServiceParams { - params.IncludeCredentials = &IncludeCredentials - return params +func (params *UpdateServiceParams) SetIncludeCredentials(IncludeCredentials bool) (*UpdateServiceParams){ + params.IncludeCredentials = &IncludeCredentials + return params } -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateServiceParams) SetUiEditable(UiEditable bool) *UpdateServiceParams { - params.UiEditable = &UiEditable - return params +func (params *UpdateServiceParams) SetUiEditable(UiEditable bool) (*UpdateServiceParams){ + params.UiEditable = &UiEditable + return params } // Update a specific Service resource. func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*ServerlessV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IncludeCredentials != nil { - data.Set("IncludeCredentials", fmt.Sprint(*params.IncludeCredentials)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UiEditable != nil { - data.Set("UiEditable", fmt.Sprint(*params.UiEditable)) - } + if params != nil && params.IncludeCredentials != nil { + data.Set("IncludeCredentials", fmt.Sprint(*params.IncludeCredentials)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UiEditable != nil { + data.Set("UiEditable", fmt.Sprint(*params.UiEditable)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/serverless/v1/services_assets.go b/rest/serverless/v1/services_assets.go index 5ce0a10a6..e9eb22d22 100644 --- a/rest/serverless/v1/services_assets.go +++ b/rest/serverless/v1/services_assets.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAsset' type CreateAssetParams struct { - // A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateAssetParams) SetFriendlyName(FriendlyName string) *CreateAssetParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateAssetParams) SetFriendlyName(FriendlyName string) (*CreateAssetParams){ + params.FriendlyName = &FriendlyName + return params } // Create a new Asset resource. func (c *ApiService) CreateAsset(ServiceSid string, params *CreateAssetParams) (*ServerlessV1Asset, error) { - path := "/v1/Services/{ServiceSid}/Assets" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Assets" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Asset{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Asset{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete an Asset resource. -func (c *ApiService) DeleteAsset(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Assets/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteAsset(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Assets/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a specific Asset resource. -func (c *ApiService) FetchAsset(ServiceSid string, Sid string) (*ServerlessV1Asset, error) { - path := "/v1/Services/{ServiceSid}/Assets/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchAsset(ServiceSid string, Sid string, ) (*ServerlessV1Asset, error) { + path := "/v1/Services/{ServiceSid}/Assets/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Asset{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ServerlessV1Asset{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAsset' type ListAssetParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAssetParams) SetPageSize(PageSize int) *ListAssetParams { - params.PageSize = &PageSize - return params +func (params *ListAssetParams) SetPageSize(PageSize int) (*ListAssetParams){ + params.PageSize = &PageSize + return params } -func (params *ListAssetParams) SetLimit(Limit int) *ListAssetParams { - params.Limit = &Limit - return params +func (params *ListAssetParams) SetLimit(Limit int) (*ListAssetParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Asset records from the API. Request is executed immediately. func (c *ApiService) PageAsset(ServiceSid string, params *ListAssetParams, pageToken, pageNumber string) (*ListAssetResponse, error) { - path := "/v1/Services/{ServiceSid}/Assets" + path := "/v1/Services/{ServiceSid}/Assets" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAssetResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAssetResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Asset records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamAsset(ServiceSid string, params *ListAssetParams) (ch return recordChannel, errorChannel } + func (c *ApiService) streamAsset(response *ListAssetResponse, params *ListAssetParams, recordChannel chan ServerlessV1Asset, errorChannel chan error) { curRecord := 1 @@ -225,58 +231,60 @@ func (c *ApiService) streamAsset(response *ListAssetResponse, params *ListAssetP } func (c *ApiService) getNextListAssetResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAssetResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAssetResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateAsset' type UpdateAssetParams struct { - // A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateAssetParams) SetFriendlyName(FriendlyName string) *UpdateAssetParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateAssetParams) SetFriendlyName(FriendlyName string) (*UpdateAssetParams){ + params.FriendlyName = &FriendlyName + return params } // Update a specific Asset resource. func (c *ApiService) UpdateAsset(ServiceSid string, Sid string, params *UpdateAssetParams) (*ServerlessV1Asset, error) { - path := "/v1/Services/{ServiceSid}/Assets/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Assets/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Asset{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Asset{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/serverless/v1/services_assets_versions.go b/rest/serverless/v1/services_assets_versions.go index f3a8e510b..a4654da2a 100644 --- a/rest/serverless/v1/services_assets_versions.go +++ b/rest/serverless/v1/services_assets_versions.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a specific Asset Version. -func (c *ApiService) FetchAssetVersion(ServiceSid string, AssetSid string, Sid string) (*ServerlessV1AssetVersion, error) { - path := "/v1/Services/{ServiceSid}/Assets/{AssetSid}/Versions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"AssetSid"+"}", AssetSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchAssetVersion(ServiceSid string, AssetSid string, Sid string, ) (*ServerlessV1AssetVersion, error) { + path := "/v1/Services/{ServiceSid}/Assets/{AssetSid}/Versions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"AssetSid"+"}", AssetSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1AssetVersion{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ServerlessV1AssetVersion{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListAssetVersion' type ListAssetVersionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAssetVersionParams) SetPageSize(PageSize int) *ListAssetVersionParams { - params.PageSize = &PageSize - return params +func (params *ListAssetVersionParams) SetPageSize(PageSize int) (*ListAssetVersionParams){ + params.PageSize = &PageSize + return params } -func (params *ListAssetVersionParams) SetLimit(Limit int) *ListAssetVersionParams { - params.Limit = &Limit - return params +func (params *ListAssetVersionParams) SetLimit(Limit int) (*ListAssetVersionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AssetVersion records from the API. Request is executed immediately. func (c *ApiService) PageAssetVersion(ServiceSid string, AssetSid string, params *ListAssetVersionParams, pageToken, pageNumber string) (*ListAssetVersionResponse, error) { - path := "/v1/Services/{ServiceSid}/Assets/{AssetSid}/Versions" + path := "/v1/Services/{ServiceSid}/Assets/{AssetSid}/Versions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"AssetSid"+"}", AssetSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"AssetSid"+"}", AssetSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListAssetVersionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListAssetVersionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists AssetVersion records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamAssetVersion(ServiceSid string, AssetSid string, para return recordChannel, errorChannel } + func (c *ApiService) streamAssetVersion(response *ListAssetVersionResponse, params *ListAssetVersionParams, recordChannel chan ServerlessV1AssetVersion, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamAssetVersion(response *ListAssetVersionResponse, para } func (c *ApiService) getNextListAssetVersionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAssetVersionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAssetVersionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/serverless/v1/services_builds.go b/rest/serverless/v1/services_builds.go index 838001d90..20665b2ad 100644 --- a/rest/serverless/v1/services_builds.go +++ b/rest/serverless/v1/services_builds.go @@ -18,173 +18,178 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBuild' type CreateBuildParams struct { - // The list of Asset Version resource SIDs to include in the Build. - AssetVersions *[]string `json:"AssetVersions,omitempty"` - // The list of the Function Version resource SIDs to include in the Build. - FunctionVersions *[]string `json:"FunctionVersions,omitempty"` - // A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. - Dependencies *string `json:"Dependencies,omitempty"` - // The Runtime version that will be used to run the Build resource when it is deployed. - Runtime *string `json:"Runtime,omitempty"` + // The list of Asset Version resource SIDs to include in the Build. + AssetVersions *[]string `json:"AssetVersions,omitempty"` + // The list of the Function Version resource SIDs to include in the Build. + FunctionVersions *[]string `json:"FunctionVersions,omitempty"` + // A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. + Dependencies *string `json:"Dependencies,omitempty"` + // The Runtime version that will be used to run the Build resource when it is deployed. + Runtime *string `json:"Runtime,omitempty"` } -func (params *CreateBuildParams) SetAssetVersions(AssetVersions []string) *CreateBuildParams { - params.AssetVersions = &AssetVersions - return params +func (params *CreateBuildParams) SetAssetVersions(AssetVersions []string) (*CreateBuildParams){ + params.AssetVersions = &AssetVersions + return params } -func (params *CreateBuildParams) SetFunctionVersions(FunctionVersions []string) *CreateBuildParams { - params.FunctionVersions = &FunctionVersions - return params +func (params *CreateBuildParams) SetFunctionVersions(FunctionVersions []string) (*CreateBuildParams){ + params.FunctionVersions = &FunctionVersions + return params } -func (params *CreateBuildParams) SetDependencies(Dependencies string) *CreateBuildParams { - params.Dependencies = &Dependencies - return params +func (params *CreateBuildParams) SetDependencies(Dependencies string) (*CreateBuildParams){ + params.Dependencies = &Dependencies + return params } -func (params *CreateBuildParams) SetRuntime(Runtime string) *CreateBuildParams { - params.Runtime = &Runtime - return params +func (params *CreateBuildParams) SetRuntime(Runtime string) (*CreateBuildParams){ + params.Runtime = &Runtime + return params } // Create a new Build resource. At least one function version or asset version is required. func (c *ApiService) CreateBuild(ServiceSid string, params *CreateBuildParams) (*ServerlessV1Build, error) { - path := "/v1/Services/{ServiceSid}/Builds" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AssetVersions != nil { - for _, item := range *params.AssetVersions { - data.Add("AssetVersions", item) - } - } - if params != nil && params.FunctionVersions != nil { - for _, item := range *params.FunctionVersions { - data.Add("FunctionVersions", item) - } - } - if params != nil && params.Dependencies != nil { - data.Set("Dependencies", *params.Dependencies) - } - if params != nil && params.Runtime != nil { - data.Set("Runtime", *params.Runtime) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ServerlessV1Build{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Builds" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AssetVersions != nil { + for _, item := range *params.AssetVersions { + data.Add("AssetVersions", item) + } + } + if params != nil && params.FunctionVersions != nil { + for _, item := range *params.FunctionVersions { + data.Add("FunctionVersions", item) + } + } + if params != nil && params.Dependencies != nil { + data.Set("Dependencies", *params.Dependencies) + } + if params != nil && params.Runtime != nil { + data.Set("Runtime", *params.Runtime) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ServerlessV1Build{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a Build resource. -func (c *ApiService) DeleteBuild(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Builds/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteBuild(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Builds/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a specific Build resource. -func (c *ApiService) FetchBuild(ServiceSid string, Sid string) (*ServerlessV1Build, error) { - path := "/v1/Services/{ServiceSid}/Builds/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchBuild(ServiceSid string, Sid string, ) (*ServerlessV1Build, error) { + path := "/v1/Services/{ServiceSid}/Builds/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Build{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ServerlessV1Build{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListBuild' type ListBuildParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBuildParams) SetPageSize(PageSize int) *ListBuildParams { - params.PageSize = &PageSize - return params +func (params *ListBuildParams) SetPageSize(PageSize int) (*ListBuildParams){ + params.PageSize = &PageSize + return params } -func (params *ListBuildParams) SetLimit(Limit int) *ListBuildParams { - params.Limit = &Limit - return params +func (params *ListBuildParams) SetLimit(Limit int) (*ListBuildParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Build records from the API. Request is executed immediately. func (c *ApiService) PageBuild(ServiceSid string, params *ListBuildParams, pageToken, pageNumber string) (*ListBuildResponse, error) { - path := "/v1/Services/{ServiceSid}/Builds" + path := "/v1/Services/{ServiceSid}/Builds" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBuildResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListBuildResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Build records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +230,7 @@ func (c *ApiService) StreamBuild(ServiceSid string, params *ListBuildParams) (ch return recordChannel, errorChannel } + func (c *ApiService) streamBuild(response *ListBuildResponse, params *ListBuildParams, recordChannel chan ServerlessV1Build, errorChannel chan error) { curRecord := 1 @@ -256,19 +262,20 @@ func (c *ApiService) streamBuild(response *ListBuildResponse, params *ListBuildP } func (c *ApiService) getNextListBuildResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBuildResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBuildResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/serverless/v1/services_builds_status.go b/rest/serverless/v1/services_builds_status.go index 81a3e2553..65241658d 100644 --- a/rest/serverless/v1/services_builds_status.go +++ b/rest/serverless/v1/services_builds_status.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve a specific Build resource. -func (c *ApiService) FetchBuildStatus(ServiceSid string, Sid string) (*ServerlessV1BuildStatus, error) { - path := "/v1/Services/{ServiceSid}/Builds/{Sid}/Status" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchBuildStatus(ServiceSid string, Sid string, ) (*ServerlessV1BuildStatus, error) { + path := "/v1/Services/{ServiceSid}/Builds/{Sid}/Status" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ServerlessV1BuildStatus{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ServerlessV1BuildStatus{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/serverless/v1/services_environments.go b/rest/serverless/v1/services_environments.go index 0dd9b37b4..5867a20fc 100644 --- a/rest/serverless/v1/services_environments.go +++ b/rest/serverless/v1/services_environments.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateEnvironment' type CreateEnvironmentParams struct { - // A user-defined string that uniquely identifies the Environment resource. It can be a maximum of 100 characters. - UniqueName *string `json:"UniqueName,omitempty"` - // A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters. - DomainSuffix *string `json:"DomainSuffix,omitempty"` + // A user-defined string that uniquely identifies the Environment resource. It can be a maximum of 100 characters. + UniqueName *string `json:"UniqueName,omitempty"` + // A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters. + DomainSuffix *string `json:"DomainSuffix,omitempty"` } -func (params *CreateEnvironmentParams) SetUniqueName(UniqueName string) *CreateEnvironmentParams { - params.UniqueName = &UniqueName - return params +func (params *CreateEnvironmentParams) SetUniqueName(UniqueName string) (*CreateEnvironmentParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateEnvironmentParams) SetDomainSuffix(DomainSuffix string) *CreateEnvironmentParams { - params.DomainSuffix = &DomainSuffix - return params +func (params *CreateEnvironmentParams) SetDomainSuffix(DomainSuffix string) (*CreateEnvironmentParams){ + params.DomainSuffix = &DomainSuffix + return params } // Create a new environment. func (c *ApiService) CreateEnvironment(ServiceSid string, params *CreateEnvironmentParams) (*ServerlessV1Environment, error) { - path := "/v1/Services/{ServiceSid}/Environments" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Environments" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DomainSuffix != nil { - data.Set("DomainSuffix", *params.DomainSuffix) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DomainSuffix != nil { + data.Set("DomainSuffix", *params.DomainSuffix) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Environment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ServerlessV1Environment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific environment. -func (c *ApiService) DeleteEnvironment(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Environments/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteEnvironment(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Environments/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Retrieve a specific environment. -func (c *ApiService) FetchEnvironment(ServiceSid string, Sid string) (*ServerlessV1Environment, error) { - path := "/v1/Services/{ServiceSid}/Environments/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEnvironment(ServiceSid string, Sid string, ) (*ServerlessV1Environment, error) { + path := "/v1/Services/{ServiceSid}/Environments/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Environment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ServerlessV1Environment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEnvironment' type ListEnvironmentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEnvironmentParams) SetPageSize(PageSize int) *ListEnvironmentParams { - params.PageSize = &PageSize - return params +func (params *ListEnvironmentParams) SetPageSize(PageSize int) (*ListEnvironmentParams){ + params.PageSize = &PageSize + return params } -func (params *ListEnvironmentParams) SetLimit(Limit int) *ListEnvironmentParams { - params.Limit = &Limit - return params +func (params *ListEnvironmentParams) SetLimit(Limit int) (*ListEnvironmentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Environment records from the API. Request is executed immediately. func (c *ApiService) PageEnvironment(ServiceSid string, params *ListEnvironmentParams, pageToken, pageNumber string) (*ListEnvironmentResponse, error) { - path := "/v1/Services/{ServiceSid}/Environments" + path := "/v1/Services/{ServiceSid}/Environments" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEnvironmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEnvironmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Environment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamEnvironment(ServiceSid string, params *ListEnvironmen return recordChannel, errorChannel } + func (c *ApiService) streamEnvironment(response *ListEnvironmentResponse, params *ListEnvironmentParams, recordChannel chan ServerlessV1Environment, errorChannel chan error) { curRecord := 1 @@ -234,19 +240,20 @@ func (c *ApiService) streamEnvironment(response *ListEnvironmentResponse, params } func (c *ApiService) getNextListEnvironmentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEnvironmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEnvironmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/serverless/v1/services_environments_deployments.go b/rest/serverless/v1/services_environments_deployments.go index d061c40c0..4c270da8a 100644 --- a/rest/serverless/v1/services_environments_deployments.go +++ b/rest/serverless/v1/services_environments_deployments.go @@ -18,126 +18,129 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateDeployment' type CreateDeploymentParams struct { - // The SID of the Build for the Deployment. - BuildSid *string `json:"BuildSid,omitempty"` + // The SID of the Build for the Deployment. + BuildSid *string `json:"BuildSid,omitempty"` } -func (params *CreateDeploymentParams) SetBuildSid(BuildSid string) *CreateDeploymentParams { - params.BuildSid = &BuildSid - return params +func (params *CreateDeploymentParams) SetBuildSid(BuildSid string) (*CreateDeploymentParams){ + params.BuildSid = &BuildSid + return params } // Create a new Deployment. func (c *ApiService) CreateDeployment(ServiceSid string, EnvironmentSid string, params *CreateDeploymentParams) (*ServerlessV1Deployment, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.BuildSid != nil { - data.Set("BuildSid", *params.BuildSid) - } + if params != nil && params.BuildSid != nil { + data.Set("BuildSid", *params.BuildSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Deployment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &ServerlessV1Deployment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Retrieve a specific Deployment. -func (c *ApiService) FetchDeployment(ServiceSid string, EnvironmentSid string, Sid string) (*ServerlessV1Deployment, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchDeployment(ServiceSid string, EnvironmentSid string, Sid string, ) (*ServerlessV1Deployment, error) { + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Deployment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ServerlessV1Deployment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListDeployment' type ListDeploymentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDeploymentParams) SetPageSize(PageSize int) *ListDeploymentParams { - params.PageSize = &PageSize - return params +func (params *ListDeploymentParams) SetPageSize(PageSize int) (*ListDeploymentParams){ + params.PageSize = &PageSize + return params } -func (params *ListDeploymentParams) SetLimit(Limit int) *ListDeploymentParams { - params.Limit = &Limit - return params +func (params *ListDeploymentParams) SetLimit(Limit int) (*ListDeploymentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Deployment records from the API. Request is executed immediately. func (c *ApiService) PageDeployment(ServiceSid string, EnvironmentSid string, params *ListDeploymentParams, pageToken, pageNumber string) (*ListDeploymentResponse, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments" + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Deployments" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDeploymentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDeploymentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Deployment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -178,6 +181,7 @@ func (c *ApiService) StreamDeployment(ServiceSid string, EnvironmentSid string, return recordChannel, errorChannel } + func (c *ApiService) streamDeployment(response *ListDeploymentResponse, params *ListDeploymentParams, recordChannel chan ServerlessV1Deployment, errorChannel chan error) { curRecord := 1 @@ -209,19 +213,20 @@ func (c *ApiService) streamDeployment(response *ListDeploymentResponse, params * } func (c *ApiService) getNextListDeploymentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDeploymentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDeploymentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/serverless/v1/services_environments_logs.go b/rest/serverless/v1/services_environments_logs.go index 7fbbc264d..8e04309e2 100644 --- a/rest/serverless/v1/services_environments_logs.go +++ b/rest/serverless/v1/services_environments_logs.go @@ -18,115 +18,116 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a specific log. -func (c *ApiService) FetchLog(ServiceSid string, EnvironmentSid string, Sid string) (*ServerlessV1Log, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Logs/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchLog(ServiceSid string, EnvironmentSid string, Sid string, ) (*ServerlessV1Log, error) { + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Logs/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Log{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ServerlessV1Log{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListLog' type ListLogParams struct { - // The SID of the function whose invocation produced the Log resources to read. - FunctionSid *string `json:"FunctionSid,omitempty"` - // The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. - StartDate *time.Time `json:"StartDate,omitempty"` - // The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. - EndDate *time.Time `json:"EndDate,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of the function whose invocation produced the Log resources to read. + FunctionSid *string `json:"FunctionSid,omitempty"` + // The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. + StartDate *time.Time `json:"StartDate,omitempty"` + // The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. + EndDate *time.Time `json:"EndDate,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListLogParams) SetFunctionSid(FunctionSid string) *ListLogParams { - params.FunctionSid = &FunctionSid - return params +func (params *ListLogParams) SetFunctionSid(FunctionSid string) (*ListLogParams){ + params.FunctionSid = &FunctionSid + return params } -func (params *ListLogParams) SetStartDate(StartDate time.Time) *ListLogParams { - params.StartDate = &StartDate - return params +func (params *ListLogParams) SetStartDate(StartDate time.Time) (*ListLogParams){ + params.StartDate = &StartDate + return params } -func (params *ListLogParams) SetEndDate(EndDate time.Time) *ListLogParams { - params.EndDate = &EndDate - return params +func (params *ListLogParams) SetEndDate(EndDate time.Time) (*ListLogParams){ + params.EndDate = &EndDate + return params } -func (params *ListLogParams) SetPageSize(PageSize int) *ListLogParams { - params.PageSize = &PageSize - return params +func (params *ListLogParams) SetPageSize(PageSize int) (*ListLogParams){ + params.PageSize = &PageSize + return params } -func (params *ListLogParams) SetLimit(Limit int) *ListLogParams { - params.Limit = &Limit - return params +func (params *ListLogParams) SetLimit(Limit int) (*ListLogParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Log records from the API. Request is executed immediately. func (c *ApiService) PageLog(ServiceSid string, EnvironmentSid string, params *ListLogParams, pageToken, pageNumber string) (*ListLogResponse, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Logs" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FunctionSid != nil { - data.Set("FunctionSid", *params.FunctionSid) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListLogResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Logs" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FunctionSid != nil { + data.Set("FunctionSid", *params.FunctionSid) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListLogResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Log records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -167,6 +168,7 @@ func (c *ApiService) StreamLog(ServiceSid string, EnvironmentSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamLog(response *ListLogResponse, params *ListLogParams, recordChannel chan ServerlessV1Log, errorChannel chan error) { curRecord := 1 @@ -198,19 +200,20 @@ func (c *ApiService) streamLog(response *ListLogResponse, params *ListLogParams, } func (c *ApiService) getNextListLogResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListLogResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListLogResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/serverless/v1/services_environments_variables.go b/rest/serverless/v1/services_environments_variables.go index 891919414..1a95b6e51 100644 --- a/rest/serverless/v1/services_environments_variables.go +++ b/rest/serverless/v1/services_environments_variables.go @@ -18,155 +18,160 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateVariable' type CreateVariableParams struct { - // A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. - Key *string `json:"Key,omitempty"` - // A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. - Value *string `json:"Value,omitempty"` + // A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. + Key *string `json:"Key,omitempty"` + // A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. + Value *string `json:"Value,omitempty"` } -func (params *CreateVariableParams) SetKey(Key string) *CreateVariableParams { - params.Key = &Key - return params +func (params *CreateVariableParams) SetKey(Key string) (*CreateVariableParams){ + params.Key = &Key + return params } -func (params *CreateVariableParams) SetValue(Value string) *CreateVariableParams { - params.Value = &Value - return params +func (params *CreateVariableParams) SetValue(Value string) (*CreateVariableParams){ + params.Value = &Value + return params } // Create a new Variable. func (c *ApiService) CreateVariable(ServiceSid string, EnvironmentSid string, params *CreateVariableParams) (*ServerlessV1Variable, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Variable{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Variable{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Variable. -func (c *ApiService) DeleteVariable(ServiceSid string, EnvironmentSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteVariable(ServiceSid string, EnvironmentSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a specific Variable. -func (c *ApiService) FetchVariable(ServiceSid string, EnvironmentSid string, Sid string) (*ServerlessV1Variable, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchVariable(ServiceSid string, EnvironmentSid string, Sid string, ) (*ServerlessV1Variable, error) { + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Variable{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ServerlessV1Variable{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListVariable' type ListVariableParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVariableParams) SetPageSize(PageSize int) *ListVariableParams { - params.PageSize = &PageSize - return params +func (params *ListVariableParams) SetPageSize(PageSize int) (*ListVariableParams){ + params.PageSize = &PageSize + return params } -func (params *ListVariableParams) SetLimit(Limit int) *ListVariableParams { - params.Limit = &Limit - return params +func (params *ListVariableParams) SetLimit(Limit int) (*ListVariableParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Variable records from the API. Request is executed immediately. func (c *ApiService) PageVariable(ServiceSid string, EnvironmentSid string, params *ListVariableParams, pageToken, pageNumber string) (*ListVariableResponse, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables" + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListVariableResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListVariableResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Variable records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +212,7 @@ func (c *ApiService) StreamVariable(ServiceSid string, EnvironmentSid string, pa return recordChannel, errorChannel } + func (c *ApiService) streamVariable(response *ListVariableResponse, params *ListVariableParams, recordChannel chan ServerlessV1Variable, errorChannel chan error) { curRecord := 1 @@ -238,68 +244,70 @@ func (c *ApiService) streamVariable(response *ListVariableResponse, params *List } func (c *ApiService) getNextListVariableResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVariableResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVariableResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateVariable' type UpdateVariableParams struct { - // A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. - Key *string `json:"Key,omitempty"` - // A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. - Value *string `json:"Value,omitempty"` + // A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. + Key *string `json:"Key,omitempty"` + // A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. + Value *string `json:"Value,omitempty"` } -func (params *UpdateVariableParams) SetKey(Key string) *UpdateVariableParams { - params.Key = &Key - return params +func (params *UpdateVariableParams) SetKey(Key string) (*UpdateVariableParams){ + params.Key = &Key + return params } -func (params *UpdateVariableParams) SetValue(Value string) *UpdateVariableParams { - params.Value = &Value - return params +func (params *UpdateVariableParams) SetValue(Value string) (*UpdateVariableParams){ + params.Value = &Value + return params } // Update a specific Variable. func (c *ApiService) UpdateVariable(ServiceSid string, EnvironmentSid string, Sid string, params *UpdateVariableParams) (*ServerlessV1Variable, error) { - path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"EnvironmentSid"+"}", EnvironmentSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Value != nil { - data.Set("Value", *params.Value) - } + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Value != nil { + data.Set("Value", *params.Value) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Variable{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Variable{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/serverless/v1/services_functions.go b/rest/serverless/v1/services_functions.go index 73dd19964..e2268787a 100644 --- a/rest/serverless/v1/services_functions.go +++ b/rest/serverless/v1/services_functions.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateFunction' type CreateFunctionParams struct { - // A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateFunctionParams) SetFriendlyName(FriendlyName string) *CreateFunctionParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateFunctionParams) SetFriendlyName(FriendlyName string) (*CreateFunctionParams){ + params.FriendlyName = &FriendlyName + return params } // Create a new Function resource. func (c *ApiService) CreateFunction(ServiceSid string, params *CreateFunctionParams) (*ServerlessV1Function, error) { - path := "/v1/Services/{ServiceSid}/Functions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Functions" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Function{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Function{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a Function resource. -func (c *ApiService) DeleteFunction(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Functions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteFunction(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Functions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a specific Function resource. -func (c *ApiService) FetchFunction(ServiceSid string, Sid string) (*ServerlessV1Function, error) { - path := "/v1/Services/{ServiceSid}/Functions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchFunction(ServiceSid string, Sid string, ) (*ServerlessV1Function, error) { + path := "/v1/Services/{ServiceSid}/Functions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1Function{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &ServerlessV1Function{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFunction' type ListFunctionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFunctionParams) SetPageSize(PageSize int) *ListFunctionParams { - params.PageSize = &PageSize - return params +func (params *ListFunctionParams) SetPageSize(PageSize int) (*ListFunctionParams){ + params.PageSize = &PageSize + return params } -func (params *ListFunctionParams) SetLimit(Limit int) *ListFunctionParams { - params.Limit = &Limit - return params +func (params *ListFunctionParams) SetLimit(Limit int) (*ListFunctionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Function records from the API. Request is executed immediately. func (c *ApiService) PageFunction(ServiceSid string, params *ListFunctionParams, pageToken, pageNumber string) (*ListFunctionResponse, error) { - path := "/v1/Services/{ServiceSid}/Functions" + path := "/v1/Services/{ServiceSid}/Functions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFunctionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFunctionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Function records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamFunction(ServiceSid string, params *ListFunctionParam return recordChannel, errorChannel } + func (c *ApiService) streamFunction(response *ListFunctionResponse, params *ListFunctionParams, recordChannel chan ServerlessV1Function, errorChannel chan error) { curRecord := 1 @@ -225,58 +231,60 @@ func (c *ApiService) streamFunction(response *ListFunctionResponse, params *List } func (c *ApiService) getNextListFunctionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFunctionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFunctionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateFunction' type UpdateFunctionParams struct { - // A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the Function resource. It can be a maximum of 255 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateFunctionParams) SetFriendlyName(FriendlyName string) *UpdateFunctionParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateFunctionParams) SetFriendlyName(FriendlyName string) (*UpdateFunctionParams){ + params.FriendlyName = &FriendlyName + return params } // Update a specific Function resource. func (c *ApiService) UpdateFunction(ServiceSid string, Sid string, params *UpdateFunctionParams) (*ServerlessV1Function, error) { - path := "/v1/Services/{ServiceSid}/Functions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Functions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &ServerlessV1Function{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &ServerlessV1Function{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/serverless/v1/services_functions_versions.go b/rest/serverless/v1/services_functions_versions.go index 28f14f84a..ca14cc06f 100644 --- a/rest/serverless/v1/services_functions_versions.go +++ b/rest/serverless/v1/services_functions_versions.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a specific Function Version resource. -func (c *ApiService) FetchFunctionVersion(ServiceSid string, FunctionSid string, Sid string) (*ServerlessV1FunctionVersion, error) { - path := "/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"FunctionSid"+"}", FunctionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchFunctionVersion(ServiceSid string, FunctionSid string, Sid string, ) (*ServerlessV1FunctionVersion, error) { + path := "/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"FunctionSid"+"}", FunctionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &ServerlessV1FunctionVersion{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &ServerlessV1FunctionVersion{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFunctionVersion' type ListFunctionVersionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFunctionVersionParams) SetPageSize(PageSize int) *ListFunctionVersionParams { - params.PageSize = &PageSize - return params +func (params *ListFunctionVersionParams) SetPageSize(PageSize int) (*ListFunctionVersionParams){ + params.PageSize = &PageSize + return params } -func (params *ListFunctionVersionParams) SetLimit(Limit int) *ListFunctionVersionParams { - params.Limit = &Limit - return params +func (params *ListFunctionVersionParams) SetLimit(Limit int) (*ListFunctionVersionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of FunctionVersion records from the API. Request is executed immediately. func (c *ApiService) PageFunctionVersion(ServiceSid string, FunctionSid string, params *ListFunctionVersionParams, pageToken, pageNumber string) (*ListFunctionVersionResponse, error) { - path := "/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions" + path := "/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"FunctionSid"+"}", FunctionSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"FunctionSid"+"}", FunctionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFunctionVersionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFunctionVersionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists FunctionVersion records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamFunctionVersion(ServiceSid string, FunctionSid string return recordChannel, errorChannel } + func (c *ApiService) streamFunctionVersion(response *ListFunctionVersionResponse, params *ListFunctionVersionParams, recordChannel chan ServerlessV1FunctionVersion, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamFunctionVersion(response *ListFunctionVersionResponse } func (c *ApiService) getNextListFunctionVersionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFunctionVersionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFunctionVersionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/serverless/v1/services_functions_versions_content.go b/rest/serverless/v1/services_functions_versions_content.go index d4524759a..ccfdfd21b 100644 --- a/rest/serverless/v1/services_functions_versions_content.go +++ b/rest/serverless/v1/services_functions_versions_content.go @@ -16,31 +16,36 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve a the content of a specific Function Version resource. -func (c *ApiService) FetchFunctionVersionContent(ServiceSid string, FunctionSid string, Sid string) (*ServerlessV1FunctionVersionContent, error) { - path := "/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}/Content" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"FunctionSid"+"}", FunctionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchFunctionVersionContent(ServiceSid string, FunctionSid string, Sid string, ) (*ServerlessV1FunctionVersionContent, error) { + path := "/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}/Content" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"FunctionSid"+"}", FunctionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ServerlessV1FunctionVersionContent{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ServerlessV1FunctionVersionContent{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v1/README.md b/rest/studio/v1/README.md index 339e7a42e..20d27dcb4 100644 --- a/rest/studio/v1/README.md +++ b/rest/studio/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/studio/v1/api_service.go b/rest/studio/v1/api_service.go index e6af2fdce..7f5799158 100644 --- a/rest/studio/v1/api_service.go +++ b/rest/studio/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://studio.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/studio/v1/docs/ListEngagementResponseMeta.md b/rest/studio/v1/docs/ListEngagementResponseMeta.md index 2abe5911d..4abc6bede 100644 --- a/rest/studio/v1/docs/ListEngagementResponseMeta.md +++ b/rest/studio/v1/docs/ListEngagementResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/studio/v1/flows.go b/rest/studio/v1/flows.go index 4cf073e28..ac39d3af0 100644 --- a/rest/studio/v1/flows.go +++ b/rest/studio/v1/flows.go @@ -18,100 +18,105 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific Flow. -func (c *ApiService) DeleteFlow(Sid string) error { - path := "/v1/Flows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteFlow(Sid string, ) (error) { + path := "/v1/Flows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve a specific Flow. -func (c *ApiService) FetchFlow(Sid string) (*StudioV1Flow, error) { - path := "/v1/Flows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchFlow(Sid string, ) (*StudioV1Flow, error) { + path := "/v1/Flows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV1Flow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &StudioV1Flow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListFlow' type ListFlowParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFlowParams) SetPageSize(PageSize int) *ListFlowParams { - params.PageSize = &PageSize - return params +func (params *ListFlowParams) SetPageSize(PageSize int) (*ListFlowParams){ + params.PageSize = &PageSize + return params } -func (params *ListFlowParams) SetLimit(Limit int) *ListFlowParams { - params.Limit = &Limit - return params +func (params *ListFlowParams) SetLimit(Limit int) (*ListFlowParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Flow records from the API. Request is executed immediately. func (c *ApiService) PageFlow(params *ListFlowParams, pageToken, pageNumber string) (*ListFlowResponse, error) { - path := "/v1/Flows" + path := "/v1/Flows" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFlowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFlowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Flow records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -152,6 +157,7 @@ func (c *ApiService) StreamFlow(params *ListFlowParams) (chan StudioV1Flow, chan return recordChannel, errorChannel } + func (c *ApiService) streamFlow(response *ListFlowResponse, params *ListFlowParams, recordChannel chan StudioV1Flow, errorChannel chan error) { curRecord := 1 @@ -183,19 +189,20 @@ func (c *ApiService) streamFlow(response *ListFlowResponse, params *ListFlowPara } func (c *ApiService) getNextListFlowResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFlowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFlowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/studio/v1/flows_engagements.go b/rest/studio/v1/flows_engagements.go index 2d51100b2..55de5b31d 100644 --- a/rest/studio/v1/flows_engagements.go +++ b/rest/studio/v1/flows_engagements.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateEngagement' type CreateEngagementParams struct { - // The Contact phone number to start a Studio Flow Engagement, available as variable `{{contact.channel.address}}`. - To *string `json:"To,omitempty"` - // The Twilio phone number to send messages or initiate calls from during the Flow Engagement. Available as variable `{{flow.channel.address}}` - From *string `json:"From,omitempty"` - // A JSON string we will add to your flow's context and that you can access as variables inside your flow. For example, if you pass in `Parameters={'name':'Zeke'}` then inside a widget you can reference the variable `{{flow.data.name}}` which will return the string 'Zeke'. Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode your JSON string. - Parameters *interface{} `json:"Parameters,omitempty"` + // The Contact phone number to start a Studio Flow Engagement, available as variable `{{contact.channel.address}}`. + To *string `json:"To,omitempty"` + // The Twilio phone number to send messages or initiate calls from during the Flow Engagement. Available as variable `{{flow.channel.address}}` + From *string `json:"From,omitempty"` + // A JSON string we will add to your flow's context and that you can access as variables inside your flow. For example, if you pass in `Parameters={'name':'Zeke'}` then inside a widget you can reference the variable `{{flow.data.name}}` which will return the string 'Zeke'. Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode your JSON string. + Parameters *interface{} `json:"Parameters,omitempty"` } -func (params *CreateEngagementParams) SetTo(To string) *CreateEngagementParams { - params.To = &To - return params +func (params *CreateEngagementParams) SetTo(To string) (*CreateEngagementParams){ + params.To = &To + return params } -func (params *CreateEngagementParams) SetFrom(From string) *CreateEngagementParams { - params.From = &From - return params +func (params *CreateEngagementParams) SetFrom(From string) (*CreateEngagementParams){ + params.From = &From + return params } -func (params *CreateEngagementParams) SetParameters(Parameters interface{}) *CreateEngagementParams { - params.Parameters = &Parameters - return params +func (params *CreateEngagementParams) SetParameters(Parameters interface{}) (*CreateEngagementParams){ + params.Parameters = &Parameters + return params } // Triggers a new Engagement for the Flow func (c *ApiService) CreateEngagement(FlowSid string, params *CreateEngagementParams) (*StudioV1Engagement, error) { - path := "/v1/Flows/{FlowSid}/Engagements" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path := "/v1/Flows/{FlowSid}/Engagements" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Parameters != nil { - v, err := json.Marshal(params.Parameters) + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Parameters != nil { + v, err := json.Marshal(params.Parameters) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Parameters", string(v)) - } + data.Set("Parameters", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV1Engagement{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &StudioV1Engagement{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete this Engagement and all Steps relating to it. -func (c *ApiService) DeleteEngagement(FlowSid string, Sid string) error { - path := "/v1/Flows/{FlowSid}/Engagements/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteEngagement(FlowSid string, Sid string, ) (error) { + path := "/v1/Flows/{FlowSid}/Engagements/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Retrieve an Engagement -func (c *ApiService) FetchEngagement(FlowSid string, Sid string) (*StudioV1Engagement, error) { - path := "/v1/Flows/{FlowSid}/Engagements/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEngagement(FlowSid string, Sid string, ) (*StudioV1Engagement, error) { + path := "/v1/Flows/{FlowSid}/Engagements/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV1Engagement{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &StudioV1Engagement{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEngagement' type ListEngagementParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEngagementParams) SetPageSize(PageSize int) *ListEngagementParams { - params.PageSize = &PageSize - return params +func (params *ListEngagementParams) SetPageSize(PageSize int) (*ListEngagementParams){ + params.PageSize = &PageSize + return params } -func (params *ListEngagementParams) SetLimit(Limit int) *ListEngagementParams { - params.Limit = &Limit - return params +func (params *ListEngagementParams) SetLimit(Limit int) (*ListEngagementParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Engagement records from the API. Request is executed immediately. func (c *ApiService) PageEngagement(FlowSid string, params *ListEngagementParams, pageToken, pageNumber string) (*ListEngagementResponse, error) { - path := "/v1/Flows/{FlowSid}/Engagements" + path := "/v1/Flows/{FlowSid}/Engagements" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEngagementResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEngagementResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Engagement records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamEngagement(FlowSid string, params *ListEngagementPara return recordChannel, errorChannel } + func (c *ApiService) streamEngagement(response *ListEngagementResponse, params *ListEngagementParams, recordChannel chan StudioV1Engagement, errorChannel chan error) { curRecord := 1 @@ -249,19 +255,20 @@ func (c *ApiService) streamEngagement(response *ListEngagementResponse, params * } func (c *ApiService) getNextListEngagementResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEngagementResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEngagementResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/studio/v1/flows_engagements_context.go b/rest/studio/v1/flows_engagements_context.go index d6d963662..2394bd34d 100644 --- a/rest/studio/v1/flows_engagements_context.go +++ b/rest/studio/v1/flows_engagements_context.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the most recent context for an Engagement. -func (c *ApiService) FetchEngagementContext(FlowSid string, EngagementSid string) (*StudioV1EngagementContext, error) { - path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Context" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) +func (c *ApiService) FetchEngagementContext(FlowSid string, EngagementSid string, ) (*StudioV1EngagementContext, error) { + path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Context" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV1EngagementContext{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV1EngagementContext{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v1/flows_engagements_steps.go b/rest/studio/v1/flows_engagements_steps.go index 11dac1105..4a31caf37 100644 --- a/rest/studio/v1/flows_engagements_steps.go +++ b/rest/studio/v1/flows_engagements_steps.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a Step. -func (c *ApiService) FetchStep(FlowSid string, EngagementSid string, Sid string) (*StudioV1Step, error) { - path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Steps/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchStep(FlowSid string, EngagementSid string, Sid string, ) (*StudioV1Step, error) { + path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Steps/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV1Step{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &StudioV1Step{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListStep' type ListStepParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListStepParams) SetPageSize(PageSize int) *ListStepParams { - params.PageSize = &PageSize - return params +func (params *ListStepParams) SetPageSize(PageSize int) (*ListStepParams){ + params.PageSize = &PageSize + return params } -func (params *ListStepParams) SetLimit(Limit int) *ListStepParams { - params.Limit = &Limit - return params +func (params *ListStepParams) SetLimit(Limit int) (*ListStepParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Step records from the API. Request is executed immediately. func (c *ApiService) PageStep(FlowSid string, EngagementSid string, params *ListStepParams, pageToken, pageNumber string) (*ListStepResponse, error) { - path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Steps" + path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Steps" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListStepResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListStepResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Step records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamStep(FlowSid string, EngagementSid string, params *Li return recordChannel, errorChannel } + func (c *ApiService) streamStep(response *ListStepResponse, params *ListStepParams, recordChannel chan StudioV1Step, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamStep(response *ListStepResponse, params *ListStepPara } func (c *ApiService) getNextListStepResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListStepResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListStepResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/studio/v1/flows_engagements_steps_context.go b/rest/studio/v1/flows_engagements_steps_context.go index 882d50c84..545c44d4f 100644 --- a/rest/studio/v1/flows_engagements_steps_context.go +++ b/rest/studio/v1/flows_engagements_steps_context.go @@ -16,31 +16,36 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the context for an Engagement Step. -func (c *ApiService) FetchStepContext(FlowSid string, EngagementSid string, StepSid string) (*StudioV1StepContext, error) { - path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Steps/{StepSid}/Context" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) - path = strings.Replace(path, "{"+"StepSid"+"}", StepSid, -1) +func (c *ApiService) FetchStepContext(FlowSid string, EngagementSid string, StepSid string, ) (*StudioV1StepContext, error) { + path := "/v1/Flows/{FlowSid}/Engagements/{EngagementSid}/Steps/{StepSid}/Context" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"EngagementSid"+"}", EngagementSid, -1) + path = strings.Replace(path, "{"+"StepSid"+"}", StepSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV1StepContext{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV1StepContext{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v1/flows_executions.go b/rest/studio/v1/flows_executions.go index 6e6f9287a..ab55e8831 100644 --- a/rest/studio/v1/flows_executions.go +++ b/rest/studio/v1/flows_executions.go @@ -18,185 +18,189 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateExecution' type CreateExecutionParams struct { - // The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. - To *string `json:"To,omitempty"` - // The Twilio phone number to send messages or initiate calls from during the Flow's Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. - From *string `json:"From,omitempty"` - // JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. - Parameters *interface{} `json:"Parameters,omitempty"` + // The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. + To *string `json:"To,omitempty"` + // The Twilio phone number to send messages or initiate calls from during the Flow's Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. + From *string `json:"From,omitempty"` + // JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. + Parameters *interface{} `json:"Parameters,omitempty"` } -func (params *CreateExecutionParams) SetTo(To string) *CreateExecutionParams { - params.To = &To - return params +func (params *CreateExecutionParams) SetTo(To string) (*CreateExecutionParams){ + params.To = &To + return params } -func (params *CreateExecutionParams) SetFrom(From string) *CreateExecutionParams { - params.From = &From - return params +func (params *CreateExecutionParams) SetFrom(From string) (*CreateExecutionParams){ + params.From = &From + return params } -func (params *CreateExecutionParams) SetParameters(Parameters interface{}) *CreateExecutionParams { - params.Parameters = &Parameters - return params +func (params *CreateExecutionParams) SetParameters(Parameters interface{}) (*CreateExecutionParams){ + params.Parameters = &Parameters + return params } // Triggers a new Execution for the Flow func (c *ApiService) CreateExecution(FlowSid string, params *CreateExecutionParams) (*StudioV1Execution, error) { - path := "/v1/Flows/{FlowSid}/Executions" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path := "/v1/Flows/{FlowSid}/Executions" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Parameters != nil { - v, err := json.Marshal(params.Parameters) + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Parameters != nil { + v, err := json.Marshal(params.Parameters) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Parameters", string(v)) - } + data.Set("Parameters", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV1Execution{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &StudioV1Execution{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete the Execution and all Steps relating to it. -func (c *ApiService) DeleteExecution(FlowSid string, Sid string) error { - path := "/v1/Flows/{FlowSid}/Executions/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteExecution(FlowSid string, Sid string, ) (error) { + path := "/v1/Flows/{FlowSid}/Executions/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve an Execution -func (c *ApiService) FetchExecution(FlowSid string, Sid string) (*StudioV1Execution, error) { - path := "/v1/Flows/{FlowSid}/Executions/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchExecution(FlowSid string, Sid string, ) (*StudioV1Execution, error) { + path := "/v1/Flows/{FlowSid}/Executions/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV1Execution{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &StudioV1Execution{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListExecution' type ListExecutionParams struct { - // Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. - DateCreatedFrom *time.Time `json:"DateCreatedFrom,omitempty"` - // Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. - DateCreatedTo *time.Time `json:"DateCreatedTo,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. + DateCreatedFrom *time.Time `json:"DateCreatedFrom,omitempty"` + // Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. + DateCreatedTo *time.Time `json:"DateCreatedTo,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListExecutionParams) SetDateCreatedFrom(DateCreatedFrom time.Time) *ListExecutionParams { - params.DateCreatedFrom = &DateCreatedFrom - return params +func (params *ListExecutionParams) SetDateCreatedFrom(DateCreatedFrom time.Time) (*ListExecutionParams){ + params.DateCreatedFrom = &DateCreatedFrom + return params } -func (params *ListExecutionParams) SetDateCreatedTo(DateCreatedTo time.Time) *ListExecutionParams { - params.DateCreatedTo = &DateCreatedTo - return params +func (params *ListExecutionParams) SetDateCreatedTo(DateCreatedTo time.Time) (*ListExecutionParams){ + params.DateCreatedTo = &DateCreatedTo + return params } -func (params *ListExecutionParams) SetPageSize(PageSize int) *ListExecutionParams { - params.PageSize = &PageSize - return params +func (params *ListExecutionParams) SetPageSize(PageSize int) (*ListExecutionParams){ + params.PageSize = &PageSize + return params } -func (params *ListExecutionParams) SetLimit(Limit int) *ListExecutionParams { - params.Limit = &Limit - return params +func (params *ListExecutionParams) SetLimit(Limit int) (*ListExecutionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Execution records from the API. Request is executed immediately. func (c *ApiService) PageExecution(FlowSid string, params *ListExecutionParams, pageToken, pageNumber string) (*ListExecutionResponse, error) { - path := "/v1/Flows/{FlowSid}/Executions" - - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreatedFrom != nil { - data.Set("DateCreatedFrom", fmt.Sprint((*params.DateCreatedFrom).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedTo != nil { - data.Set("DateCreatedTo", fmt.Sprint((*params.DateCreatedTo).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExecutionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Flows/{FlowSid}/Executions" + + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreatedFrom != nil { + data.Set("DateCreatedFrom", fmt.Sprint((*params.DateCreatedFrom).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedTo != nil { + data.Set("DateCreatedTo", fmt.Sprint((*params.DateCreatedTo).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExecutionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Execution records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -237,6 +241,7 @@ func (c *ApiService) StreamExecution(FlowSid string, params *ListExecutionParams return recordChannel, errorChannel } + func (c *ApiService) streamExecution(response *ListExecutionResponse, params *ListExecutionParams, recordChannel chan StudioV1Execution, errorChannel chan error) { curRecord := 1 @@ -268,58 +273,60 @@ func (c *ApiService) streamExecution(response *ListExecutionResponse, params *Li } func (c *ApiService) getNextListExecutionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExecutionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExecutionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateExecution' type UpdateExecutionParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateExecutionParams) SetStatus(Status string) *UpdateExecutionParams { - params.Status = &Status - return params +func (params *UpdateExecutionParams) SetStatus(Status string) (*UpdateExecutionParams){ + params.Status = &Status + return params } // Update the status of an Execution to `ended`. func (c *ApiService) UpdateExecution(FlowSid string, Sid string, params *UpdateExecutionParams) (*StudioV1Execution, error) { - path := "/v1/Flows/{FlowSid}/Executions/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Flows/{FlowSid}/Executions/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV1Execution{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &StudioV1Execution{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v1/flows_executions_context.go b/rest/studio/v1/flows_executions_context.go index c7eb6665a..65cf36134 100644 --- a/rest/studio/v1/flows_executions_context.go +++ b/rest/studio/v1/flows_executions_context.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the most recent context for an Execution. -func (c *ApiService) FetchExecutionContext(FlowSid string, ExecutionSid string) (*StudioV1ExecutionContext, error) { - path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Context" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) +func (c *ApiService) FetchExecutionContext(FlowSid string, ExecutionSid string, ) (*StudioV1ExecutionContext, error) { + path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Context" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV1ExecutionContext{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV1ExecutionContext{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v1/flows_executions_steps.go b/rest/studio/v1/flows_executions_steps.go index c4423c3ff..85e3a5a42 100644 --- a/rest/studio/v1/flows_executions_steps.go +++ b/rest/studio/v1/flows_executions_steps.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a Step. -func (c *ApiService) FetchExecutionStep(FlowSid string, ExecutionSid string, Sid string) (*StudioV1ExecutionStep, error) { - path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchExecutionStep(FlowSid string, ExecutionSid string, Sid string, ) (*StudioV1ExecutionStep, error) { + path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV1ExecutionStep{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &StudioV1ExecutionStep{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListExecutionStep' type ListExecutionStepParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListExecutionStepParams) SetPageSize(PageSize int) *ListExecutionStepParams { - params.PageSize = &PageSize - return params +func (params *ListExecutionStepParams) SetPageSize(PageSize int) (*ListExecutionStepParams){ + params.PageSize = &PageSize + return params } -func (params *ListExecutionStepParams) SetLimit(Limit int) *ListExecutionStepParams { - params.Limit = &Limit - return params +func (params *ListExecutionStepParams) SetLimit(Limit int) (*ListExecutionStepParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ExecutionStep records from the API. Request is executed immediately. func (c *ApiService) PageExecutionStep(FlowSid string, ExecutionSid string, params *ListExecutionStepParams, pageToken, pageNumber string) (*ListExecutionStepResponse, error) { - path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps" + path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListExecutionStepResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListExecutionStepResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ExecutionStep records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamExecutionStep(FlowSid string, ExecutionSid string, pa return recordChannel, errorChannel } + func (c *ApiService) streamExecutionStep(response *ListExecutionStepResponse, params *ListExecutionStepParams, recordChannel chan StudioV1ExecutionStep, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamExecutionStep(response *ListExecutionStepResponse, pa } func (c *ApiService) getNextListExecutionStepResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExecutionStepResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExecutionStepResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/studio/v1/flows_executions_steps_context.go b/rest/studio/v1/flows_executions_steps_context.go index 338594176..d0b59f215 100644 --- a/rest/studio/v1/flows_executions_steps_context.go +++ b/rest/studio/v1/flows_executions_steps_context.go @@ -16,31 +16,36 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the context for an Execution Step. -func (c *ApiService) FetchExecutionStepContext(FlowSid string, ExecutionSid string, StepSid string) (*StudioV1ExecutionStepContext, error) { - path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{StepSid}/Context" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) - path = strings.Replace(path, "{"+"StepSid"+"}", StepSid, -1) +func (c *ApiService) FetchExecutionStepContext(FlowSid string, ExecutionSid string, StepSid string, ) (*StudioV1ExecutionStepContext, error) { + path := "/v1/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{StepSid}/Context" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + path = strings.Replace(path, "{"+"StepSid"+"}", StepSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV1ExecutionStepContext{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV1ExecutionStepContext{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v1/model_list_engagement_response.go b/rest/studio/v1/model_list_engagement_response.go index 4649682a6..cf3158aba 100644 --- a/rest/studio/v1/model_list_engagement_response.go +++ b/rest/studio/v1/model_list_engagement_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEngagementResponse struct for ListEngagementResponse type ListEngagementResponse struct { - Engagements []StudioV1Engagement `json:"engagements,omitempty"` - Meta ListEngagementResponseMeta `json:"meta,omitempty"` + Engagements []StudioV1Engagement `json:"engagements,omitempty"` + Meta ListEngagementResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v1/model_list_engagement_response_meta.go b/rest/studio/v1/model_list_engagement_response_meta.go index 8e09cc6e2..9b6adeefa 100644 --- a/rest/studio/v1/model_list_engagement_response_meta.go +++ b/rest/studio/v1/model_list_engagement_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEngagementResponseMeta struct for ListEngagementResponseMeta type ListEngagementResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/studio/v1/model_list_execution_response.go b/rest/studio/v1/model_list_execution_response.go index 0c0f25d14..fa007bbfa 100644 --- a/rest/studio/v1/model_list_execution_response.go +++ b/rest/studio/v1/model_list_execution_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListExecutionResponse struct for ListExecutionResponse type ListExecutionResponse struct { - Executions []StudioV1Execution `json:"executions,omitempty"` - Meta ListEngagementResponseMeta `json:"meta,omitempty"` + Executions []StudioV1Execution `json:"executions,omitempty"` + Meta ListEngagementResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v1/model_list_execution_step_response.go b/rest/studio/v1/model_list_execution_step_response.go index 5fb275cc4..a5793b471 100644 --- a/rest/studio/v1/model_list_execution_step_response.go +++ b/rest/studio/v1/model_list_execution_step_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListExecutionStepResponse struct for ListExecutionStepResponse type ListExecutionStepResponse struct { - Steps []StudioV1ExecutionStep `json:"steps,omitempty"` - Meta ListEngagementResponseMeta `json:"meta,omitempty"` + Steps []StudioV1ExecutionStep `json:"steps,omitempty"` + Meta ListEngagementResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v1/model_list_flow_response.go b/rest/studio/v1/model_list_flow_response.go index f662e786f..2b5783f8c 100644 --- a/rest/studio/v1/model_list_flow_response.go +++ b/rest/studio/v1/model_list_flow_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFlowResponse struct for ListFlowResponse type ListFlowResponse struct { - Flows []StudioV1Flow `json:"flows,omitempty"` - Meta ListEngagementResponseMeta `json:"meta,omitempty"` + Flows []StudioV1Flow `json:"flows,omitempty"` + Meta ListEngagementResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v1/model_list_step_response.go b/rest/studio/v1/model_list_step_response.go index 7a3d1827e..05e6ccf66 100644 --- a/rest/studio/v1/model_list_step_response.go +++ b/rest/studio/v1/model_list_step_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListStepResponse struct for ListStepResponse type ListStepResponse struct { - Steps []StudioV1Step `json:"steps,omitempty"` - Meta ListEngagementResponseMeta `json:"meta,omitempty"` + Steps []StudioV1Step `json:"steps,omitempty"` + Meta ListEngagementResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_engagement.go b/rest/studio/v1/model_studio_v1_engagement.go index 94481ed64..fa272da1e 100644 --- a/rest/studio/v1/model_studio_v1_engagement.go +++ b/rest/studio/v1/model_studio_v1_engagement.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV1Engagement struct for StudioV1Engagement type StudioV1Engagement struct { - // The unique string that we created to identify the Engagement resource. + // The unique string that we created to identify the Engagement resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Engagement resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Engagement resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Contact. + // The SID of the Contact. ContactSid *string `json:"contact_sid,omitempty"` - // The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. + // The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. ContactChannelAddress *string `json:"contact_channel_address,omitempty"` - // The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution. + // The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT when the Engagement was created in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Status *string `json:"status,omitempty"` + // The date and time in GMT when the Engagement was created in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Engagement was updated in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Engagement was updated in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of the Engagement's nested resources. + // The URLs of the Engagement's nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_engagement_context.go b/rest/studio/v1/model_studio_v1_engagement_context.go index f5fefb97e..836a71e9b 100644 --- a/rest/studio/v1/model_studio_v1_engagement_context.go +++ b/rest/studio/v1/model_studio_v1_engagement_context.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV1EngagementContext struct for StudioV1EngagementContext type StudioV1EngagementContext struct { - // The SID of the Account. + // The SID of the Account. AccountSid *string `json:"account_sid,omitempty"` - // As your flow executes, we save the state in what's called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution. + // As your flow executes, we save the state in what's called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The SID of the Engagement. + // The SID of the Engagement. EngagementSid *string `json:"engagement_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The URL of the resource. + // The URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_execution.go b/rest/studio/v1/model_studio_v1_execution.go index f996b4425..58c06cd9f 100644 --- a/rest/studio/v1/model_studio_v1_execution.go +++ b/rest/studio/v1/model_studio_v1_execution.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV1Execution struct for StudioV1Execution type StudioV1Execution struct { - // The unique string that we created to identify the Execution resource. + // The unique string that we created to identify the Execution resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Contact. + // The SID of the Contact. ContactSid *string `json:"contact_sid,omitempty"` - // The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. + // The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. ContactChannelAddress *string `json:"contact_channel_address,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Status *string `json:"status,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of nested resources. + // The URLs of nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_execution_context.go b/rest/studio/v1/model_studio_v1_execution_context.go index 9a4f4ab13..7bf051b7a 100644 --- a/rest/studio/v1/model_studio_v1_execution_context.go +++ b/rest/studio/v1/model_studio_v1_execution_context.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV1ExecutionContext struct for StudioV1ExecutionContext type StudioV1ExecutionContext struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. AccountSid *string `json:"account_sid,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the context's Execution resource. + // The SID of the context's Execution resource. ExecutionSid *string `json:"execution_sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_execution_step.go b/rest/studio/v1/model_studio_v1_execution_step.go index c0e96f41c..315fbe879 100644 --- a/rest/studio/v1/model_studio_v1_execution_step.go +++ b/rest/studio/v1/model_studio_v1_execution_step.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV1ExecutionStep struct for StudioV1ExecutionStep type StudioV1ExecutionStep struct { - // The unique string that we created to identify the ExecutionStep resource. + // The unique string that we created to identify the ExecutionStep resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Step's Execution resource. + // The SID of the Step's Execution resource. ExecutionSid *string `json:"execution_sid,omitempty"` - // The event that caused the Flow to transition to the Step. + // The event that caused the Flow to transition to the Step. Name *string `json:"name,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The Widget that preceded the Widget for the Step. + // The Widget that preceded the Widget for the Step. TransitionedFrom *string `json:"transitioned_from,omitempty"` - // The Widget that will follow the Widget for the Step. + // The Widget that will follow the Widget for the Step. TransitionedTo *string `json:"transitioned_to,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_execution_step_context.go b/rest/studio/v1/model_studio_v1_execution_step_context.go index 19431cc07..971e0b5b6 100644 --- a/rest/studio/v1/model_studio_v1_execution_step_context.go +++ b/rest/studio/v1/model_studio_v1_execution_step_context.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV1ExecutionStepContext struct for StudioV1ExecutionStepContext type StudioV1ExecutionStepContext struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. AccountSid *string `json:"account_sid,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The SID of the context's Execution resource. + // The SID of the context's Execution resource. ExecutionSid *string `json:"execution_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Step that the context is associated with. + // The SID of the Step that the context is associated with. StepSid *string `json:"step_sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_flow.go b/rest/studio/v1/model_studio_v1_flow.go index 33b38e232..7ed918d32 100644 --- a/rest/studio/v1/model_studio_v1_flow.go +++ b/rest/studio/v1/model_studio_v1_flow.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV1Flow struct for StudioV1Flow type StudioV1Flow struct { - // The unique string that we created to identify the Flow resource. + // The unique string that we created to identify the Flow resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the Flow. + // The string that you assigned to describe the Flow. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // The latest version number of the Flow's definition. + Status *string `json:"status,omitempty"` + // The latest version number of the Flow's definition. Version *int `json:"version,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of the Flow's nested resources. + // The URLs of the Flow's nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_step.go b/rest/studio/v1/model_studio_v1_step.go index 31fd850f1..46d26964c 100644 --- a/rest/studio/v1/model_studio_v1_step.go +++ b/rest/studio/v1/model_studio_v1_step.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV1Step struct for StudioV1Step type StudioV1Step struct { - // The unique string that we created to identify the Step resource. + // The unique string that we created to identify the Step resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Engagement. + // The SID of the Engagement. EngagementSid *string `json:"engagement_sid,omitempty"` - // The event that caused the Flow to transition to the Step. + // The event that caused the Flow to transition to the Step. Name *string `json:"name,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The Widget that preceded the Widget for the Step. + // The Widget that preceded the Widget for the Step. TransitionedFrom *string `json:"transitioned_from,omitempty"` - // The Widget that will follow the Widget for the Step. + // The Widget that will follow the Widget for the Step. TransitionedTo *string `json:"transitioned_to,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v1/model_studio_v1_step_context.go b/rest/studio/v1/model_studio_v1_step_context.go index 2e1f4994d..033fb45f0 100644 --- a/rest/studio/v1/model_studio_v1_step_context.go +++ b/rest/studio/v1/model_studio_v1_step_context.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV1StepContext struct for StudioV1StepContext type StudioV1StepContext struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource. AccountSid *string `json:"account_sid,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The SID of the Engagement. + // The SID of the Engagement. EngagementSid *string `json:"engagement_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Step the context is associated with. + // The SID of the Step the context is associated with. StepSid *string `json:"step_sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v2/README.md b/rest/studio/v2/README.md index 667db4557..bf57ca87d 100644 --- a/rest/studio/v2/README.md +++ b/rest/studio/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/studio/v2/api_service.go b/rest/studio/v2/api_service.go index e6af2fdce..7f5799158 100644 --- a/rest/studio/v2/api_service.go +++ b/rest/studio/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://studio.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/studio/v2/docs/ListExecutionResponseMeta.md b/rest/studio/v2/docs/ListExecutionResponseMeta.md index 107384286..48b614247 100644 --- a/rest/studio/v2/docs/ListExecutionResponseMeta.md +++ b/rest/studio/v2/docs/ListExecutionResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/studio/v2/flows.go b/rest/studio/v2/flows.go index faa9f4dd3..b90dae684 100644 --- a/rest/studio/v2/flows.go +++ b/rest/studio/v2/flows.go @@ -18,170 +18,176 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateFlow' type CreateFlowParams struct { - // The string that you assigned to describe the Flow. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Status *string `json:"Status,omitempty"` - // JSON representation of flow definition. - Definition *interface{} `json:"Definition,omitempty"` - // Description of change made in the revision. - CommitMessage *string `json:"CommitMessage,omitempty"` + // The string that you assigned to describe the Flow. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Status *string `json:"Status,omitempty"` + // JSON representation of flow definition. + Definition *interface{} `json:"Definition,omitempty"` + // Description of change made in the revision. + CommitMessage *string `json:"CommitMessage,omitempty"` } -func (params *CreateFlowParams) SetFriendlyName(FriendlyName string) *CreateFlowParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateFlowParams) SetFriendlyName(FriendlyName string) (*CreateFlowParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateFlowParams) SetStatus(Status string) *CreateFlowParams { - params.Status = &Status - return params +func (params *CreateFlowParams) SetStatus(Status string) (*CreateFlowParams){ + params.Status = &Status + return params } -func (params *CreateFlowParams) SetDefinition(Definition interface{}) *CreateFlowParams { - params.Definition = &Definition - return params +func (params *CreateFlowParams) SetDefinition(Definition interface{}) (*CreateFlowParams){ + params.Definition = &Definition + return params } -func (params *CreateFlowParams) SetCommitMessage(CommitMessage string) *CreateFlowParams { - params.CommitMessage = &CommitMessage - return params +func (params *CreateFlowParams) SetCommitMessage(CommitMessage string) (*CreateFlowParams){ + params.CommitMessage = &CommitMessage + return params } // Create a Flow. func (c *ApiService) CreateFlow(params *CreateFlowParams) (*StudioV2Flow, error) { - path := "/v2/Flows" + path := "/v2/Flows" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Definition != nil { + v, err := json.Marshal(params.Definition) + + if err != nil { + return nil, err + } + + data.Set("Definition", string(v)) + } + if params != nil && params.CommitMessage != nil { + data.Set("CommitMessage", *params.CommitMessage) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &StudioV2Flow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// Delete a specific Flow. +func (c *ApiService) DeleteFlow(Sid string, ) (error) { + path := "/v2/Flows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Definition != nil { - v, err := json.Marshal(params.Definition) + data := url.Values{} + headers := make(map[string]interface{}) - if err != nil { - return nil, err - } - data.Set("Definition", string(v)) - } - if params != nil && params.CommitMessage != nil { - data.Set("CommitMessage", *params.CommitMessage) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() - - ps := &StudioV2Flow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + return nil } -// Delete a specific Flow. -func (c *ApiService) DeleteFlow(Sid string) error { - path := "/v2/Flows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// Retrieve a specific Flow. +func (c *ApiService) FetchFlow(Sid string, ) (*StudioV2Flow, error) { + path := "/v2/Flows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil -} + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } -// Retrieve a specific Flow. -func (c *ApiService) FetchFlow(Sid string) (*StudioV2Flow, error) { - path := "/v2/Flows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + ps := &StudioV2Flow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &StudioV2Flow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListFlow' type ListFlowParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFlowParams) SetPageSize(PageSize int) *ListFlowParams { - params.PageSize = &PageSize - return params +func (params *ListFlowParams) SetPageSize(PageSize int) (*ListFlowParams){ + params.PageSize = &PageSize + return params } -func (params *ListFlowParams) SetLimit(Limit int) *ListFlowParams { - params.Limit = &Limit - return params +func (params *ListFlowParams) SetLimit(Limit int) (*ListFlowParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Flow records from the API. Request is executed immediately. func (c *ApiService) PageFlow(params *ListFlowParams, pageToken, pageNumber string) (*ListFlowResponse, error) { - path := "/v2/Flows" + path := "/v2/Flows" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFlowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFlowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Flow records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -222,6 +228,7 @@ func (c *ApiService) StreamFlow(params *ListFlowParams) (chan StudioV2Flow, chan return recordChannel, errorChannel } + func (c *ApiService) streamFlow(response *ListFlowResponse, params *ListFlowParams, recordChannel chan StudioV2Flow, errorChannel chan error) { curRecord := 1 @@ -253,90 +260,92 @@ func (c *ApiService) streamFlow(response *ListFlowResponse, params *ListFlowPara } func (c *ApiService) getNextListFlowResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFlowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFlowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateFlow' type UpdateFlowParams struct { - // - Status *string `json:"Status,omitempty"` - // The string that you assigned to describe the Flow. - FriendlyName *string `json:"FriendlyName,omitempty"` - // JSON representation of flow definition. - Definition *interface{} `json:"Definition,omitempty"` - // Description of change made in the revision. - CommitMessage *string `json:"CommitMessage,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The string that you assigned to describe the Flow. + FriendlyName *string `json:"FriendlyName,omitempty"` + // JSON representation of flow definition. + Definition *interface{} `json:"Definition,omitempty"` + // Description of change made in the revision. + CommitMessage *string `json:"CommitMessage,omitempty"` } -func (params *UpdateFlowParams) SetStatus(Status string) *UpdateFlowParams { - params.Status = &Status - return params +func (params *UpdateFlowParams) SetStatus(Status string) (*UpdateFlowParams){ + params.Status = &Status + return params } -func (params *UpdateFlowParams) SetFriendlyName(FriendlyName string) *UpdateFlowParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateFlowParams) SetFriendlyName(FriendlyName string) (*UpdateFlowParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateFlowParams) SetDefinition(Definition interface{}) *UpdateFlowParams { - params.Definition = &Definition - return params +func (params *UpdateFlowParams) SetDefinition(Definition interface{}) (*UpdateFlowParams){ + params.Definition = &Definition + return params } -func (params *UpdateFlowParams) SetCommitMessage(CommitMessage string) *UpdateFlowParams { - params.CommitMessage = &CommitMessage - return params +func (params *UpdateFlowParams) SetCommitMessage(CommitMessage string) (*UpdateFlowParams){ + params.CommitMessage = &CommitMessage + return params } // Update a Flow. func (c *ApiService) UpdateFlow(Sid string, params *UpdateFlowParams) (*StudioV2Flow, error) { - path := "/v2/Flows/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Flows/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Definition != nil { - v, err := json.Marshal(params.Definition) + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Definition != nil { + v, err := json.Marshal(params.Definition) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Definition", string(v)) - } - if params != nil && params.CommitMessage != nil { - data.Set("CommitMessage", *params.CommitMessage) - } + data.Set("Definition", string(v)) + } + if params != nil && params.CommitMessage != nil { + data.Set("CommitMessage", *params.CommitMessage) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV2Flow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &StudioV2Flow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v2/flows_executions.go b/rest/studio/v2/flows_executions.go index f3f74c070..20f38e7ac 100644 --- a/rest/studio/v2/flows_executions.go +++ b/rest/studio/v2/flows_executions.go @@ -18,185 +18,189 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateExecution' type CreateExecutionParams struct { - // The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. - To *string `json:"To,omitempty"` - // The Twilio phone number to send messages or initiate calls from during the Flow's Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. - From *string `json:"From,omitempty"` - // JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. - Parameters *interface{} `json:"Parameters,omitempty"` + // The Contact phone number to start a Studio Flow Execution, available as variable `{{contact.channel.address}}`. + To *string `json:"To,omitempty"` + // The Twilio phone number to send messages or initiate calls from during the Flow's Execution. Available as variable `{{flow.channel.address}}`. For SMS, this can also be a Messaging Service SID. + From *string `json:"From,omitempty"` + // JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={\\\"name\\\":\\\"Zeke\\\"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns \\\"Zeke\\\". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. + Parameters *interface{} `json:"Parameters,omitempty"` } -func (params *CreateExecutionParams) SetTo(To string) *CreateExecutionParams { - params.To = &To - return params +func (params *CreateExecutionParams) SetTo(To string) (*CreateExecutionParams){ + params.To = &To + return params } -func (params *CreateExecutionParams) SetFrom(From string) *CreateExecutionParams { - params.From = &From - return params +func (params *CreateExecutionParams) SetFrom(From string) (*CreateExecutionParams){ + params.From = &From + return params } -func (params *CreateExecutionParams) SetParameters(Parameters interface{}) *CreateExecutionParams { - params.Parameters = &Parameters - return params +func (params *CreateExecutionParams) SetParameters(Parameters interface{}) (*CreateExecutionParams){ + params.Parameters = &Parameters + return params } // Triggers a new Execution for the Flow func (c *ApiService) CreateExecution(FlowSid string, params *CreateExecutionParams) (*StudioV2Execution, error) { - path := "/v2/Flows/{FlowSid}/Executions" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path := "/v2/Flows/{FlowSid}/Executions" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Parameters != nil { - v, err := json.Marshal(params.Parameters) + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Parameters != nil { + v, err := json.Marshal(params.Parameters) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Parameters", string(v)) - } + data.Set("Parameters", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV2Execution{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &StudioV2Execution{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete the Execution and all Steps relating to it. -func (c *ApiService) DeleteExecution(FlowSid string, Sid string) error { - path := "/v2/Flows/{FlowSid}/Executions/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteExecution(FlowSid string, Sid string, ) (error) { + path := "/v2/Flows/{FlowSid}/Executions/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Retrieve an Execution -func (c *ApiService) FetchExecution(FlowSid string, Sid string) (*StudioV2Execution, error) { - path := "/v2/Flows/{FlowSid}/Executions/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchExecution(FlowSid string, Sid string, ) (*StudioV2Execution, error) { + path := "/v2/Flows/{FlowSid}/Executions/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV2Execution{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &StudioV2Execution{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListExecution' type ListExecutionParams struct { - // Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. - DateCreatedFrom *time.Time `json:"DateCreatedFrom,omitempty"` - // Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. - DateCreatedTo *time.Time `json:"DateCreatedTo,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. + DateCreatedFrom *time.Time `json:"DateCreatedFrom,omitempty"` + // Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. + DateCreatedTo *time.Time `json:"DateCreatedTo,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListExecutionParams) SetDateCreatedFrom(DateCreatedFrom time.Time) *ListExecutionParams { - params.DateCreatedFrom = &DateCreatedFrom - return params +func (params *ListExecutionParams) SetDateCreatedFrom(DateCreatedFrom time.Time) (*ListExecutionParams){ + params.DateCreatedFrom = &DateCreatedFrom + return params } -func (params *ListExecutionParams) SetDateCreatedTo(DateCreatedTo time.Time) *ListExecutionParams { - params.DateCreatedTo = &DateCreatedTo - return params +func (params *ListExecutionParams) SetDateCreatedTo(DateCreatedTo time.Time) (*ListExecutionParams){ + params.DateCreatedTo = &DateCreatedTo + return params } -func (params *ListExecutionParams) SetPageSize(PageSize int) *ListExecutionParams { - params.PageSize = &PageSize - return params +func (params *ListExecutionParams) SetPageSize(PageSize int) (*ListExecutionParams){ + params.PageSize = &PageSize + return params } -func (params *ListExecutionParams) SetLimit(Limit int) *ListExecutionParams { - params.Limit = &Limit - return params +func (params *ListExecutionParams) SetLimit(Limit int) (*ListExecutionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Execution records from the API. Request is executed immediately. func (c *ApiService) PageExecution(FlowSid string, params *ListExecutionParams, pageToken, pageNumber string) (*ListExecutionResponse, error) { - path := "/v2/Flows/{FlowSid}/Executions" - - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreatedFrom != nil { - data.Set("DateCreatedFrom", fmt.Sprint((*params.DateCreatedFrom).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedTo != nil { - data.Set("DateCreatedTo", fmt.Sprint((*params.DateCreatedTo).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExecutionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Flows/{FlowSid}/Executions" + + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreatedFrom != nil { + data.Set("DateCreatedFrom", fmt.Sprint((*params.DateCreatedFrom).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedTo != nil { + data.Set("DateCreatedTo", fmt.Sprint((*params.DateCreatedTo).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExecutionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Execution records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -237,6 +241,7 @@ func (c *ApiService) StreamExecution(FlowSid string, params *ListExecutionParams return recordChannel, errorChannel } + func (c *ApiService) streamExecution(response *ListExecutionResponse, params *ListExecutionParams, recordChannel chan StudioV2Execution, errorChannel chan error) { curRecord := 1 @@ -268,58 +273,60 @@ func (c *ApiService) streamExecution(response *ListExecutionResponse, params *Li } func (c *ApiService) getNextListExecutionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExecutionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExecutionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateExecution' type UpdateExecutionParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateExecutionParams) SetStatus(Status string) *UpdateExecutionParams { - params.Status = &Status - return params +func (params *UpdateExecutionParams) SetStatus(Status string) (*UpdateExecutionParams){ + params.Status = &Status + return params } // Update the status of an Execution to `ended`. func (c *ApiService) UpdateExecution(FlowSid string, Sid string, params *UpdateExecutionParams) (*StudioV2Execution, error) { - path := "/v2/Flows/{FlowSid}/Executions/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Flows/{FlowSid}/Executions/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV2Execution{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &StudioV2Execution{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v2/flows_executions_context.go b/rest/studio/v2/flows_executions_context.go index 63082ea22..cf21e0959 100644 --- a/rest/studio/v2/flows_executions_context.go +++ b/rest/studio/v2/flows_executions_context.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the most recent context for an Execution. -func (c *ApiService) FetchExecutionContext(FlowSid string, ExecutionSid string) (*StudioV2ExecutionContext, error) { - path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Context" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) +func (c *ApiService) FetchExecutionContext(FlowSid string, ExecutionSid string, ) (*StudioV2ExecutionContext, error) { + path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Context" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV2ExecutionContext{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV2ExecutionContext{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v2/flows_executions_steps.go b/rest/studio/v2/flows_executions_steps.go index f614e28c0..0398140bd 100644 --- a/rest/studio/v2/flows_executions_steps.go +++ b/rest/studio/v2/flows_executions_steps.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a Step. -func (c *ApiService) FetchExecutionStep(FlowSid string, ExecutionSid string, Sid string) (*StudioV2ExecutionStep, error) { - path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{Sid}" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchExecutionStep(FlowSid string, ExecutionSid string, Sid string, ) (*StudioV2ExecutionStep, error) { + path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{Sid}" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV2ExecutionStep{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &StudioV2ExecutionStep{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListExecutionStep' type ListExecutionStepParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListExecutionStepParams) SetPageSize(PageSize int) *ListExecutionStepParams { - params.PageSize = &PageSize - return params +func (params *ListExecutionStepParams) SetPageSize(PageSize int) (*ListExecutionStepParams){ + params.PageSize = &PageSize + return params } -func (params *ListExecutionStepParams) SetLimit(Limit int) *ListExecutionStepParams { - params.Limit = &Limit - return params +func (params *ListExecutionStepParams) SetLimit(Limit int) (*ListExecutionStepParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ExecutionStep records from the API. Request is executed immediately. func (c *ApiService) PageExecutionStep(FlowSid string, ExecutionSid string, params *ListExecutionStepParams, pageToken, pageNumber string) (*ListExecutionStepResponse, error) { - path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps" + path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListExecutionStepResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListExecutionStepResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ExecutionStep records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamExecutionStep(FlowSid string, ExecutionSid string, pa return recordChannel, errorChannel } + func (c *ApiService) streamExecutionStep(response *ListExecutionStepResponse, params *ListExecutionStepParams, recordChannel chan StudioV2ExecutionStep, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamExecutionStep(response *ListExecutionStepResponse, pa } func (c *ApiService) getNextListExecutionStepResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListExecutionStepResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListExecutionStepResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/studio/v2/flows_executions_steps_context.go b/rest/studio/v2/flows_executions_steps_context.go index c1cf4ecfd..d01876fe2 100644 --- a/rest/studio/v2/flows_executions_steps_context.go +++ b/rest/studio/v2/flows_executions_steps_context.go @@ -16,31 +16,36 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Retrieve the context for an Execution Step. -func (c *ApiService) FetchExecutionStepContext(FlowSid string, ExecutionSid string, StepSid string) (*StudioV2ExecutionStepContext, error) { - path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{StepSid}/Context" - path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) - path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) - path = strings.Replace(path, "{"+"StepSid"+"}", StepSid, -1) +func (c *ApiService) FetchExecutionStepContext(FlowSid string, ExecutionSid string, StepSid string, ) (*StudioV2ExecutionStepContext, error) { + path := "/v2/Flows/{FlowSid}/Executions/{ExecutionSid}/Steps/{StepSid}/Context" + path = strings.Replace(path, "{"+"FlowSid"+"}", FlowSid, -1) + path = strings.Replace(path, "{"+"ExecutionSid"+"}", ExecutionSid, -1) + path = strings.Replace(path, "{"+"StepSid"+"}", StepSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV2ExecutionStepContext{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV2ExecutionStepContext{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v2/flows_revisions.go b/rest/studio/v2/flows_revisions.go index 5d04f5e41..a24aae5b7 100644 --- a/rest/studio/v2/flows_revisions.go +++ b/rest/studio/v2/flows_revisions.go @@ -18,85 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve a specific Flow revision. -func (c *ApiService) FetchFlowRevision(Sid string, Revision string) (*StudioV2FlowRevision, error) { - path := "/v2/Flows/{Sid}/Revisions/{Revision}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - path = strings.Replace(path, "{"+"Revision"+"}", Revision, -1) +func (c *ApiService) FetchFlowRevision(Sid string, Revision string, ) (*StudioV2FlowRevision, error) { + path := "/v2/Flows/{Sid}/Revisions/{Revision}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path = strings.Replace(path, "{"+"Revision"+"}", Revision, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &StudioV2FlowRevision{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &StudioV2FlowRevision{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFlowRevision' type ListFlowRevisionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFlowRevisionParams) SetPageSize(PageSize int) *ListFlowRevisionParams { - params.PageSize = &PageSize - return params +func (params *ListFlowRevisionParams) SetPageSize(PageSize int) (*ListFlowRevisionParams){ + params.PageSize = &PageSize + return params } -func (params *ListFlowRevisionParams) SetLimit(Limit int) *ListFlowRevisionParams { - params.Limit = &Limit - return params +func (params *ListFlowRevisionParams) SetLimit(Limit int) (*ListFlowRevisionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of FlowRevision records from the API. Request is executed immediately. func (c *ApiService) PageFlowRevision(Sid string, params *ListFlowRevisionParams, pageToken, pageNumber string) (*ListFlowRevisionResponse, error) { - path := "/v2/Flows/{Sid}/Revisions" + path := "/v2/Flows/{Sid}/Revisions" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFlowRevisionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFlowRevisionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists FlowRevision records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -137,6 +139,7 @@ func (c *ApiService) StreamFlowRevision(Sid string, params *ListFlowRevisionPara return recordChannel, errorChannel } + func (c *ApiService) streamFlowRevision(response *ListFlowRevisionResponse, params *ListFlowRevisionParams, recordChannel chan StudioV2FlowRevision, errorChannel chan error) { curRecord := 1 @@ -168,19 +171,20 @@ func (c *ApiService) streamFlowRevision(response *ListFlowRevisionResponse, para } func (c *ApiService) getNextListFlowRevisionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFlowRevisionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFlowRevisionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/studio/v2/flows_test_users.go b/rest/studio/v2/flows_test_users.go index cab908acf..73e836a27 100644 --- a/rest/studio/v2/flows_test_users.go +++ b/rest/studio/v2/flows_test_users.go @@ -16,69 +16,75 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch flow test users -func (c *ApiService) FetchTestUser(Sid string) (*StudioV2TestUser, error) { - path := "/v2/Flows/{Sid}/TestUsers" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchTestUser(Sid string, ) (*StudioV2TestUser, error) { + path := "/v2/Flows/{Sid}/TestUsers" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &StudioV2TestUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &StudioV2TestUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateTestUser' type UpdateTestUserParams struct { - // List of test user identities that can test draft versions of the flow. - TestUsers *[]string `json:"TestUsers,omitempty"` + // List of test user identities that can test draft versions of the flow. + TestUsers *[]string `json:"TestUsers,omitempty"` } -func (params *UpdateTestUserParams) SetTestUsers(TestUsers []string) *UpdateTestUserParams { - params.TestUsers = &TestUsers - return params +func (params *UpdateTestUserParams) SetTestUsers(TestUsers []string) (*UpdateTestUserParams){ + params.TestUsers = &TestUsers + return params } // Update flow test users func (c *ApiService) UpdateTestUser(Sid string, params *UpdateTestUserParams) (*StudioV2TestUser, error) { - path := "/v2/Flows/{Sid}/TestUsers" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Flows/{Sid}/TestUsers" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TestUsers != nil { + for _, item := range *params.TestUsers { + data.Add("TestUsers", item) + } + } - if params != nil && params.TestUsers != nil { - for _, item := range *params.TestUsers { - data.Add("TestUsers", item) - } - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV2TestUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV2TestUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v2/flows_validate.go b/rest/studio/v2/flows_validate.go index b589afdc4..d83d255b8 100644 --- a/rest/studio/v2/flows_validate.go +++ b/rest/studio/v2/flows_validate.go @@ -16,75 +16,80 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'UpdateFlowValidate' type UpdateFlowValidateParams struct { - // The string that you assigned to describe the Flow. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - Status *string `json:"Status,omitempty"` - // JSON representation of flow definition. - Definition *interface{} `json:"Definition,omitempty"` - // Description of change made in the revision. - CommitMessage *string `json:"CommitMessage,omitempty"` + // The string that you assigned to describe the Flow. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + Status *string `json:"Status,omitempty"` + // JSON representation of flow definition. + Definition *interface{} `json:"Definition,omitempty"` + // Description of change made in the revision. + CommitMessage *string `json:"CommitMessage,omitempty"` } -func (params *UpdateFlowValidateParams) SetFriendlyName(FriendlyName string) *UpdateFlowValidateParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateFlowValidateParams) SetFriendlyName(FriendlyName string) (*UpdateFlowValidateParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateFlowValidateParams) SetStatus(Status string) *UpdateFlowValidateParams { - params.Status = &Status - return params +func (params *UpdateFlowValidateParams) SetStatus(Status string) (*UpdateFlowValidateParams){ + params.Status = &Status + return params } -func (params *UpdateFlowValidateParams) SetDefinition(Definition interface{}) *UpdateFlowValidateParams { - params.Definition = &Definition - return params +func (params *UpdateFlowValidateParams) SetDefinition(Definition interface{}) (*UpdateFlowValidateParams){ + params.Definition = &Definition + return params } -func (params *UpdateFlowValidateParams) SetCommitMessage(CommitMessage string) *UpdateFlowValidateParams { - params.CommitMessage = &CommitMessage - return params +func (params *UpdateFlowValidateParams) SetCommitMessage(CommitMessage string) (*UpdateFlowValidateParams){ + params.CommitMessage = &CommitMessage + return params } // Validate flow JSON definition func (c *ApiService) UpdateFlowValidate(params *UpdateFlowValidateParams) (*StudioV2FlowValidate, error) { - path := "/v2/Flows/Validate" + path := "/v2/Flows/Validate" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Definition != nil { + v, err := json.Marshal(params.Definition) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Definition != nil { - v, err := json.Marshal(params.Definition) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Definition", string(v)) + } + if params != nil && params.CommitMessage != nil { + data.Set("CommitMessage", *params.CommitMessage) + } - data.Set("Definition", string(v)) - } - if params != nil && params.CommitMessage != nil { - data.Set("CommitMessage", *params.CommitMessage) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &StudioV2FlowValidate{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &StudioV2FlowValidate{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/studio/v2/model_list_execution_response.go b/rest/studio/v2/model_list_execution_response.go index 7a2fb37f0..30f84790a 100644 --- a/rest/studio/v2/model_list_execution_response.go +++ b/rest/studio/v2/model_list_execution_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListExecutionResponse struct for ListExecutionResponse type ListExecutionResponse struct { - Executions []StudioV2Execution `json:"executions,omitempty"` - Meta ListExecutionResponseMeta `json:"meta,omitempty"` + Executions []StudioV2Execution `json:"executions,omitempty"` + Meta ListExecutionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v2/model_list_execution_response_meta.go b/rest/studio/v2/model_list_execution_response_meta.go index ee5ece689..c991b0260 100644 --- a/rest/studio/v2/model_list_execution_response_meta.go +++ b/rest/studio/v2/model_list_execution_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListExecutionResponseMeta struct for ListExecutionResponseMeta type ListExecutionResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/studio/v2/model_list_execution_step_response.go b/rest/studio/v2/model_list_execution_step_response.go index 67d782894..2becd476a 100644 --- a/rest/studio/v2/model_list_execution_step_response.go +++ b/rest/studio/v2/model_list_execution_step_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListExecutionStepResponse struct for ListExecutionStepResponse type ListExecutionStepResponse struct { - Steps []StudioV2ExecutionStep `json:"steps,omitempty"` - Meta ListExecutionResponseMeta `json:"meta,omitempty"` + Steps []StudioV2ExecutionStep `json:"steps,omitempty"` + Meta ListExecutionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v2/model_list_flow_response.go b/rest/studio/v2/model_list_flow_response.go index 6f12aa50d..733df0a36 100644 --- a/rest/studio/v2/model_list_flow_response.go +++ b/rest/studio/v2/model_list_flow_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFlowResponse struct for ListFlowResponse type ListFlowResponse struct { - Flows []StudioV2Flow `json:"flows,omitempty"` - Meta ListExecutionResponseMeta `json:"meta,omitempty"` + Flows []StudioV2Flow `json:"flows,omitempty"` + Meta ListExecutionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v2/model_list_flow_revision_response.go b/rest/studio/v2/model_list_flow_revision_response.go index e9601692a..d664fdb8d 100644 --- a/rest/studio/v2/model_list_flow_revision_response.go +++ b/rest/studio/v2/model_list_flow_revision_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFlowRevisionResponse struct for ListFlowRevisionResponse type ListFlowRevisionResponse struct { - Revisions []StudioV2FlowRevision `json:"revisions,omitempty"` - Meta ListExecutionResponseMeta `json:"meta,omitempty"` + Revisions []StudioV2FlowRevision `json:"revisions,omitempty"` + Meta ListExecutionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_execution.go b/rest/studio/v2/model_studio_v2_execution.go index 39d20632b..b6a935742 100644 --- a/rest/studio/v2/model_studio_v2_execution.go +++ b/rest/studio/v2/model_studio_v2_execution.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV2Execution struct for StudioV2Execution type StudioV2Execution struct { - // The unique string that we created to identify the Execution resource. + // The unique string that we created to identify the Execution resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. + // The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. ContactChannelAddress *string `json:"contact_channel_address,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Status *string `json:"status,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of nested resources. + // The URLs of nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_execution_context.go b/rest/studio/v2/model_studio_v2_execution_context.go index 94950fafc..6a575e333 100644 --- a/rest/studio/v2/model_studio_v2_execution_context.go +++ b/rest/studio/v2/model_studio_v2_execution_context.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV2ExecutionContext struct for StudioV2ExecutionContext type StudioV2ExecutionContext struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. AccountSid *string `json:"account_sid,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the context's Execution resource. + // The SID of the context's Execution resource. ExecutionSid *string `json:"execution_sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_execution_step.go b/rest/studio/v2/model_studio_v2_execution_step.go index 6bbf41022..9e45eb22d 100644 --- a/rest/studio/v2/model_studio_v2_execution_step.go +++ b/rest/studio/v2/model_studio_v2_execution_step.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV2ExecutionStep struct for StudioV2ExecutionStep type StudioV2ExecutionStep struct { - // The unique string that we created to identify the ExecutionStep resource. + // The unique string that we created to identify the ExecutionStep resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Step's Execution resource. + // The SID of the Step's Execution resource. ExecutionSid *string `json:"execution_sid,omitempty"` - // The event that caused the Flow to transition to the Step. + // The event that caused the Flow to transition to the Step. Name *string `json:"name,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The Widget that preceded the Widget for the Step. + // The Widget that preceded the Widget for the Step. TransitionedFrom *string `json:"transitioned_from,omitempty"` - // The Widget that will follow the Widget for the Step. + // The Widget that will follow the Widget for the Step. TransitionedTo *string `json:"transitioned_to,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_execution_step_context.go b/rest/studio/v2/model_studio_v2_execution_step_context.go index 592845b68..485cd8761 100644 --- a/rest/studio/v2/model_studio_v2_execution_step_context.go +++ b/rest/studio/v2/model_studio_v2_execution_step_context.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV2ExecutionStepContext struct for StudioV2ExecutionStepContext type StudioV2ExecutionStepContext struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. AccountSid *string `json:"account_sid,omitempty"` - // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + // The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. Context *interface{} `json:"context,omitempty"` - // The SID of the context's Execution resource. + // The SID of the context's Execution resource. ExecutionSid *string `json:"execution_sid,omitempty"` - // The SID of the Flow. + // The SID of the Flow. FlowSid *string `json:"flow_sid,omitempty"` - // The SID of the Step that the context is associated with. + // The SID of the Step that the context is associated with. StepSid *string `json:"step_sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_flow.go b/rest/studio/v2/model_studio_v2_flow.go index 24608b771..d5d622f8e 100644 --- a/rest/studio/v2/model_studio_v2_flow.go +++ b/rest/studio/v2/model_studio_v2_flow.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV2Flow struct for StudioV2Flow type StudioV2Flow struct { - // The unique string that we created to identify the Flow resource. + // The unique string that we created to identify the Flow resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the Flow. + // The string that you assigned to describe the Flow. FriendlyName *string `json:"friendly_name,omitempty"` - // JSON representation of flow definition. + // JSON representation of flow definition. Definition *interface{} `json:"definition,omitempty"` - Status *string `json:"status,omitempty"` - // The latest revision number of the Flow's definition. + Status *string `json:"status,omitempty"` + // The latest revision number of the Flow's definition. Revision *int `json:"revision,omitempty"` - // Description of change made in the revision. + // Description of change made in the revision. CommitMessage *string `json:"commit_message,omitempty"` - // Boolean if the flow definition is valid. + // Boolean if the flow definition is valid. Valid *bool `json:"valid,omitempty"` - // List of error in the flow definition. + // List of error in the flow definition. Errors *[]interface{} `json:"errors,omitempty"` - // List of warnings in the flow definition. + // List of warnings in the flow definition. Warnings *[]interface{} `json:"warnings,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - WebhookUrl *string `json:"webhook_url,omitempty"` - // The absolute URL of the resource. + WebhookUrl *string `json:"webhook_url,omitempty"` + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of the Flow's nested resources. + // The URLs of the Flow's nested resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_flow_revision.go b/rest/studio/v2/model_studio_v2_flow_revision.go index bfbf14480..75684589b 100644 --- a/rest/studio/v2/model_studio_v2_flow_revision.go +++ b/rest/studio/v2/model_studio_v2_flow_revision.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // StudioV2FlowRevision struct for StudioV2FlowRevision type StudioV2FlowRevision struct { - // The unique string that we created to identify the Flow resource. + // The unique string that we created to identify the Flow resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the Flow. + // The string that you assigned to describe the Flow. FriendlyName *string `json:"friendly_name,omitempty"` - // JSON representation of flow definition. + // JSON representation of flow definition. Definition *interface{} `json:"definition,omitempty"` - Status *string `json:"status,omitempty"` - // The latest revision number of the Flow's definition. + Status *string `json:"status,omitempty"` + // The latest revision number of the Flow's definition. Revision *int `json:"revision,omitempty"` - // Description of change made in the revision. + // Description of change made in the revision. CommitMessage *string `json:"commit_message,omitempty"` - // Boolean if the flow definition is valid. + // Boolean if the flow definition is valid. Valid *bool `json:"valid,omitempty"` - // List of error in the flow definition. + // List of error in the flow definition. Errors *[]interface{} `json:"errors,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_flow_validate.go b/rest/studio/v2/model_studio_v2_flow_validate.go index 47bdf49fe..2bbef14e8 100644 --- a/rest/studio/v2/model_studio_v2_flow_validate.go +++ b/rest/studio/v2/model_studio_v2_flow_validate.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV2FlowValidate struct for StudioV2FlowValidate type StudioV2FlowValidate struct { - // Boolean if the flow definition is valid. + // Boolean if the flow definition is valid. Valid *bool `json:"valid,omitempty"` } + + diff --git a/rest/studio/v2/model_studio_v2_test_user.go b/rest/studio/v2/model_studio_v2_test_user.go index 692ce4ca0..239e41c84 100644 --- a/rest/studio/v2/model_studio_v2_test_user.go +++ b/rest/studio/v2/model_studio_v2_test_user.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // StudioV2TestUser struct for StudioV2TestUser type StudioV2TestUser struct { - // Unique identifier of the flow. + // Unique identifier of the flow. Sid *string `json:"sid,omitempty"` - // List of test user identities that can test draft versions of the flow. + // List of test user identities that can test draft versions of the flow. TestUsers *[]string `json:"test_users,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/supersim/v1/README.md b/rest/supersim/v1/README.md index 90668e7ce..f2f2b88ec 100644 --- a/rest/supersim/v1/README.md +++ b/rest/supersim/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/supersim/v1/api_service.go b/rest/supersim/v1/api_service.go index 1f79d973d..a671b74f0 100644 --- a/rest/supersim/v1/api_service.go +++ b/rest/supersim/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://supersim.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/supersim/v1/docs/ListBillingPeriodResponseMeta.md b/rest/supersim/v1/docs/ListBillingPeriodResponseMeta.md index 4f3032e54..d0ef3d794 100644 --- a/rest/supersim/v1/docs/ListBillingPeriodResponseMeta.md +++ b/rest/supersim/v1/docs/ListBillingPeriodResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/supersim/v1/e_sim_profiles.go b/rest/supersim/v1/e_sim_profiles.go index 5379fc043..9b172fd34 100644 --- a/rest/supersim/v1/e_sim_profiles.go +++ b/rest/supersim/v1/e_sim_profiles.go @@ -18,173 +18,177 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateEsimProfile' type CreateEsimProfileParams struct { - // The URL we should call using the `callback_method` when the status of the eSIM Profile changes. At this stage of the eSIM Profile pilot, the a request to the URL will only be called when the ESimProfile resource changes from `reserving` to `available`. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // When set to `true`, a value for `Eid` does not need to be provided. Instead, when the eSIM profile is reserved, a matching ID will be generated and returned via the `matching_id` property. This identifies the specific eSIM profile that can be used by any capable device to claim and download the profile. - GenerateMatchingId *bool `json:"GenerateMatchingId,omitempty"` - // Identifier of the eUICC that will claim the eSIM Profile. - Eid *string `json:"Eid,omitempty"` + // The URL we should call using the `callback_method` when the status of the eSIM Profile changes. At this stage of the eSIM Profile pilot, the a request to the URL will only be called when the ESimProfile resource changes from `reserving` to `available`. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // When set to `true`, a value for `Eid` does not need to be provided. Instead, when the eSIM profile is reserved, a matching ID will be generated and returned via the `matching_id` property. This identifies the specific eSIM profile that can be used by any capable device to claim and download the profile. + GenerateMatchingId *bool `json:"GenerateMatchingId,omitempty"` + // Identifier of the eUICC that will claim the eSIM Profile. + Eid *string `json:"Eid,omitempty"` } -func (params *CreateEsimProfileParams) SetCallbackUrl(CallbackUrl string) *CreateEsimProfileParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *CreateEsimProfileParams) SetCallbackUrl(CallbackUrl string) (*CreateEsimProfileParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *CreateEsimProfileParams) SetCallbackMethod(CallbackMethod string) *CreateEsimProfileParams { - params.CallbackMethod = &CallbackMethod - return params +func (params *CreateEsimProfileParams) SetCallbackMethod(CallbackMethod string) (*CreateEsimProfileParams){ + params.CallbackMethod = &CallbackMethod + return params } -func (params *CreateEsimProfileParams) SetGenerateMatchingId(GenerateMatchingId bool) *CreateEsimProfileParams { - params.GenerateMatchingId = &GenerateMatchingId - return params +func (params *CreateEsimProfileParams) SetGenerateMatchingId(GenerateMatchingId bool) (*CreateEsimProfileParams){ + params.GenerateMatchingId = &GenerateMatchingId + return params } -func (params *CreateEsimProfileParams) SetEid(Eid string) *CreateEsimProfileParams { - params.Eid = &Eid - return params +func (params *CreateEsimProfileParams) SetEid(Eid string) (*CreateEsimProfileParams){ + params.Eid = &Eid + return params } // Order an eSIM Profile. func (c *ApiService) CreateEsimProfile(params *CreateEsimProfileParams) (*SupersimV1EsimProfile, error) { - path := "/v1/ESimProfiles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.GenerateMatchingId != nil { - data.Set("GenerateMatchingId", fmt.Sprint(*params.GenerateMatchingId)) - } - if params != nil && params.Eid != nil { - data.Set("Eid", *params.Eid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1EsimProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/ESimProfiles" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.GenerateMatchingId != nil { + data.Set("GenerateMatchingId", fmt.Sprint(*params.GenerateMatchingId)) + } + if params != nil && params.Eid != nil { + data.Set("Eid", *params.Eid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1EsimProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch an eSIM Profile. -func (c *ApiService) FetchEsimProfile(Sid string) (*SupersimV1EsimProfile, error) { - path := "/v1/ESimProfiles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEsimProfile(Sid string, ) (*SupersimV1EsimProfile, error) { + path := "/v1/ESimProfiles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1EsimProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1EsimProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListEsimProfile' type ListEsimProfileParams struct { - // List the eSIM Profiles that have been associated with an EId. - Eid *string `json:"Eid,omitempty"` - // Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. - SimSid *string `json:"SimSid,omitempty"` - // List the eSIM Profiles that are in a given status. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // List the eSIM Profiles that have been associated with an EId. + Eid *string `json:"Eid,omitempty"` + // Find the eSIM Profile resource related to a [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource by providing the SIM SID. Will always return an array with either 1 or 0 records. + SimSid *string `json:"SimSid,omitempty"` + // List the eSIM Profiles that are in a given status. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEsimProfileParams) SetEid(Eid string) *ListEsimProfileParams { - params.Eid = &Eid - return params +func (params *ListEsimProfileParams) SetEid(Eid string) (*ListEsimProfileParams){ + params.Eid = &Eid + return params } -func (params *ListEsimProfileParams) SetSimSid(SimSid string) *ListEsimProfileParams { - params.SimSid = &SimSid - return params +func (params *ListEsimProfileParams) SetSimSid(SimSid string) (*ListEsimProfileParams){ + params.SimSid = &SimSid + return params } -func (params *ListEsimProfileParams) SetStatus(Status string) *ListEsimProfileParams { - params.Status = &Status - return params +func (params *ListEsimProfileParams) SetStatus(Status string) (*ListEsimProfileParams){ + params.Status = &Status + return params } -func (params *ListEsimProfileParams) SetPageSize(PageSize int) *ListEsimProfileParams { - params.PageSize = &PageSize - return params +func (params *ListEsimProfileParams) SetPageSize(PageSize int) (*ListEsimProfileParams){ + params.PageSize = &PageSize + return params } -func (params *ListEsimProfileParams) SetLimit(Limit int) *ListEsimProfileParams { - params.Limit = &Limit - return params +func (params *ListEsimProfileParams) SetLimit(Limit int) (*ListEsimProfileParams){ + params.Limit = &Limit + return params } // Retrieve a single page of EsimProfile records from the API. Request is executed immediately. func (c *ApiService) PageEsimProfile(params *ListEsimProfileParams, pageToken, pageNumber string) (*ListEsimProfileResponse, error) { - path := "/v1/ESimProfiles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Eid != nil { - data.Set("Eid", *params.Eid) - } - if params != nil && params.SimSid != nil { - data.Set("SimSid", *params.SimSid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEsimProfileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/ESimProfiles" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Eid != nil { + data.Set("Eid", *params.Eid) + } + if params != nil && params.SimSid != nil { + data.Set("SimSid", *params.SimSid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEsimProfileResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists EsimProfile records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +229,7 @@ func (c *ApiService) StreamEsimProfile(params *ListEsimProfileParams) (chan Supe return recordChannel, errorChannel } + func (c *ApiService) streamEsimProfile(response *ListEsimProfileResponse, params *ListEsimProfileParams, recordChannel chan SupersimV1EsimProfile, errorChannel chan error) { curRecord := 1 @@ -256,19 +261,20 @@ func (c *ApiService) streamEsimProfile(response *ListEsimProfileResponse, params } func (c *ApiService) getNextListEsimProfileResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEsimProfileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEsimProfileResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/fleets.go b/rest/supersim/v1/fleets.go index 848aeb7a5..28dc7f00a 100644 --- a/rest/supersim/v1/fleets.go +++ b/rest/supersim/v1/fleets.go @@ -18,200 +18,204 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateFleet' type CreateFleetParams struct { - // The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet's SIMs can connect to. - NetworkAccessProfile *string `json:"NetworkAccessProfile,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. - DataEnabled *bool `json:"DataEnabled,omitempty"` - // The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). - DataLimit *int `json:"DataLimit,omitempty"` - // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - IpCommandsUrl *string `json:"IpCommandsUrl,omitempty"` - // A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. - IpCommandsMethod *string `json:"IpCommandsMethod,omitempty"` - // Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. - SmsCommandsEnabled *bool `json:"SmsCommandsEnabled,omitempty"` - // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - SmsCommandsUrl *string `json:"SmsCommandsUrl,omitempty"` - // A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. - SmsCommandsMethod *string `json:"SmsCommandsMethod,omitempty"` + // The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet's SIMs can connect to. + NetworkAccessProfile *string `json:"NetworkAccessProfile,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. + DataEnabled *bool `json:"DataEnabled,omitempty"` + // The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). + DataLimit *int `json:"DataLimit,omitempty"` + // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + IpCommandsUrl *string `json:"IpCommandsUrl,omitempty"` + // A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + IpCommandsMethod *string `json:"IpCommandsMethod,omitempty"` + // Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. + SmsCommandsEnabled *bool `json:"SmsCommandsEnabled,omitempty"` + // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + SmsCommandsUrl *string `json:"SmsCommandsUrl,omitempty"` + // A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + SmsCommandsMethod *string `json:"SmsCommandsMethod,omitempty"` } -func (params *CreateFleetParams) SetNetworkAccessProfile(NetworkAccessProfile string) *CreateFleetParams { - params.NetworkAccessProfile = &NetworkAccessProfile - return params +func (params *CreateFleetParams) SetNetworkAccessProfile(NetworkAccessProfile string) (*CreateFleetParams){ + params.NetworkAccessProfile = &NetworkAccessProfile + return params } -func (params *CreateFleetParams) SetUniqueName(UniqueName string) *CreateFleetParams { - params.UniqueName = &UniqueName - return params +func (params *CreateFleetParams) SetUniqueName(UniqueName string) (*CreateFleetParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateFleetParams) SetDataEnabled(DataEnabled bool) *CreateFleetParams { - params.DataEnabled = &DataEnabled - return params +func (params *CreateFleetParams) SetDataEnabled(DataEnabled bool) (*CreateFleetParams){ + params.DataEnabled = &DataEnabled + return params } -func (params *CreateFleetParams) SetDataLimit(DataLimit int) *CreateFleetParams { - params.DataLimit = &DataLimit - return params +func (params *CreateFleetParams) SetDataLimit(DataLimit int) (*CreateFleetParams){ + params.DataLimit = &DataLimit + return params } -func (params *CreateFleetParams) SetIpCommandsUrl(IpCommandsUrl string) *CreateFleetParams { - params.IpCommandsUrl = &IpCommandsUrl - return params +func (params *CreateFleetParams) SetIpCommandsUrl(IpCommandsUrl string) (*CreateFleetParams){ + params.IpCommandsUrl = &IpCommandsUrl + return params } -func (params *CreateFleetParams) SetIpCommandsMethod(IpCommandsMethod string) *CreateFleetParams { - params.IpCommandsMethod = &IpCommandsMethod - return params +func (params *CreateFleetParams) SetIpCommandsMethod(IpCommandsMethod string) (*CreateFleetParams){ + params.IpCommandsMethod = &IpCommandsMethod + return params } -func (params *CreateFleetParams) SetSmsCommandsEnabled(SmsCommandsEnabled bool) *CreateFleetParams { - params.SmsCommandsEnabled = &SmsCommandsEnabled - return params +func (params *CreateFleetParams) SetSmsCommandsEnabled(SmsCommandsEnabled bool) (*CreateFleetParams){ + params.SmsCommandsEnabled = &SmsCommandsEnabled + return params } -func (params *CreateFleetParams) SetSmsCommandsUrl(SmsCommandsUrl string) *CreateFleetParams { - params.SmsCommandsUrl = &SmsCommandsUrl - return params +func (params *CreateFleetParams) SetSmsCommandsUrl(SmsCommandsUrl string) (*CreateFleetParams){ + params.SmsCommandsUrl = &SmsCommandsUrl + return params } -func (params *CreateFleetParams) SetSmsCommandsMethod(SmsCommandsMethod string) *CreateFleetParams { - params.SmsCommandsMethod = &SmsCommandsMethod - return params +func (params *CreateFleetParams) SetSmsCommandsMethod(SmsCommandsMethod string) (*CreateFleetParams){ + params.SmsCommandsMethod = &SmsCommandsMethod + return params } // Create a Fleet func (c *ApiService) CreateFleet(params *CreateFleetParams) (*SupersimV1Fleet, error) { - path := "/v1/Fleets" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.NetworkAccessProfile != nil { - data.Set("NetworkAccessProfile", *params.NetworkAccessProfile) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DataEnabled != nil { - data.Set("DataEnabled", fmt.Sprint(*params.DataEnabled)) - } - if params != nil && params.DataLimit != nil { - data.Set("DataLimit", fmt.Sprint(*params.DataLimit)) - } - if params != nil && params.IpCommandsUrl != nil { - data.Set("IpCommandsUrl", *params.IpCommandsUrl) - } - if params != nil && params.IpCommandsMethod != nil { - data.Set("IpCommandsMethod", *params.IpCommandsMethod) - } - if params != nil && params.SmsCommandsEnabled != nil { - data.Set("SmsCommandsEnabled", fmt.Sprint(*params.SmsCommandsEnabled)) - } - if params != nil && params.SmsCommandsUrl != nil { - data.Set("SmsCommandsUrl", *params.SmsCommandsUrl) - } - if params != nil && params.SmsCommandsMethod != nil { - data.Set("SmsCommandsMethod", *params.SmsCommandsMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1Fleet{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Fleets" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.NetworkAccessProfile != nil { + data.Set("NetworkAccessProfile", *params.NetworkAccessProfile) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DataEnabled != nil { + data.Set("DataEnabled", fmt.Sprint(*params.DataEnabled)) + } + if params != nil && params.DataLimit != nil { + data.Set("DataLimit", fmt.Sprint(*params.DataLimit)) + } + if params != nil && params.IpCommandsUrl != nil { + data.Set("IpCommandsUrl", *params.IpCommandsUrl) + } + if params != nil && params.IpCommandsMethod != nil { + data.Set("IpCommandsMethod", *params.IpCommandsMethod) + } + if params != nil && params.SmsCommandsEnabled != nil { + data.Set("SmsCommandsEnabled", fmt.Sprint(*params.SmsCommandsEnabled)) + } + if params != nil && params.SmsCommandsUrl != nil { + data.Set("SmsCommandsUrl", *params.SmsCommandsUrl) + } + if params != nil && params.SmsCommandsMethod != nil { + data.Set("SmsCommandsMethod", *params.SmsCommandsMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1Fleet{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch a Fleet instance from your account. -func (c *ApiService) FetchFleet(Sid string) (*SupersimV1Fleet, error) { - path := "/v1/Fleets/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchFleet(Sid string, ) (*SupersimV1Fleet, error) { + path := "/v1/Fleets/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1Fleet{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SupersimV1Fleet{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListFleet' type ListFleetParams struct { - // The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. - NetworkAccessProfile *string `json:"NetworkAccessProfile,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. + NetworkAccessProfile *string `json:"NetworkAccessProfile,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFleetParams) SetNetworkAccessProfile(NetworkAccessProfile string) *ListFleetParams { - params.NetworkAccessProfile = &NetworkAccessProfile - return params +func (params *ListFleetParams) SetNetworkAccessProfile(NetworkAccessProfile string) (*ListFleetParams){ + params.NetworkAccessProfile = &NetworkAccessProfile + return params } -func (params *ListFleetParams) SetPageSize(PageSize int) *ListFleetParams { - params.PageSize = &PageSize - return params +func (params *ListFleetParams) SetPageSize(PageSize int) (*ListFleetParams){ + params.PageSize = &PageSize + return params } -func (params *ListFleetParams) SetLimit(Limit int) *ListFleetParams { - params.Limit = &Limit - return params +func (params *ListFleetParams) SetLimit(Limit int) (*ListFleetParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Fleet records from the API. Request is executed immediately. func (c *ApiService) PageFleet(params *ListFleetParams, pageToken, pageNumber string) (*ListFleetResponse, error) { - path := "/v1/Fleets" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.NetworkAccessProfile != nil { - data.Set("NetworkAccessProfile", *params.NetworkAccessProfile) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFleetResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Fleets" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.NetworkAccessProfile != nil { + data.Set("NetworkAccessProfile", *params.NetworkAccessProfile) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFleetResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Fleet records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -252,6 +256,7 @@ func (c *ApiService) StreamFleet(params *ListFleetParams) (chan SupersimV1Fleet, return recordChannel, errorChannel } + func (c *ApiService) streamFleet(response *ListFleetResponse, params *ListFleetParams, recordChannel chan SupersimV1Fleet, errorChannel chan error) { curRecord := 1 @@ -283,111 +288,113 @@ func (c *ApiService) streamFleet(response *ListFleetResponse, params *ListFleetP } func (c *ApiService) getNextListFleetResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListFleetResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListFleetResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateFleet' type UpdateFleetParams struct { - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet's SIMs can connect to. - NetworkAccessProfile *string `json:"NetworkAccessProfile,omitempty"` - // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - IpCommandsUrl *string `json:"IpCommandsUrl,omitempty"` - // A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. - IpCommandsMethod *string `json:"IpCommandsMethod,omitempty"` - // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - SmsCommandsUrl *string `json:"SmsCommandsUrl,omitempty"` - // A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. - SmsCommandsMethod *string `json:"SmsCommandsMethod,omitempty"` - // The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). - DataLimit *int `json:"DataLimit,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet's SIMs can connect to. + NetworkAccessProfile *string `json:"NetworkAccessProfile,omitempty"` + // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + IpCommandsUrl *string `json:"IpCommandsUrl,omitempty"` + // A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + IpCommandsMethod *string `json:"IpCommandsMethod,omitempty"` + // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + SmsCommandsUrl *string `json:"SmsCommandsUrl,omitempty"` + // A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + SmsCommandsMethod *string `json:"SmsCommandsMethod,omitempty"` + // The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). + DataLimit *int `json:"DataLimit,omitempty"` } -func (params *UpdateFleetParams) SetUniqueName(UniqueName string) *UpdateFleetParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateFleetParams) SetUniqueName(UniqueName string) (*UpdateFleetParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateFleetParams) SetNetworkAccessProfile(NetworkAccessProfile string) *UpdateFleetParams { - params.NetworkAccessProfile = &NetworkAccessProfile - return params +func (params *UpdateFleetParams) SetNetworkAccessProfile(NetworkAccessProfile string) (*UpdateFleetParams){ + params.NetworkAccessProfile = &NetworkAccessProfile + return params } -func (params *UpdateFleetParams) SetIpCommandsUrl(IpCommandsUrl string) *UpdateFleetParams { - params.IpCommandsUrl = &IpCommandsUrl - return params +func (params *UpdateFleetParams) SetIpCommandsUrl(IpCommandsUrl string) (*UpdateFleetParams){ + params.IpCommandsUrl = &IpCommandsUrl + return params } -func (params *UpdateFleetParams) SetIpCommandsMethod(IpCommandsMethod string) *UpdateFleetParams { - params.IpCommandsMethod = &IpCommandsMethod - return params +func (params *UpdateFleetParams) SetIpCommandsMethod(IpCommandsMethod string) (*UpdateFleetParams){ + params.IpCommandsMethod = &IpCommandsMethod + return params } -func (params *UpdateFleetParams) SetSmsCommandsUrl(SmsCommandsUrl string) *UpdateFleetParams { - params.SmsCommandsUrl = &SmsCommandsUrl - return params +func (params *UpdateFleetParams) SetSmsCommandsUrl(SmsCommandsUrl string) (*UpdateFleetParams){ + params.SmsCommandsUrl = &SmsCommandsUrl + return params } -func (params *UpdateFleetParams) SetSmsCommandsMethod(SmsCommandsMethod string) *UpdateFleetParams { - params.SmsCommandsMethod = &SmsCommandsMethod - return params +func (params *UpdateFleetParams) SetSmsCommandsMethod(SmsCommandsMethod string) (*UpdateFleetParams){ + params.SmsCommandsMethod = &SmsCommandsMethod + return params } -func (params *UpdateFleetParams) SetDataLimit(DataLimit int) *UpdateFleetParams { - params.DataLimit = &DataLimit - return params +func (params *UpdateFleetParams) SetDataLimit(DataLimit int) (*UpdateFleetParams){ + params.DataLimit = &DataLimit + return params } // Updates the given properties of a Super SIM Fleet instance from your account. func (c *ApiService) UpdateFleet(Sid string, params *UpdateFleetParams) (*SupersimV1Fleet, error) { - path := "/v1/Fleets/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.NetworkAccessProfile != nil { - data.Set("NetworkAccessProfile", *params.NetworkAccessProfile) - } - if params != nil && params.IpCommandsUrl != nil { - data.Set("IpCommandsUrl", *params.IpCommandsUrl) - } - if params != nil && params.IpCommandsMethod != nil { - data.Set("IpCommandsMethod", *params.IpCommandsMethod) - } - if params != nil && params.SmsCommandsUrl != nil { - data.Set("SmsCommandsUrl", *params.SmsCommandsUrl) - } - if params != nil && params.SmsCommandsMethod != nil { - data.Set("SmsCommandsMethod", *params.SmsCommandsMethod) - } - if params != nil && params.DataLimit != nil { - data.Set("DataLimit", fmt.Sprint(*params.DataLimit)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1Fleet{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Fleets/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.NetworkAccessProfile != nil { + data.Set("NetworkAccessProfile", *params.NetworkAccessProfile) + } + if params != nil && params.IpCommandsUrl != nil { + data.Set("IpCommandsUrl", *params.IpCommandsUrl) + } + if params != nil && params.IpCommandsMethod != nil { + data.Set("IpCommandsMethod", *params.IpCommandsMethod) + } + if params != nil && params.SmsCommandsUrl != nil { + data.Set("SmsCommandsUrl", *params.SmsCommandsUrl) + } + if params != nil && params.SmsCommandsMethod != nil { + data.Set("SmsCommandsMethod", *params.SmsCommandsMethod) + } + if params != nil && params.DataLimit != nil { + data.Set("DataLimit", fmt.Sprint(*params.DataLimit)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1Fleet{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/supersim/v1/ip_commands.go b/rest/supersim/v1/ip_commands.go index d553bd305..83929475f 100644 --- a/rest/supersim/v1/ip_commands.go +++ b/rest/supersim/v1/ip_commands.go @@ -18,200 +18,204 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIpCommand' type CreateIpCommandParams struct { - // The `sid` or `unique_name` of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the IP Command to. - Sim *string `json:"Sim,omitempty"` - // The data that will be sent to the device. The payload cannot exceed 1300 bytes. If the PayloadType is set to text, the payload is encoded in UTF-8. If PayloadType is set to binary, the payload is encoded in Base64. - Payload *string `json:"Payload,omitempty"` - // The device port to which the IP Command will be sent. - DevicePort *int `json:"DevicePort,omitempty"` - // - PayloadType *string `json:"PayloadType,omitempty"` - // The URL we should call using the `callback_method` after we have sent the IP Command. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`. - CallbackMethod *string `json:"CallbackMethod,omitempty"` + // The `sid` or `unique_name` of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the IP Command to. + Sim *string `json:"Sim,omitempty"` + // The data that will be sent to the device. The payload cannot exceed 1300 bytes. If the PayloadType is set to text, the payload is encoded in UTF-8. If PayloadType is set to binary, the payload is encoded in Base64. + Payload *string `json:"Payload,omitempty"` + // The device port to which the IP Command will be sent. + DevicePort *int `json:"DevicePort,omitempty"` + // + PayloadType *string `json:"PayloadType,omitempty"` + // The URL we should call using the `callback_method` after we have sent the IP Command. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`. + CallbackMethod *string `json:"CallbackMethod,omitempty"` } -func (params *CreateIpCommandParams) SetSim(Sim string) *CreateIpCommandParams { - params.Sim = &Sim - return params +func (params *CreateIpCommandParams) SetSim(Sim string) (*CreateIpCommandParams){ + params.Sim = &Sim + return params } -func (params *CreateIpCommandParams) SetPayload(Payload string) *CreateIpCommandParams { - params.Payload = &Payload - return params +func (params *CreateIpCommandParams) SetPayload(Payload string) (*CreateIpCommandParams){ + params.Payload = &Payload + return params } -func (params *CreateIpCommandParams) SetDevicePort(DevicePort int) *CreateIpCommandParams { - params.DevicePort = &DevicePort - return params +func (params *CreateIpCommandParams) SetDevicePort(DevicePort int) (*CreateIpCommandParams){ + params.DevicePort = &DevicePort + return params } -func (params *CreateIpCommandParams) SetPayloadType(PayloadType string) *CreateIpCommandParams { - params.PayloadType = &PayloadType - return params +func (params *CreateIpCommandParams) SetPayloadType(PayloadType string) (*CreateIpCommandParams){ + params.PayloadType = &PayloadType + return params } -func (params *CreateIpCommandParams) SetCallbackUrl(CallbackUrl string) *CreateIpCommandParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *CreateIpCommandParams) SetCallbackUrl(CallbackUrl string) (*CreateIpCommandParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *CreateIpCommandParams) SetCallbackMethod(CallbackMethod string) *CreateIpCommandParams { - params.CallbackMethod = &CallbackMethod - return params +func (params *CreateIpCommandParams) SetCallbackMethod(CallbackMethod string) (*CreateIpCommandParams){ + params.CallbackMethod = &CallbackMethod + return params } // Send an IP Command to a Super SIM. func (c *ApiService) CreateIpCommand(params *CreateIpCommandParams) (*SupersimV1IpCommand, error) { - path := "/v1/IpCommands" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.Payload != nil { - data.Set("Payload", *params.Payload) - } - if params != nil && params.DevicePort != nil { - data.Set("DevicePort", fmt.Sprint(*params.DevicePort)) - } - if params != nil && params.PayloadType != nil { - data.Set("PayloadType", *params.PayloadType) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1IpCommand{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/IpCommands" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.Payload != nil { + data.Set("Payload", *params.Payload) + } + if params != nil && params.DevicePort != nil { + data.Set("DevicePort", fmt.Sprint(*params.DevicePort)) + } + if params != nil && params.PayloadType != nil { + data.Set("PayloadType", *params.PayloadType) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1IpCommand{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch IP Command instance from your account. -func (c *ApiService) FetchIpCommand(Sid string) (*SupersimV1IpCommand, error) { - path := "/v1/IpCommands/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchIpCommand(Sid string, ) (*SupersimV1IpCommand, error) { + path := "/v1/IpCommands/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1IpCommand{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SupersimV1IpCommand{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListIpCommand' type ListIpCommandParams struct { - // The SID or unique name of the Sim resource that IP Command was sent to or from. - Sim *string `json:"Sim,omitempty"` - // The ICCID of the Sim resource that IP Command was sent to or from. - SimIccid *string `json:"SimIccid,omitempty"` - // The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. - Status *string `json:"Status,omitempty"` - // The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. - Direction *string `json:"Direction,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID or unique name of the Sim resource that IP Command was sent to or from. + Sim *string `json:"Sim,omitempty"` + // The ICCID of the Sim resource that IP Command was sent to or from. + SimIccid *string `json:"SimIccid,omitempty"` + // The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each. + Status *string `json:"Status,omitempty"` + // The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. + Direction *string `json:"Direction,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListIpCommandParams) SetSim(Sim string) *ListIpCommandParams { - params.Sim = &Sim - return params +func (params *ListIpCommandParams) SetSim(Sim string) (*ListIpCommandParams){ + params.Sim = &Sim + return params } -func (params *ListIpCommandParams) SetSimIccid(SimIccid string) *ListIpCommandParams { - params.SimIccid = &SimIccid - return params +func (params *ListIpCommandParams) SetSimIccid(SimIccid string) (*ListIpCommandParams){ + params.SimIccid = &SimIccid + return params } -func (params *ListIpCommandParams) SetStatus(Status string) *ListIpCommandParams { - params.Status = &Status - return params +func (params *ListIpCommandParams) SetStatus(Status string) (*ListIpCommandParams){ + params.Status = &Status + return params } -func (params *ListIpCommandParams) SetDirection(Direction string) *ListIpCommandParams { - params.Direction = &Direction - return params +func (params *ListIpCommandParams) SetDirection(Direction string) (*ListIpCommandParams){ + params.Direction = &Direction + return params } -func (params *ListIpCommandParams) SetPageSize(PageSize int) *ListIpCommandParams { - params.PageSize = &PageSize - return params +func (params *ListIpCommandParams) SetPageSize(PageSize int) (*ListIpCommandParams){ + params.PageSize = &PageSize + return params } -func (params *ListIpCommandParams) SetLimit(Limit int) *ListIpCommandParams { - params.Limit = &Limit - return params +func (params *ListIpCommandParams) SetLimit(Limit int) (*ListIpCommandParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IpCommand records from the API. Request is executed immediately. func (c *ApiService) PageIpCommand(params *ListIpCommandParams, pageToken, pageNumber string) (*ListIpCommandResponse, error) { - path := "/v1/IpCommands" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.SimIccid != nil { - data.Set("SimIccid", *params.SimIccid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Direction != nil { - data.Set("Direction", *params.Direction) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIpCommandResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/IpCommands" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.SimIccid != nil { + data.Set("SimIccid", *params.SimIccid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Direction != nil { + data.Set("Direction", *params.Direction) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListIpCommandResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists IpCommand records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -252,6 +256,7 @@ func (c *ApiService) StreamIpCommand(params *ListIpCommandParams) (chan Supersim return recordChannel, errorChannel } + func (c *ApiService) streamIpCommand(response *ListIpCommandResponse, params *ListIpCommandParams, recordChannel chan SupersimV1IpCommand, errorChannel chan error) { curRecord := 1 @@ -283,19 +288,20 @@ func (c *ApiService) streamIpCommand(response *ListIpCommandResponse, params *Li } func (c *ApiService) getNextListIpCommandResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIpCommandResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListIpCommandResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/model_list_billing_period_response.go b/rest/supersim/v1/model_list_billing_period_response.go index 2570a0735..8dcdd0893 100644 --- a/rest/supersim/v1/model_list_billing_period_response.go +++ b/rest/supersim/v1/model_list_billing_period_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBillingPeriodResponse struct for ListBillingPeriodResponse type ListBillingPeriodResponse struct { - BillingPeriods []SupersimV1BillingPeriod `json:"billing_periods,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + BillingPeriods []SupersimV1BillingPeriod `json:"billing_periods,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_billing_period_response_meta.go b/rest/supersim/v1/model_list_billing_period_response_meta.go index d7bc08a1e..044244303 100644 --- a/rest/supersim/v1/model_list_billing_period_response_meta.go +++ b/rest/supersim/v1/model_list_billing_period_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBillingPeriodResponseMeta struct for ListBillingPeriodResponseMeta type ListBillingPeriodResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_esim_profile_response.go b/rest/supersim/v1/model_list_esim_profile_response.go index ae44d8606..7cd42a458 100644 --- a/rest/supersim/v1/model_list_esim_profile_response.go +++ b/rest/supersim/v1/model_list_esim_profile_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEsimProfileResponse struct for ListEsimProfileResponse type ListEsimProfileResponse struct { - EsimProfiles []SupersimV1EsimProfile `json:"esim_profiles,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + EsimProfiles []SupersimV1EsimProfile `json:"esim_profiles,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_fleet_response.go b/rest/supersim/v1/model_list_fleet_response.go index 9558860d0..7a8b433e5 100644 --- a/rest/supersim/v1/model_list_fleet_response.go +++ b/rest/supersim/v1/model_list_fleet_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFleetResponse struct for ListFleetResponse type ListFleetResponse struct { - Fleets []SupersimV1Fleet `json:"fleets,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + Fleets []SupersimV1Fleet `json:"fleets,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_ip_command_response.go b/rest/supersim/v1/model_list_ip_command_response.go index 02b28755c..74f869c3e 100644 --- a/rest/supersim/v1/model_list_ip_command_response.go +++ b/rest/supersim/v1/model_list_ip_command_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIpCommandResponse struct for ListIpCommandResponse type ListIpCommandResponse struct { - IpCommands []SupersimV1IpCommand `json:"ip_commands,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + IpCommands []SupersimV1IpCommand `json:"ip_commands,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_network_access_profile_network_response.go b/rest/supersim/v1/model_list_network_access_profile_network_response.go index 611490b82..60d4a121f 100644 --- a/rest/supersim/v1/model_list_network_access_profile_network_response.go +++ b/rest/supersim/v1/model_list_network_access_profile_network_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListNetworkAccessProfileNetworkResponse struct for ListNetworkAccessProfileNetworkResponse type ListNetworkAccessProfileNetworkResponse struct { Networks []SupersimV1NetworkAccessProfileNetwork `json:"networks,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_network_access_profile_response.go b/rest/supersim/v1/model_list_network_access_profile_response.go index e9851dc24..550076d8e 100644 --- a/rest/supersim/v1/model_list_network_access_profile_response.go +++ b/rest/supersim/v1/model_list_network_access_profile_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListNetworkAccessProfileResponse struct for ListNetworkAccessProfileResponse type ListNetworkAccessProfileResponse struct { NetworkAccessProfiles []SupersimV1NetworkAccessProfile `json:"network_access_profiles,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_network_response.go b/rest/supersim/v1/model_list_network_response.go index 0984c1ad6..cb921570b 100644 --- a/rest/supersim/v1/model_list_network_response.go +++ b/rest/supersim/v1/model_list_network_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListNetworkResponse struct for ListNetworkResponse type ListNetworkResponse struct { - Networks []SupersimV1Network `json:"networks,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + Networks []SupersimV1Network `json:"networks,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_settings_update_response.go b/rest/supersim/v1/model_list_settings_update_response.go index dbb8edf45..829619b6b 100644 --- a/rest/supersim/v1/model_list_settings_update_response.go +++ b/rest/supersim/v1/model_list_settings_update_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSettingsUpdateResponse struct for ListSettingsUpdateResponse type ListSettingsUpdateResponse struct { - SettingsUpdates []SupersimV1SettingsUpdate `json:"settings_updates,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + SettingsUpdates []SupersimV1SettingsUpdate `json:"settings_updates,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_sim_ip_address_response.go b/rest/supersim/v1/model_list_sim_ip_address_response.go index 52e951fd4..c336f1502 100644 --- a/rest/supersim/v1/model_list_sim_ip_address_response.go +++ b/rest/supersim/v1/model_list_sim_ip_address_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSimIpAddressResponse struct for ListSimIpAddressResponse type ListSimIpAddressResponse struct { - IpAddresses []SupersimV1SimIpAddress `json:"ip_addresses,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + IpAddresses []SupersimV1SimIpAddress `json:"ip_addresses,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_sim_response.go b/rest/supersim/v1/model_list_sim_response.go index a6cd32458..11e271f0a 100644 --- a/rest/supersim/v1/model_list_sim_response.go +++ b/rest/supersim/v1/model_list_sim_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSimResponse struct for ListSimResponse type ListSimResponse struct { - Sims []SupersimV1Sim `json:"sims,omitempty"` + Sims []SupersimV1Sim `json:"sims,omitempty"` Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_sms_command_response.go b/rest/supersim/v1/model_list_sms_command_response.go index 29abc2e3c..c178cc069 100644 --- a/rest/supersim/v1/model_list_sms_command_response.go +++ b/rest/supersim/v1/model_list_sms_command_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSmsCommandResponse struct for ListSmsCommandResponse type ListSmsCommandResponse struct { - SmsCommands []SupersimV1SmsCommand `json:"sms_commands,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + SmsCommands []SupersimV1SmsCommand `json:"sms_commands,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_list_usage_record_response.go b/rest/supersim/v1/model_list_usage_record_response.go index 1d724722d..129385c11 100644 --- a/rest/supersim/v1/model_list_usage_record_response.go +++ b/rest/supersim/v1/model_list_usage_record_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordResponse struct for ListUsageRecordResponse type ListUsageRecordResponse struct { - UsageRecords []SupersimV1UsageRecord `json:"usage_records,omitempty"` - Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` + UsageRecords []SupersimV1UsageRecord `json:"usage_records,omitempty"` + Meta ListBillingPeriodResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_billing_period.go b/rest/supersim/v1/model_supersim_v1_billing_period.go index 05ddf49bb..3c17ea96e 100644 --- a/rest/supersim/v1/model_supersim_v1_billing_period.go +++ b/rest/supersim/v1/model_supersim_v1_billing_period.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1BillingPeriod struct for SupersimV1BillingPeriod type SupersimV1BillingPeriod struct { - // The SID of the Billing Period. + // The SID of the Billing Period. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) the Super SIM belongs to. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) the Super SIM belongs to. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Super SIM the Billing Period belongs to. + // The SID of the Super SIM the Billing Period belongs to. SimSid *string `json:"sim_sid,omitempty"` - // The start time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The start time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. StartTime *time.Time `json:"start_time,omitempty"` - // The end time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - EndTime *time.Time `json:"end_time,omitempty"` - PeriodType *string `json:"period_type,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The end time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + EndTime *time.Time `json:"end_time,omitempty"` + PeriodType *string `json:"period_type,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_esim_profile.go b/rest/supersim/v1/model_supersim_v1_esim_profile.go index 8cea4de2f..a7402e523 100644 --- a/rest/supersim/v1/model_supersim_v1_esim_profile.go +++ b/rest/supersim/v1/model_supersim_v1_esim_profile.go @@ -13,38 +13,40 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1EsimProfile struct for SupersimV1EsimProfile type SupersimV1EsimProfile struct { - // The unique string that we created to identify the eSIM Profile resource. + // The unique string that we created to identify the eSIM Profile resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs. AccountSid *string `json:"account_sid,omitempty"` - // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource. + // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource. Iccid *string `json:"iccid,omitempty"` - // The SID of the [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource that this eSIM Profile controls. + // The SID of the [Sim](https://www.twilio.com/docs/iot/wireless/api/sim-resource) resource that this eSIM Profile controls. SimSid *string `json:"sim_sid,omitempty"` Status *string `json:"status,omitempty"` - // Identifier of the eUICC that can claim the eSIM Profile. + // Identifier of the eUICC that can claim the eSIM Profile. Eid *string `json:"eid,omitempty"` - // Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`. + // Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`. SmdpPlusAddress *string `json:"smdp_plus_address,omitempty"` - // Unique identifier of the eSIM profile that can be used to identify and download the eSIM profile from the SM-DP+ server. Populated if `generate_matching_id` is set to `true` when creating the eSIM profile reservation. + // Unique identifier of the eSIM profile that can be used to identify and download the eSIM profile from the SM-DP+ server. Populated if `generate_matching_id` is set to `true` when creating the eSIM profile reservation. MatchingId *string `json:"matching_id,omitempty"` - // Combined machine-readable activation code for acquiring an eSIM Profile with the Activation Code download method. Can be used in a QR code to download an eSIM profile. + // Combined machine-readable activation code for acquiring an eSIM Profile with the Activation Code download method. Can be used in a QR code to download an eSIM profile. ActivationCode *string `json:"activation_code,omitempty"` - // Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. + // Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. ErrorCode *string `json:"error_code,omitempty"` - // Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. + // Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. ErrorMessage *string `json:"error_message,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the eSIM Profile resource. + // The absolute URL of the eSIM Profile resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_fleet.go b/rest/supersim/v1/model_supersim_v1_fleet.go index 714f3197f..46e07abeb 100644 --- a/rest/supersim/v1/model_supersim_v1_fleet.go +++ b/rest/supersim/v1/model_supersim_v1_fleet.go @@ -13,40 +13,42 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1Fleet struct for SupersimV1Fleet type SupersimV1Fleet struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Fleet resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Fleet resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the Fleet resource. + // The unique string that we created to identify the Fleet resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Fleet resource. + // The absolute URL of the Fleet resource. Url *string `json:"url,omitempty"` - // Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. + // Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. DataEnabled *bool `json:"data_enabled,omitempty"` - // The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 250MB. - DataLimit *int `json:"data_limit,omitempty"` + // The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 250MB. + DataLimit *int `json:"data_limit,omitempty"` DataMetering *string `json:"data_metering,omitempty"` - // Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `false`. + // Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `false`. SmsCommandsEnabled *bool `json:"sms_commands_enabled,omitempty"` - // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. SmsCommandsUrl *string `json:"sms_commands_url,omitempty"` - // A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + // A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. SmsCommandsMethod *string `json:"sms_commands_method,omitempty"` - // The SID of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. + // The SID of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. NetworkAccessProfileSid *string `json:"network_access_profile_sid,omitempty"` - // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + // The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. IpCommandsUrl *string `json:"ip_commands_url,omitempty"` - // A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + // A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. IpCommandsMethod *string `json:"ip_commands_method,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_ip_command.go b/rest/supersim/v1/model_supersim_v1_ip_command.go index ac83fbdf6..ceaf671b9 100644 --- a/rest/supersim/v1/model_supersim_v1_ip_command.go +++ b/rest/supersim/v1/model_supersim_v1_ip_command.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1IpCommand struct for SupersimV1IpCommand type SupersimV1IpCommand struct { - // The unique string that we created to identify the IP Command resource. + // The unique string that we created to identify the IP Command resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Command resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Command resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. + // The SID of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. SimSid *string `json:"sim_sid,omitempty"` - // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. - SimIccid *string `json:"sim_iccid,omitempty"` - Status *string `json:"status,omitempty"` + // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. + SimIccid *string `json:"sim_iccid,omitempty"` + Status *string `json:"status,omitempty"` Direction *string `json:"direction,omitempty"` - // The IP address of the device that the IP Command was sent to or received from. For an IP Command sent to a Super SIM, `device_ip` starts out as `null`, and once the IP Command is “sent”, the `device_ip` will be filled out. An IP Command sent from a Super SIM have its `device_ip` always set. + // The IP address of the device that the IP Command was sent to or received from. For an IP Command sent to a Super SIM, `device_ip` starts out as `null`, and once the IP Command is “sent”, the `device_ip` will be filled out. An IP Command sent from a Super SIM have its `device_ip` always set. DeviceIp *string `json:"device_ip,omitempty"` - // For an IP Command sent to a Super SIM, it would be the destination port of the IP message. For an IP Command sent from a Super SIM, it would be the source port of the IP message. - DevicePort *int `json:"device_port,omitempty"` + // For an IP Command sent to a Super SIM, it would be the destination port of the IP message. For an IP Command sent from a Super SIM, it would be the source port of the IP message. + DevicePort *int `json:"device_port,omitempty"` PayloadType *string `json:"payload_type,omitempty"` - // The payload that is carried in the IP/UDP message. The payload can be encoded in either text or binary format. For text payload, UTF-8 encoding must be used. For an IP Command sent to a Super SIM, the payload is appended to the IP/UDP message “as is”. The payload should not exceed 1300 bytes. For an IP Command sent from a Super SIM, the payload from the received IP/UDP message is extracted and sent in binary encoding. For an IP Command sent from a Super SIM, the payload should not exceed 1300 bytes. If it is larger than 1300 bytes, there might be fragmentation on the upstream and the message may appear truncated. + // The payload that is carried in the IP/UDP message. The payload can be encoded in either text or binary format. For text payload, UTF-8 encoding must be used. For an IP Command sent to a Super SIM, the payload is appended to the IP/UDP message “as is”. The payload should not exceed 1300 bytes. For an IP Command sent from a Super SIM, the payload from the received IP/UDP message is extracted and sent in binary encoding. For an IP Command sent from a Super SIM, the payload should not exceed 1300 bytes. If it is larger than 1300 bytes, there might be fragmentation on the upstream and the message may appear truncated. Payload *string `json:"payload,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the IP Command resource. + // The absolute URL of the IP Command resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_network.go b/rest/supersim/v1/model_supersim_v1_network.go index 07d717975..daf499a5d 100644 --- a/rest/supersim/v1/model_supersim_v1_network.go +++ b/rest/supersim/v1/model_supersim_v1_network.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SupersimV1Network struct for SupersimV1Network type SupersimV1Network struct { - // The unique string that we created to identify the Network resource. + // The unique string that we created to identify the Network resource. Sid *string `json:"sid,omitempty"` - // A human readable identifier of this resource. + // A human readable identifier of this resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The absolute URL of the Network resource. + // The absolute URL of the Network resource. Url *string `json:"url,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. IsoCountry *string `json:"iso_country,omitempty"` - // Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. + // Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. Identifiers *[]interface{} `json:"identifiers,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_network_access_profile.go b/rest/supersim/v1/model_supersim_v1_network_access_profile.go index 956d7750e..9d9c38cb3 100644 --- a/rest/supersim/v1/model_supersim_v1_network_access_profile.go +++ b/rest/supersim/v1/model_supersim_v1_network_access_profile.go @@ -13,24 +13,26 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1NetworkAccessProfile struct for SupersimV1NetworkAccessProfile type SupersimV1NetworkAccessProfile struct { - // The unique string that identifies the Network Access Profile resource. + // The unique string that identifies the Network Access Profile resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Network Access Profile belongs to. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Network Access Profile belongs to. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Network Access Profile resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the Network Access Profile resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_network_access_profile_network.go b/rest/supersim/v1/model_supersim_v1_network_access_profile_network.go index 48c9eeabb..82c386604 100644 --- a/rest/supersim/v1/model_supersim_v1_network_access_profile_network.go +++ b/rest/supersim/v1/model_supersim_v1_network_access_profile_network.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SupersimV1NetworkAccessProfileNetwork struct for SupersimV1NetworkAccessProfileNetwork type SupersimV1NetworkAccessProfileNetwork struct { - // The unique string that identifies the Network resource. + // The unique string that identifies the Network resource. Sid *string `json:"sid,omitempty"` - // The unique string that identifies the Network resource's Network Access Profile resource. + // The unique string that identifies the Network resource's Network Access Profile resource. NetworkAccessProfileSid *string `json:"network_access_profile_sid,omitempty"` - // A human readable identifier of the Network this resource refers to. + // A human readable identifier of the Network this resource refers to. FriendlyName *string `json:"friendly_name,omitempty"` - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. IsoCountry *string `json:"iso_country,omitempty"` - // Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. + // Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. Identifiers *[]interface{} `json:"identifiers,omitempty"` - // The absolute URL of the Network resource. + // The absolute URL of the Network resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_settings_update.go b/rest/supersim/v1/model_supersim_v1_settings_update.go index 3f767cfdc..1a98eeb52 100644 --- a/rest/supersim/v1/model_supersim_v1_settings_update.go +++ b/rest/supersim/v1/model_supersim_v1_settings_update.go @@ -13,26 +13,28 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1SettingsUpdate struct for SupersimV1SettingsUpdate type SupersimV1SettingsUpdate struct { - // The unique identifier of this Settings Update. + // The unique identifier of this Settings Update. Sid *string `json:"sid,omitempty"` - // The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. + // The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. Iccid *string `json:"iccid,omitempty"` - // The SID of the Super SIM to which this Settings Update was applied. + // The SID of the Super SIM to which this Settings Update was applied. SimSid *string `json:"sim_sid,omitempty"` Status *string `json:"status,omitempty"` - // Array containing the different Settings Packages that will be applied to the SIM after the update completes. Each object within the array indicates the name and the version of the Settings Package that will be on the SIM if the update is successful. + // Array containing the different Settings Packages that will be applied to the SIM after the update completes. Each object within the array indicates the name and the version of the Settings Package that will be on the SIM if the update is successful. Packages *[]interface{} `json:"packages,omitempty"` - // The time, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, when the update successfully completed and the new settings were applied to the SIM. + // The time, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, when the update successfully completed and the new settings were applied to the SIM. DateCompleted *time.Time `json:"date_completed,omitempty"` - // The date that this Settings Update was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Settings Update was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Settings Update was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Settings Update was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_sim.go b/rest/supersim/v1/model_supersim_v1_sim.go index eccb5af3d..e483fb1cc 100644 --- a/rest/supersim/v1/model_supersim_v1_sim.go +++ b/rest/supersim/v1/model_supersim_v1_sim.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1Sim struct for SupersimV1Sim type SupersimV1Sim struct { - // The unique string that identifies the Sim resource. + // The unique string that identifies the Sim resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Super SIM belongs to. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Super SIM belongs to. AccountSid *string `json:"account_sid,omitempty"` - // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM. - Iccid *string `json:"iccid,omitempty"` + // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM. + Iccid *string `json:"iccid,omitempty"` Status *string `json:"status,omitempty"` - // The unique ID of the Fleet configured for this SIM. + // The unique ID of the Fleet configured for this SIM. FleetSid *string `json:"fleet_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Sim Resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the Sim Resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_sim_ip_address.go b/rest/supersim/v1/model_supersim_v1_sim_ip_address.go index 5a7016192..1b0448126 100644 --- a/rest/supersim/v1/model_supersim_v1_sim_ip_address.go +++ b/rest/supersim/v1/model_supersim_v1_sim_ip_address.go @@ -13,10 +13,15 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SupersimV1SimIpAddress struct for SupersimV1SimIpAddress type SupersimV1SimIpAddress struct { - // IP address assigned to the given Super SIM - IpAddress *string `json:"ip_address,omitempty"` + // IP address assigned to the given Super SIM + IpAddress *string `json:"ip_address,omitempty"` IpAddressVersion *string `json:"ip_address_version,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_sms_command.go b/rest/supersim/v1/model_supersim_v1_sms_command.go index 159cbf674..c43f5ac70 100644 --- a/rest/supersim/v1/model_supersim_v1_sms_command.go +++ b/rest/supersim/v1/model_supersim_v1_sms_command.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SupersimV1SmsCommand struct for SupersimV1SmsCommand type SupersimV1SmsCommand struct { - // The unique string that we created to identify the SMS Command resource. + // The unique string that we created to identify the SMS Command resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SMS Command resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SMS Command resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this SMS Command was sent to or from. + // The SID of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this SMS Command was sent to or from. SimSid *string `json:"sim_sid,omitempty"` - // The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters. - Payload *string `json:"payload,omitempty"` - Status *string `json:"status,omitempty"` + // The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters. + Payload *string `json:"payload,omitempty"` + Status *string `json:"status,omitempty"` Direction *string `json:"direction,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the SMS Command resource. + // The absolute URL of the SMS Command resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/supersim/v1/model_supersim_v1_usage_record.go b/rest/supersim/v1/model_supersim_v1_usage_record.go index 4ec9a10ac..93139d20c 100644 --- a/rest/supersim/v1/model_supersim_v1_usage_record.go +++ b/rest/supersim/v1/model_supersim_v1_usage_record.go @@ -13,52 +13,49 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // SupersimV1UsageRecord struct for SupersimV1UsageRecord type SupersimV1UsageRecord struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. AccountSid *string `json:"account_sid,omitempty"` - // SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. + // SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. SimSid *string `json:"sim_sid,omitempty"` - // SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`. + // SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`. NetworkSid *string `json:"network_sid,omitempty"` - // SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`. + // SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`. FleetSid *string `json:"fleet_sid,omitempty"` - // Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`. + // Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`. IsoCountry *string `json:"iso_country,omitempty"` - // The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Period *interface{} `json:"period,omitempty"` - // Total data uploaded in bytes, aggregated by the query parameters. + // Total data uploaded in bytes, aggregated by the query parameters. DataUpload *int64 `json:"data_upload,omitempty"` - // Total data downloaded in bytes, aggregated by the query parameters. + // Total data downloaded in bytes, aggregated by the query parameters. DataDownload *int64 `json:"data_download,omitempty"` - // Total of data_upload and data_download. + // Total of data_upload and data_download. DataTotal *int64 `json:"data_total,omitempty"` - // Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. + // Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. DataTotalBilled *float32 `json:"data_total_billed,omitempty"` - // The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. + // The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. BilledUnit *string `json:"billed_unit,omitempty"` } func (response *SupersimV1UsageRecord) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - AccountSid *string `json:"account_sid"` - SimSid *string `json:"sim_sid"` - NetworkSid *string `json:"network_sid"` - FleetSid *string `json:"fleet_sid"` - IsoCountry *string `json:"iso_country"` - Period *interface{} `json:"period"` - DataUpload *int64 `json:"data_upload"` - DataDownload *int64 `json:"data_download"` - DataTotal *int64 `json:"data_total"` + AccountSid *string `json:"account_sid"` + SimSid *string `json:"sim_sid"` + NetworkSid *string `json:"network_sid"` + FleetSid *string `json:"fleet_sid"` + IsoCountry *string `json:"iso_country"` + Period *interface{} `json:"period"` + DataUpload *int64 `json:"data_upload"` + DataDownload *int64 `json:"data_download"` + DataTotal *int64 `json:"data_total"` DataTotalBilled *interface{} `json:"data_total_billed"` - BilledUnit *string `json:"billed_unit"` + BilledUnit *string `json:"billed_unit"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -66,16 +63,16 @@ func (response *SupersimV1UsageRecord) UnmarshalJSON(bytes []byte) (err error) { } *response = SupersimV1UsageRecord{ - AccountSid: raw.AccountSid, - SimSid: raw.SimSid, - NetworkSid: raw.NetworkSid, - FleetSid: raw.FleetSid, - IsoCountry: raw.IsoCountry, - Period: raw.Period, - DataUpload: raw.DataUpload, + AccountSid: raw.AccountSid, + SimSid: raw.SimSid, + NetworkSid: raw.NetworkSid, + FleetSid: raw.FleetSid, + IsoCountry: raw.IsoCountry, + Period: raw.Period, + DataUpload: raw.DataUpload, DataDownload: raw.DataDownload, - DataTotal: raw.DataTotal, - BilledUnit: raw.BilledUnit, + DataTotal: raw.DataTotal, + BilledUnit: raw.BilledUnit, } responseDataTotalBilled, err := client.UnmarshalFloat32(raw.DataTotalBilled) @@ -86,3 +83,4 @@ func (response *SupersimV1UsageRecord) UnmarshalJSON(bytes []byte) (err error) { return } + diff --git a/rest/supersim/v1/network_access_profiles.go b/rest/supersim/v1/network_access_profiles.go index c82957dce..91f9fcd44 100644 --- a/rest/supersim/v1/network_access_profiles.go +++ b/rest/supersim/v1/network_access_profiles.go @@ -18,130 +18,134 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNetworkAccessProfile' type CreateNetworkAccessProfileParams struct { - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // List of Network SIDs that this Network Access Profile will allow connections to. - Networks *[]string `json:"Networks,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // List of Network SIDs that this Network Access Profile will allow connections to. + Networks *[]string `json:"Networks,omitempty"` } -func (params *CreateNetworkAccessProfileParams) SetUniqueName(UniqueName string) *CreateNetworkAccessProfileParams { - params.UniqueName = &UniqueName - return params +func (params *CreateNetworkAccessProfileParams) SetUniqueName(UniqueName string) (*CreateNetworkAccessProfileParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateNetworkAccessProfileParams) SetNetworks(Networks []string) *CreateNetworkAccessProfileParams { - params.Networks = &Networks - return params +func (params *CreateNetworkAccessProfileParams) SetNetworks(Networks []string) (*CreateNetworkAccessProfileParams){ + params.Networks = &Networks + return params } // Create a new Network Access Profile func (c *ApiService) CreateNetworkAccessProfile(params *CreateNetworkAccessProfileParams) (*SupersimV1NetworkAccessProfile, error) { - path := "/v1/NetworkAccessProfiles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Networks != nil { - for _, item := range *params.Networks { - data.Add("Networks", item) - } - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1NetworkAccessProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/NetworkAccessProfiles" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Networks != nil { + for _, item := range *params.Networks { + data.Add("Networks", item) + } + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1NetworkAccessProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch a Network Access Profile instance from your account. -func (c *ApiService) FetchNetworkAccessProfile(Sid string) (*SupersimV1NetworkAccessProfile, error) { - path := "/v1/NetworkAccessProfiles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchNetworkAccessProfile(Sid string, ) (*SupersimV1NetworkAccessProfile, error) { + path := "/v1/NetworkAccessProfiles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1NetworkAccessProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SupersimV1NetworkAccessProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListNetworkAccessProfile' type ListNetworkAccessProfileParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListNetworkAccessProfileParams) SetPageSize(PageSize int) *ListNetworkAccessProfileParams { - params.PageSize = &PageSize - return params +func (params *ListNetworkAccessProfileParams) SetPageSize(PageSize int) (*ListNetworkAccessProfileParams){ + params.PageSize = &PageSize + return params } -func (params *ListNetworkAccessProfileParams) SetLimit(Limit int) *ListNetworkAccessProfileParams { - params.Limit = &Limit - return params +func (params *ListNetworkAccessProfileParams) SetLimit(Limit int) (*ListNetworkAccessProfileParams){ + params.Limit = &Limit + return params } // Retrieve a single page of NetworkAccessProfile records from the API. Request is executed immediately. func (c *ApiService) PageNetworkAccessProfile(params *ListNetworkAccessProfileParams, pageToken, pageNumber string) (*ListNetworkAccessProfileResponse, error) { - path := "/v1/NetworkAccessProfiles" + path := "/v1/NetworkAccessProfiles" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListNetworkAccessProfileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListNetworkAccessProfileResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists NetworkAccessProfile records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -182,6 +186,7 @@ func (c *ApiService) StreamNetworkAccessProfile(params *ListNetworkAccessProfile return recordChannel, errorChannel } + func (c *ApiService) streamNetworkAccessProfile(response *ListNetworkAccessProfileResponse, params *ListNetworkAccessProfileParams, recordChannel chan SupersimV1NetworkAccessProfile, errorChannel chan error) { curRecord := 1 @@ -213,57 +218,59 @@ func (c *ApiService) streamNetworkAccessProfile(response *ListNetworkAccessProfi } func (c *ApiService) getNextListNetworkAccessProfileResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListNetworkAccessProfileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListNetworkAccessProfileResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateNetworkAccessProfile' type UpdateNetworkAccessProfileParams struct { - // The new unique name of the Network Access Profile. - UniqueName *string `json:"UniqueName,omitempty"` + // The new unique name of the Network Access Profile. + UniqueName *string `json:"UniqueName,omitempty"` } -func (params *UpdateNetworkAccessProfileParams) SetUniqueName(UniqueName string) *UpdateNetworkAccessProfileParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateNetworkAccessProfileParams) SetUniqueName(UniqueName string) (*UpdateNetworkAccessProfileParams){ + params.UniqueName = &UniqueName + return params } // Updates the given properties of a Network Access Profile in your account. func (c *ApiService) UpdateNetworkAccessProfile(Sid string, params *UpdateNetworkAccessProfileParams) (*SupersimV1NetworkAccessProfile, error) { - path := "/v1/NetworkAccessProfiles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/NetworkAccessProfiles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SupersimV1NetworkAccessProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SupersimV1NetworkAccessProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/supersim/v1/network_access_profiles_networks.go b/rest/supersim/v1/network_access_profiles_networks.go index b711accbb..74535546e 100644 --- a/rest/supersim/v1/network_access_profiles_networks.go +++ b/rest/supersim/v1/network_access_profiles_networks.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNetworkAccessProfileNetwork' type CreateNetworkAccessProfileNetworkParams struct { - // The SID of the Network resource to be added to the Network Access Profile resource. - Network *string `json:"Network,omitempty"` + // The SID of the Network resource to be added to the Network Access Profile resource. + Network *string `json:"Network,omitempty"` } -func (params *CreateNetworkAccessProfileNetworkParams) SetNetwork(Network string) *CreateNetworkAccessProfileNetworkParams { - params.Network = &Network - return params +func (params *CreateNetworkAccessProfileNetworkParams) SetNetwork(Network string) (*CreateNetworkAccessProfileNetworkParams){ + params.Network = &Network + return params } // Add a Network resource to the Network Access Profile resource. func (c *ApiService) CreateNetworkAccessProfileNetwork(NetworkAccessProfileSid string, params *CreateNetworkAccessProfileNetworkParams) (*SupersimV1NetworkAccessProfileNetwork, error) { - path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks" - path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) + path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks" + path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Network != nil { - data.Set("Network", *params.Network) - } + if params != nil && params.Network != nil { + data.Set("Network", *params.Network) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SupersimV1NetworkAccessProfileNetwork{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SupersimV1NetworkAccessProfileNetwork{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove a Network resource from the Network Access Profile resource's. -func (c *ApiService) DeleteNetworkAccessProfileNetwork(NetworkAccessProfileSid string, Sid string) error { - path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks/{Sid}" - path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteNetworkAccessProfileNetwork(NetworkAccessProfileSid string, Sid string, ) (error) { + path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks/{Sid}" + path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a Network Access Profile resource's Network resource. -func (c *ApiService) FetchNetworkAccessProfileNetwork(NetworkAccessProfileSid string, Sid string) (*SupersimV1NetworkAccessProfileNetwork, error) { - path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks/{Sid}" - path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchNetworkAccessProfileNetwork(NetworkAccessProfileSid string, Sid string, ) (*SupersimV1NetworkAccessProfileNetwork, error) { + path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks/{Sid}" + path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1NetworkAccessProfileNetwork{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1NetworkAccessProfileNetwork{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListNetworkAccessProfileNetwork' type ListNetworkAccessProfileNetworkParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListNetworkAccessProfileNetworkParams) SetPageSize(PageSize int) *ListNetworkAccessProfileNetworkParams { - params.PageSize = &PageSize - return params +func (params *ListNetworkAccessProfileNetworkParams) SetPageSize(PageSize int) (*ListNetworkAccessProfileNetworkParams){ + params.PageSize = &PageSize + return params } -func (params *ListNetworkAccessProfileNetworkParams) SetLimit(Limit int) *ListNetworkAccessProfileNetworkParams { - params.Limit = &Limit - return params +func (params *ListNetworkAccessProfileNetworkParams) SetLimit(Limit int) (*ListNetworkAccessProfileNetworkParams){ + params.Limit = &Limit + return params } // Retrieve a single page of NetworkAccessProfileNetwork records from the API. Request is executed immediately. func (c *ApiService) PageNetworkAccessProfileNetwork(NetworkAccessProfileSid string, params *ListNetworkAccessProfileNetworkParams, pageToken, pageNumber string) (*ListNetworkAccessProfileNetworkResponse, error) { - path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks" + path := "/v1/NetworkAccessProfiles/{NetworkAccessProfileSid}/Networks" - path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) + path = strings.Replace(path, "{"+"NetworkAccessProfileSid"+"}", NetworkAccessProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListNetworkAccessProfileNetworkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListNetworkAccessProfileNetworkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists NetworkAccessProfileNetwork records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamNetworkAccessProfileNetwork(NetworkAccessProfileSid s return recordChannel, errorChannel } + func (c *ApiService) streamNetworkAccessProfileNetwork(response *ListNetworkAccessProfileNetworkResponse, params *ListNetworkAccessProfileNetworkParams, recordChannel chan SupersimV1NetworkAccessProfileNetwork, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamNetworkAccessProfileNetwork(response *ListNetworkAcce } func (c *ApiService) getNextListNetworkAccessProfileNetworkResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListNetworkAccessProfileNetworkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListNetworkAccessProfileNetworkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/networks.go b/rest/supersim/v1/networks.go index d49f3300b..ea6359ad7 100644 --- a/rest/supersim/v1/networks.go +++ b/rest/supersim/v1/networks.go @@ -18,109 +18,112 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a Network resource. -func (c *ApiService) FetchNetwork(Sid string) (*SupersimV1Network, error) { - path := "/v1/Networks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchNetwork(Sid string, ) (*SupersimV1Network, error) { + path := "/v1/Networks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1Network{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SupersimV1Network{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListNetwork' type ListNetworkParams struct { - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. - IsoCountry *string `json:"IsoCountry,omitempty"` - // The 'mobile country code' of a country. Network resources with this `mcc` in their `identifiers` will be read. - Mcc *string `json:"Mcc,omitempty"` - // The 'mobile network code' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. - Mnc *string `json:"Mnc,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. + IsoCountry *string `json:"IsoCountry,omitempty"` + // The 'mobile country code' of a country. Network resources with this `mcc` in their `identifiers` will be read. + Mcc *string `json:"Mcc,omitempty"` + // The 'mobile network code' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. + Mnc *string `json:"Mnc,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListNetworkParams) SetIsoCountry(IsoCountry string) *ListNetworkParams { - params.IsoCountry = &IsoCountry - return params +func (params *ListNetworkParams) SetIsoCountry(IsoCountry string) (*ListNetworkParams){ + params.IsoCountry = &IsoCountry + return params } -func (params *ListNetworkParams) SetMcc(Mcc string) *ListNetworkParams { - params.Mcc = &Mcc - return params +func (params *ListNetworkParams) SetMcc(Mcc string) (*ListNetworkParams){ + params.Mcc = &Mcc + return params } -func (params *ListNetworkParams) SetMnc(Mnc string) *ListNetworkParams { - params.Mnc = &Mnc - return params +func (params *ListNetworkParams) SetMnc(Mnc string) (*ListNetworkParams){ + params.Mnc = &Mnc + return params } -func (params *ListNetworkParams) SetPageSize(PageSize int) *ListNetworkParams { - params.PageSize = &PageSize - return params +func (params *ListNetworkParams) SetPageSize(PageSize int) (*ListNetworkParams){ + params.PageSize = &PageSize + return params } -func (params *ListNetworkParams) SetLimit(Limit int) *ListNetworkParams { - params.Limit = &Limit - return params +func (params *ListNetworkParams) SetLimit(Limit int) (*ListNetworkParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Network records from the API. Request is executed immediately. func (c *ApiService) PageNetwork(params *ListNetworkParams, pageToken, pageNumber string) (*ListNetworkResponse, error) { - path := "/v1/Networks" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.Mcc != nil { - data.Set("Mcc", *params.Mcc) - } - if params != nil && params.Mnc != nil { - data.Set("Mnc", *params.Mnc) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListNetworkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Networks" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.Mcc != nil { + data.Set("Mcc", *params.Mcc) + } + if params != nil && params.Mnc != nil { + data.Set("Mnc", *params.Mnc) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListNetworkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Network records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -161,6 +164,7 @@ func (c *ApiService) StreamNetwork(params *ListNetworkParams) (chan SupersimV1Ne return recordChannel, errorChannel } + func (c *ApiService) streamNetwork(response *ListNetworkResponse, params *ListNetworkParams, recordChannel chan SupersimV1Network, errorChannel chan error) { curRecord := 1 @@ -192,19 +196,20 @@ func (c *ApiService) streamNetwork(response *ListNetworkResponse, params *ListNe } func (c *ApiService) getNextListNetworkResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListNetworkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListNetworkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/settings_updates.go b/rest/supersim/v1/settings_updates.go index 69134286a..a0a3ff17c 100644 --- a/rest/supersim/v1/settings_updates.go +++ b/rest/supersim/v1/settings_updates.go @@ -19,75 +19,77 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListSettingsUpdate' type ListSettingsUpdateParams struct { - // Filter the Settings Updates by a Super SIM's SID or UniqueName. - Sim *string `json:"Sim,omitempty"` - // Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Filter the Settings Updates by a Super SIM's SID or UniqueName. + Sim *string `json:"Sim,omitempty"` + // Filter the Settings Updates by status. Can be `scheduled`, `in-progress`, `successful`, or `failed`. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSettingsUpdateParams) SetSim(Sim string) *ListSettingsUpdateParams { - params.Sim = &Sim - return params +func (params *ListSettingsUpdateParams) SetSim(Sim string) (*ListSettingsUpdateParams){ + params.Sim = &Sim + return params } -func (params *ListSettingsUpdateParams) SetStatus(Status string) *ListSettingsUpdateParams { - params.Status = &Status - return params +func (params *ListSettingsUpdateParams) SetStatus(Status string) (*ListSettingsUpdateParams){ + params.Status = &Status + return params } -func (params *ListSettingsUpdateParams) SetPageSize(PageSize int) *ListSettingsUpdateParams { - params.PageSize = &PageSize - return params +func (params *ListSettingsUpdateParams) SetPageSize(PageSize int) (*ListSettingsUpdateParams){ + params.PageSize = &PageSize + return params } -func (params *ListSettingsUpdateParams) SetLimit(Limit int) *ListSettingsUpdateParams { - params.Limit = &Limit - return params +func (params *ListSettingsUpdateParams) SetLimit(Limit int) (*ListSettingsUpdateParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SettingsUpdate records from the API. Request is executed immediately. func (c *ApiService) PageSettingsUpdate(params *ListSettingsUpdateParams, pageToken, pageNumber string) (*ListSettingsUpdateResponse, error) { - path := "/v1/SettingsUpdates" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSettingsUpdateResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/SettingsUpdates" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSettingsUpdateResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists SettingsUpdate records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -128,6 +130,7 @@ func (c *ApiService) StreamSettingsUpdate(params *ListSettingsUpdateParams) (cha return recordChannel, errorChannel } + func (c *ApiService) streamSettingsUpdate(response *ListSettingsUpdateResponse, params *ListSettingsUpdateParams, recordChannel chan SupersimV1SettingsUpdate, errorChannel chan error) { curRecord := 1 @@ -159,19 +162,20 @@ func (c *ApiService) streamSettingsUpdate(response *ListSettingsUpdateResponse, } func (c *ApiService) getNextListSettingsUpdateResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSettingsUpdateResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSettingsUpdateResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/sims.go b/rest/supersim/v1/sims.go index c988a08e0..6d2ad8a90 100644 --- a/rest/supersim/v1/sims.go +++ b/rest/supersim/v1/sims.go @@ -18,155 +18,159 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSim' type CreateSimParams struct { - // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the Super SIM to be added to your Account. - Iccid *string `json:"Iccid,omitempty"` - // The 10-digit code required to claim the Super SIM for your Account. - RegistrationCode *string `json:"RegistrationCode,omitempty"` + // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the Super SIM to be added to your Account. + Iccid *string `json:"Iccid,omitempty"` + // The 10-digit code required to claim the Super SIM for your Account. + RegistrationCode *string `json:"RegistrationCode,omitempty"` } -func (params *CreateSimParams) SetIccid(Iccid string) *CreateSimParams { - params.Iccid = &Iccid - return params +func (params *CreateSimParams) SetIccid(Iccid string) (*CreateSimParams){ + params.Iccid = &Iccid + return params } -func (params *CreateSimParams) SetRegistrationCode(RegistrationCode string) *CreateSimParams { - params.RegistrationCode = &RegistrationCode - return params +func (params *CreateSimParams) SetRegistrationCode(RegistrationCode string) (*CreateSimParams){ + params.RegistrationCode = &RegistrationCode + return params } // Register a Super SIM to your Account func (c *ApiService) CreateSim(params *CreateSimParams) (*SupersimV1Sim, error) { - path := "/v1/Sims" + path := "/v1/Sims" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Iccid != nil { + data.Set("Iccid", *params.Iccid) + } + if params != nil && params.RegistrationCode != nil { + data.Set("RegistrationCode", *params.RegistrationCode) + } - if params != nil && params.Iccid != nil { - data.Set("Iccid", *params.Iccid) - } - if params != nil && params.RegistrationCode != nil { - data.Set("RegistrationCode", *params.RegistrationCode) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &SupersimV1Sim{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &SupersimV1Sim{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Fetch a Super SIM instance from your account. -func (c *ApiService) FetchSim(Sid string) (*SupersimV1Sim, error) { - path := "/v1/Sims/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSim(Sid string, ) (*SupersimV1Sim, error) { + path := "/v1/Sims/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1Sim{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1Sim{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSim' type ListSimParams struct { - // The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. - Status *string `json:"Status,omitempty"` - // The SID or unique name of the Fleet to which a list of Sims are assigned. - Fleet *string `json:"Fleet,omitempty"` - // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. - Iccid *string `json:"Iccid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. + Status *string `json:"Status,omitempty"` + // The SID or unique name of the Fleet to which a list of Sims are assigned. + Fleet *string `json:"Fleet,omitempty"` + // The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. + Iccid *string `json:"Iccid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSimParams) SetStatus(Status string) *ListSimParams { - params.Status = &Status - return params +func (params *ListSimParams) SetStatus(Status string) (*ListSimParams){ + params.Status = &Status + return params } -func (params *ListSimParams) SetFleet(Fleet string) *ListSimParams { - params.Fleet = &Fleet - return params +func (params *ListSimParams) SetFleet(Fleet string) (*ListSimParams){ + params.Fleet = &Fleet + return params } -func (params *ListSimParams) SetIccid(Iccid string) *ListSimParams { - params.Iccid = &Iccid - return params +func (params *ListSimParams) SetIccid(Iccid string) (*ListSimParams){ + params.Iccid = &Iccid + return params } -func (params *ListSimParams) SetPageSize(PageSize int) *ListSimParams { - params.PageSize = &PageSize - return params +func (params *ListSimParams) SetPageSize(PageSize int) (*ListSimParams){ + params.PageSize = &PageSize + return params } -func (params *ListSimParams) SetLimit(Limit int) *ListSimParams { - params.Limit = &Limit - return params +func (params *ListSimParams) SetLimit(Limit int) (*ListSimParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Sim records from the API. Request is executed immediately. func (c *ApiService) PageSim(params *ListSimParams, pageToken, pageNumber string) (*ListSimResponse, error) { - path := "/v1/Sims" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Fleet != nil { - data.Set("Fleet", *params.Fleet) - } - if params != nil && params.Iccid != nil { - data.Set("Iccid", *params.Iccid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSimResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Sims" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Fleet != nil { + data.Set("Fleet", *params.Fleet) + } + if params != nil && params.Iccid != nil { + data.Set("Iccid", *params.Iccid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSimResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Sim records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +211,7 @@ func (c *ApiService) StreamSim(params *ListSimParams) (chan SupersimV1Sim, chan return recordChannel, errorChannel } + func (c *ApiService) streamSim(response *ListSimResponse, params *ListSimParams, recordChannel chan SupersimV1Sim, errorChannel chan error) { curRecord := 1 @@ -238,102 +243,104 @@ func (c *ApiService) streamSim(response *ListSimResponse, params *ListSimParams, } func (c *ApiService) getNextListSimResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSimResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSimResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSim' type UpdateSimParams struct { - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // - Status *string `json:"Status,omitempty"` - // The SID or unique name of the Fleet to which the SIM resource should be assigned. - Fleet *string `json:"Fleet,omitempty"` - // The URL we should call using the `callback_method` after an asynchronous update has finished. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource's status is new. - AccountSid *string `json:"AccountSid,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The SID or unique name of the Fleet to which the SIM resource should be assigned. + Fleet *string `json:"Fleet,omitempty"` + // The URL we should call using the `callback_method` after an asynchronous update has finished. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource's status is new. + AccountSid *string `json:"AccountSid,omitempty"` } -func (params *UpdateSimParams) SetUniqueName(UniqueName string) *UpdateSimParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateSimParams) SetUniqueName(UniqueName string) (*UpdateSimParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateSimParams) SetStatus(Status string) *UpdateSimParams { - params.Status = &Status - return params +func (params *UpdateSimParams) SetStatus(Status string) (*UpdateSimParams){ + params.Status = &Status + return params } -func (params *UpdateSimParams) SetFleet(Fleet string) *UpdateSimParams { - params.Fleet = &Fleet - return params +func (params *UpdateSimParams) SetFleet(Fleet string) (*UpdateSimParams){ + params.Fleet = &Fleet + return params } -func (params *UpdateSimParams) SetCallbackUrl(CallbackUrl string) *UpdateSimParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *UpdateSimParams) SetCallbackUrl(CallbackUrl string) (*UpdateSimParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *UpdateSimParams) SetCallbackMethod(CallbackMethod string) *UpdateSimParams { - params.CallbackMethod = &CallbackMethod - return params +func (params *UpdateSimParams) SetCallbackMethod(CallbackMethod string) (*UpdateSimParams){ + params.CallbackMethod = &CallbackMethod + return params } -func (params *UpdateSimParams) SetAccountSid(AccountSid string) *UpdateSimParams { - params.AccountSid = &AccountSid - return params +func (params *UpdateSimParams) SetAccountSid(AccountSid string) (*UpdateSimParams){ + params.AccountSid = &AccountSid + return params } // Updates the given properties of a Super SIM instance from your account. func (c *ApiService) UpdateSim(Sid string, params *UpdateSimParams) (*SupersimV1Sim, error) { - path := "/v1/Sims/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Fleet != nil { - data.Set("Fleet", *params.Fleet) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.AccountSid != nil { - data.Set("AccountSid", *params.AccountSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1Sim{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Sims/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Fleet != nil { + data.Set("Fleet", *params.Fleet) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.AccountSid != nil { + data.Set("AccountSid", *params.AccountSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1Sim{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/supersim/v1/sims_billing_periods.go b/rest/supersim/v1/sims_billing_periods.go index c6b866fed..cc74bd3ca 100644 --- a/rest/supersim/v1/sims_billing_periods.go +++ b/rest/supersim/v1/sims_billing_periods.go @@ -18,61 +18,61 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListBillingPeriod' type ListBillingPeriodParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBillingPeriodParams) SetPageSize(PageSize int) *ListBillingPeriodParams { - params.PageSize = &PageSize - return params +func (params *ListBillingPeriodParams) SetPageSize(PageSize int) (*ListBillingPeriodParams){ + params.PageSize = &PageSize + return params } -func (params *ListBillingPeriodParams) SetLimit(Limit int) *ListBillingPeriodParams { - params.Limit = &Limit - return params +func (params *ListBillingPeriodParams) SetLimit(Limit int) (*ListBillingPeriodParams){ + params.Limit = &Limit + return params } // Retrieve a single page of BillingPeriod records from the API. Request is executed immediately. func (c *ApiService) PageBillingPeriod(SimSid string, params *ListBillingPeriodParams, pageToken, pageNumber string) (*ListBillingPeriodResponse, error) { - path := "/v1/Sims/{SimSid}/BillingPeriods" + path := "/v1/Sims/{SimSid}/BillingPeriods" - path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) + path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBillingPeriodResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListBillingPeriodResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists BillingPeriod records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -113,6 +113,7 @@ func (c *ApiService) StreamBillingPeriod(SimSid string, params *ListBillingPerio return recordChannel, errorChannel } + func (c *ApiService) streamBillingPeriod(response *ListBillingPeriodResponse, params *ListBillingPeriodParams, recordChannel chan SupersimV1BillingPeriod, errorChannel chan error) { curRecord := 1 @@ -144,19 +145,20 @@ func (c *ApiService) streamBillingPeriod(response *ListBillingPeriodResponse, pa } func (c *ApiService) getNextListBillingPeriodResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBillingPeriodResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBillingPeriodResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/sims_ip_addresses.go b/rest/supersim/v1/sims_ip_addresses.go index f1e73eab5..4cfa649d5 100644 --- a/rest/supersim/v1/sims_ip_addresses.go +++ b/rest/supersim/v1/sims_ip_addresses.go @@ -18,61 +18,61 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListSimIpAddress' type ListSimIpAddressParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSimIpAddressParams) SetPageSize(PageSize int) *ListSimIpAddressParams { - params.PageSize = &PageSize - return params +func (params *ListSimIpAddressParams) SetPageSize(PageSize int) (*ListSimIpAddressParams){ + params.PageSize = &PageSize + return params } -func (params *ListSimIpAddressParams) SetLimit(Limit int) *ListSimIpAddressParams { - params.Limit = &Limit - return params +func (params *ListSimIpAddressParams) SetLimit(Limit int) (*ListSimIpAddressParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SimIpAddress records from the API. Request is executed immediately. func (c *ApiService) PageSimIpAddress(SimSid string, params *ListSimIpAddressParams, pageToken, pageNumber string) (*ListSimIpAddressResponse, error) { - path := "/v1/Sims/{SimSid}/IpAddresses" + path := "/v1/Sims/{SimSid}/IpAddresses" - path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) + path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSimIpAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSimIpAddressResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SimIpAddress records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -113,6 +113,7 @@ func (c *ApiService) StreamSimIpAddress(SimSid string, params *ListSimIpAddressP return recordChannel, errorChannel } + func (c *ApiService) streamSimIpAddress(response *ListSimIpAddressResponse, params *ListSimIpAddressParams, recordChannel chan SupersimV1SimIpAddress, errorChannel chan error) { curRecord := 1 @@ -144,19 +145,20 @@ func (c *ApiService) streamSimIpAddress(response *ListSimIpAddressResponse, para } func (c *ApiService) getNextListSimIpAddressResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSimIpAddressResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSimIpAddressResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/sms_commands.go b/rest/supersim/v1/sms_commands.go index 5e36deb00..06d36c441 100644 --- a/rest/supersim/v1/sms_commands.go +++ b/rest/supersim/v1/sms_commands.go @@ -18,173 +18,177 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSmsCommand' type CreateSmsCommandParams struct { - // The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the SMS Command to. - Sim *string `json:"Sim,omitempty"` - // The message body of the SMS Command. - Payload *string `json:"Payload,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // The URL we should call using the `callback_method` after we have sent the command. - CallbackUrl *string `json:"CallbackUrl,omitempty"` + // The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the SMS Command to. + Sim *string `json:"Sim,omitempty"` + // The message body of the SMS Command. + Payload *string `json:"Payload,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // The URL we should call using the `callback_method` after we have sent the command. + CallbackUrl *string `json:"CallbackUrl,omitempty"` } -func (params *CreateSmsCommandParams) SetSim(Sim string) *CreateSmsCommandParams { - params.Sim = &Sim - return params +func (params *CreateSmsCommandParams) SetSim(Sim string) (*CreateSmsCommandParams){ + params.Sim = &Sim + return params } -func (params *CreateSmsCommandParams) SetPayload(Payload string) *CreateSmsCommandParams { - params.Payload = &Payload - return params +func (params *CreateSmsCommandParams) SetPayload(Payload string) (*CreateSmsCommandParams){ + params.Payload = &Payload + return params } -func (params *CreateSmsCommandParams) SetCallbackMethod(CallbackMethod string) *CreateSmsCommandParams { - params.CallbackMethod = &CallbackMethod - return params +func (params *CreateSmsCommandParams) SetCallbackMethod(CallbackMethod string) (*CreateSmsCommandParams){ + params.CallbackMethod = &CallbackMethod + return params } -func (params *CreateSmsCommandParams) SetCallbackUrl(CallbackUrl string) *CreateSmsCommandParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *CreateSmsCommandParams) SetCallbackUrl(CallbackUrl string) (*CreateSmsCommandParams){ + params.CallbackUrl = &CallbackUrl + return params } // Send SMS Command to a Sim. func (c *ApiService) CreateSmsCommand(params *CreateSmsCommandParams) (*SupersimV1SmsCommand, error) { - path := "/v1/SmsCommands" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.Payload != nil { - data.Set("Payload", *params.Payload) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SupersimV1SmsCommand{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/SmsCommands" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.Payload != nil { + data.Set("Payload", *params.Payload) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1SmsCommand{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch SMS Command instance from your account. -func (c *ApiService) FetchSmsCommand(Sid string) (*SupersimV1SmsCommand, error) { - path := "/v1/SmsCommands/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSmsCommand(Sid string, ) (*SupersimV1SmsCommand, error) { + path := "/v1/SmsCommands/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SupersimV1SmsCommand{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SupersimV1SmsCommand{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSmsCommand' type ListSmsCommandParams struct { - // The SID or unique name of the Sim resource that SMS Command was sent to or from. - Sim *string `json:"Sim,omitempty"` - // The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. - Status *string `json:"Status,omitempty"` - // The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. - Direction *string `json:"Direction,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID or unique name of the Sim resource that SMS Command was sent to or from. + Sim *string `json:"Sim,omitempty"` + // The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/iot/supersim/api/smscommand-resource#status-values) for a description of each. + Status *string `json:"Status,omitempty"` + // The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. + Direction *string `json:"Direction,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSmsCommandParams) SetSim(Sim string) *ListSmsCommandParams { - params.Sim = &Sim - return params +func (params *ListSmsCommandParams) SetSim(Sim string) (*ListSmsCommandParams){ + params.Sim = &Sim + return params } -func (params *ListSmsCommandParams) SetStatus(Status string) *ListSmsCommandParams { - params.Status = &Status - return params +func (params *ListSmsCommandParams) SetStatus(Status string) (*ListSmsCommandParams){ + params.Status = &Status + return params } -func (params *ListSmsCommandParams) SetDirection(Direction string) *ListSmsCommandParams { - params.Direction = &Direction - return params +func (params *ListSmsCommandParams) SetDirection(Direction string) (*ListSmsCommandParams){ + params.Direction = &Direction + return params } -func (params *ListSmsCommandParams) SetPageSize(PageSize int) *ListSmsCommandParams { - params.PageSize = &PageSize - return params +func (params *ListSmsCommandParams) SetPageSize(PageSize int) (*ListSmsCommandParams){ + params.PageSize = &PageSize + return params } -func (params *ListSmsCommandParams) SetLimit(Limit int) *ListSmsCommandParams { - params.Limit = &Limit - return params +func (params *ListSmsCommandParams) SetLimit(Limit int) (*ListSmsCommandParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SmsCommand records from the API. Request is executed immediately. func (c *ApiService) PageSmsCommand(params *ListSmsCommandParams, pageToken, pageNumber string) (*ListSmsCommandResponse, error) { - path := "/v1/SmsCommands" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Direction != nil { - data.Set("Direction", *params.Direction) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSmsCommandResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/SmsCommands" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Direction != nil { + data.Set("Direction", *params.Direction) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSmsCommandResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists SmsCommand records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -225,6 +229,7 @@ func (c *ApiService) StreamSmsCommand(params *ListSmsCommandParams) (chan Supers return recordChannel, errorChannel } + func (c *ApiService) streamSmsCommand(response *ListSmsCommandResponse, params *ListSmsCommandParams, recordChannel chan SupersimV1SmsCommand, errorChannel chan error) { curRecord := 1 @@ -256,19 +261,20 @@ func (c *ApiService) streamSmsCommand(response *ListSmsCommandResponse, params * } func (c *ApiService) getNextListSmsCommandResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSmsCommandResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSmsCommandResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/supersim/v1/usage_records.go b/rest/supersim/v1/usage_records.go index 1b31e5bae..b14a531b2 100644 --- a/rest/supersim/v1/usage_records.go +++ b/rest/supersim/v1/usage_records.go @@ -18,131 +18,132 @@ import ( "encoding/json" "fmt" "net/url" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecord' type ListUsageRecordParams struct { - // SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. - Sim *string `json:"Sim,omitempty"` - // SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. - Fleet *string `json:"Fleet,omitempty"` - // SID of a Network resource. Only show UsageRecords representing usage on this network. - Network *string `json:"Network,omitempty"` - // Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. - IsoCountry *string `json:"IsoCountry,omitempty"` - // Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. - Group *string `json:"Group,omitempty"` - // Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. - Granularity *string `json:"Granularity,omitempty"` - // Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. - StartTime *time.Time `json:"StartTime,omitempty"` - // Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. - EndTime *time.Time `json:"EndTime,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListUsageRecordParams) SetSim(Sim string) *ListUsageRecordParams { - params.Sim = &Sim - return params -} -func (params *ListUsageRecordParams) SetFleet(Fleet string) *ListUsageRecordParams { - params.Fleet = &Fleet - return params -} -func (params *ListUsageRecordParams) SetNetwork(Network string) *ListUsageRecordParams { - params.Network = &Network - return params -} -func (params *ListUsageRecordParams) SetIsoCountry(IsoCountry string) *ListUsageRecordParams { - params.IsoCountry = &IsoCountry - return params -} -func (params *ListUsageRecordParams) SetGroup(Group string) *ListUsageRecordParams { - params.Group = &Group - return params -} -func (params *ListUsageRecordParams) SetGranularity(Granularity string) *ListUsageRecordParams { - params.Granularity = &Granularity - return params -} -func (params *ListUsageRecordParams) SetStartTime(StartTime time.Time) *ListUsageRecordParams { - params.StartTime = &StartTime - return params -} -func (params *ListUsageRecordParams) SetEndTime(EndTime time.Time) *ListUsageRecordParams { - params.EndTime = &EndTime - return params -} -func (params *ListUsageRecordParams) SetPageSize(PageSize int) *ListUsageRecordParams { - params.PageSize = &PageSize - return params -} -func (params *ListUsageRecordParams) SetLimit(Limit int) *ListUsageRecordParams { - params.Limit = &Limit - return params + // SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. + Sim *string `json:"Sim,omitempty"` + // SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. + Fleet *string `json:"Fleet,omitempty"` + // SID of a Network resource. Only show UsageRecords representing usage on this network. + Network *string `json:"Network,omitempty"` + // Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. + IsoCountry *string `json:"IsoCountry,omitempty"` + // Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. + Group *string `json:"Group,omitempty"` + // Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. + Granularity *string `json:"Granularity,omitempty"` + // Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. + StartTime *time.Time `json:"StartTime,omitempty"` + // Only include usage that occurred before this time (exclusive), specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. + EndTime *time.Time `json:"EndTime,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListUsageRecordParams) SetSim(Sim string) (*ListUsageRecordParams){ + params.Sim = &Sim + return params +} +func (params *ListUsageRecordParams) SetFleet(Fleet string) (*ListUsageRecordParams){ + params.Fleet = &Fleet + return params +} +func (params *ListUsageRecordParams) SetNetwork(Network string) (*ListUsageRecordParams){ + params.Network = &Network + return params +} +func (params *ListUsageRecordParams) SetIsoCountry(IsoCountry string) (*ListUsageRecordParams){ + params.IsoCountry = &IsoCountry + return params +} +func (params *ListUsageRecordParams) SetGroup(Group string) (*ListUsageRecordParams){ + params.Group = &Group + return params +} +func (params *ListUsageRecordParams) SetGranularity(Granularity string) (*ListUsageRecordParams){ + params.Granularity = &Granularity + return params +} +func (params *ListUsageRecordParams) SetStartTime(StartTime time.Time) (*ListUsageRecordParams){ + params.StartTime = &StartTime + return params +} +func (params *ListUsageRecordParams) SetEndTime(EndTime time.Time) (*ListUsageRecordParams){ + params.EndTime = &EndTime + return params +} +func (params *ListUsageRecordParams) SetPageSize(PageSize int) (*ListUsageRecordParams){ + params.PageSize = &PageSize + return params +} +func (params *ListUsageRecordParams) SetLimit(Limit int) (*ListUsageRecordParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecord records from the API. Request is executed immediately. func (c *ApiService) PageUsageRecord(params *ListUsageRecordParams, pageToken, pageNumber string) (*ListUsageRecordResponse, error) { - path := "/v1/UsageRecords" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.Fleet != nil { - data.Set("Fleet", *params.Fleet) - } - if params != nil && params.Network != nil { - data.Set("Network", *params.Network) - } - if params != nil && params.IsoCountry != nil { - data.Set("IsoCountry", *params.IsoCountry) - } - if params != nil && params.Group != nil { - data.Set("Group", *params.Group) - } - if params != nil && params.Granularity != nil { - data.Set("Granularity", *params.Granularity) - } - if params != nil && params.StartTime != nil { - data.Set("StartTime", fmt.Sprint((*params.StartTime).Format(time.RFC3339))) - } - if params != nil && params.EndTime != nil { - data.Set("EndTime", fmt.Sprint((*params.EndTime).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/UsageRecords" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.Fleet != nil { + data.Set("Fleet", *params.Fleet) + } + if params != nil && params.Network != nil { + data.Set("Network", *params.Network) + } + if params != nil && params.IsoCountry != nil { + data.Set("IsoCountry", *params.IsoCountry) + } + if params != nil && params.Group != nil { + data.Set("Group", *params.Group) + } + if params != nil && params.Granularity != nil { + data.Set("Granularity", *params.Granularity) + } + if params != nil && params.StartTime != nil { + data.Set("StartTime", fmt.Sprint((*params.StartTime).Format(time.RFC3339))) + } + if params != nil && params.EndTime != nil { + data.Set("EndTime", fmt.Sprint((*params.EndTime).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUsageRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecord records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -183,6 +184,7 @@ func (c *ApiService) StreamUsageRecord(params *ListUsageRecordParams) (chan Supe return recordChannel, errorChannel } + func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params *ListUsageRecordParams, recordChannel chan SupersimV1UsageRecord, errorChannel chan error) { curRecord := 1 @@ -214,19 +216,20 @@ func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params } func (c *ApiService) getNextListUsageRecordResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListUsageRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/sync/v1/README.md b/rest/sync/v1/README.md index d96f160df..662595f2a 100644 --- a/rest/sync/v1/README.md +++ b/rest/sync/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/sync/v1/api_service.go b/rest/sync/v1/api_service.go index 44fb59f7a..ab77d2ce8 100644 --- a/rest/sync/v1/api_service.go +++ b/rest/sync/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://sync.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/sync/v1/docs/ListDocumentResponseMeta.md b/rest/sync/v1/docs/ListDocumentResponseMeta.md index 721c3be61..bf061ca09 100644 --- a/rest/sync/v1/docs/ListDocumentResponseMeta.md +++ b/rest/sync/v1/docs/ListDocumentResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/sync/v1/model_list_document_permission_response.go b/rest/sync/v1/model_list_document_permission_response.go index 968643579..ac550474e 100644 --- a/rest/sync/v1/model_list_document_permission_response.go +++ b/rest/sync/v1/model_list_document_permission_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDocumentPermissionResponse struct for ListDocumentPermissionResponse type ListDocumentPermissionResponse struct { Permissions []SyncV1DocumentPermission `json:"permissions,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_document_response.go b/rest/sync/v1/model_list_document_response.go index 122596a7e..9ad3ead44 100644 --- a/rest/sync/v1/model_list_document_response.go +++ b/rest/sync/v1/model_list_document_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDocumentResponse struct for ListDocumentResponse type ListDocumentResponse struct { - Documents []SyncV1Document `json:"documents,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Documents []SyncV1Document `json:"documents,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_document_response_meta.go b/rest/sync/v1/model_list_document_response_meta.go index 03cd5f437..812c76518 100644 --- a/rest/sync/v1/model_list_document_response_meta.go +++ b/rest/sync/v1/model_list_document_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDocumentResponseMeta struct for ListDocumentResponseMeta type ListDocumentResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/sync/v1/model_list_service_response.go b/rest/sync/v1/model_list_service_response.go index 822c00b42..8cf084487 100644 --- a/rest/sync/v1/model_list_service_response.go +++ b/rest/sync/v1/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []SyncV1Service `json:"services,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Services []SyncV1Service `json:"services,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_list_item_response.go b/rest/sync/v1/model_list_sync_list_item_response.go index 966cbe6e2..02fd9d602 100644 --- a/rest/sync/v1/model_list_sync_list_item_response.go +++ b/rest/sync/v1/model_list_sync_list_item_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncListItemResponse struct for ListSyncListItemResponse type ListSyncListItemResponse struct { - Items []SyncV1SyncListItem `json:"items,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Items []SyncV1SyncListItem `json:"items,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_list_permission_response.go b/rest/sync/v1/model_list_sync_list_permission_response.go index 60b9df34d..8739addfa 100644 --- a/rest/sync/v1/model_list_sync_list_permission_response.go +++ b/rest/sync/v1/model_list_sync_list_permission_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncListPermissionResponse struct for ListSyncListPermissionResponse type ListSyncListPermissionResponse struct { Permissions []SyncV1SyncListPermission `json:"permissions,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_list_response.go b/rest/sync/v1/model_list_sync_list_response.go index 9b1c7a214..61315b107 100644 --- a/rest/sync/v1/model_list_sync_list_response.go +++ b/rest/sync/v1/model_list_sync_list_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncListResponse struct for ListSyncListResponse type ListSyncListResponse struct { - Lists []SyncV1SyncList `json:"lists,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Lists []SyncV1SyncList `json:"lists,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_map_item_response.go b/rest/sync/v1/model_list_sync_map_item_response.go index 8949c5c4d..7926a4494 100644 --- a/rest/sync/v1/model_list_sync_map_item_response.go +++ b/rest/sync/v1/model_list_sync_map_item_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncMapItemResponse struct for ListSyncMapItemResponse type ListSyncMapItemResponse struct { - Items []SyncV1SyncMapItem `json:"items,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Items []SyncV1SyncMapItem `json:"items,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_map_permission_response.go b/rest/sync/v1/model_list_sync_map_permission_response.go index 3a0cdd6ff..db0fbe86f 100644 --- a/rest/sync/v1/model_list_sync_map_permission_response.go +++ b/rest/sync/v1/model_list_sync_map_permission_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncMapPermissionResponse struct for ListSyncMapPermissionResponse type ListSyncMapPermissionResponse struct { Permissions []SyncV1SyncMapPermission `json:"permissions,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_map_response.go b/rest/sync/v1/model_list_sync_map_response.go index dc5fcb403..95582ac7c 100644 --- a/rest/sync/v1/model_list_sync_map_response.go +++ b/rest/sync/v1/model_list_sync_map_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncMapResponse struct for ListSyncMapResponse type ListSyncMapResponse struct { - Maps []SyncV1SyncMap `json:"maps,omitempty"` + Maps []SyncV1SyncMap `json:"maps,omitempty"` Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_list_sync_stream_response.go b/rest/sync/v1/model_list_sync_stream_response.go index 6e281bcb3..b631dc450 100644 --- a/rest/sync/v1/model_list_sync_stream_response.go +++ b/rest/sync/v1/model_list_sync_stream_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSyncStreamResponse struct for ListSyncStreamResponse type ListSyncStreamResponse struct { - Streams []SyncV1SyncStream `json:"streams,omitempty"` - Meta ListDocumentResponseMeta `json:"meta,omitempty"` + Streams []SyncV1SyncStream `json:"streams,omitempty"` + Meta ListDocumentResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_document.go b/rest/sync/v1/model_sync_v1_document.go index 75d7389b9..e6caa9812 100644 --- a/rest/sync/v1/model_sync_v1_document.go +++ b/rest/sync/v1/model_sync_v1_document.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1Document struct for SyncV1Document type SyncV1Document struct { - // The unique string that we created to identify the Document resource. + // The unique string that we created to identify the Document resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource and can be up to 320 characters long. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource and can be up to 320 characters long. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The absolute URL of the Document resource. + // The absolute URL of the Document resource. Url *string `json:"url,omitempty"` - // The URLs of resources related to the Sync Document. + // The URLs of resources related to the Sync Document. Links *map[string]interface{} `json:"links,omitempty"` - // The current revision of the Sync Document, represented as a string. The `revision` property is used with conditional updates to ensure data consistency. + // The current revision of the Sync Document, represented as a string. The `revision` property is used with conditional updates to ensure data consistency. Revision *string `json:"revision,omitempty"` - // An arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. + // An arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. Data *interface{} `json:"data,omitempty"` - // The date and time in GMT when the Sync Document expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Document does not expire, this value is `null`. The Document resource might not be deleted immediately after it expires. + // The date and time in GMT when the Sync Document expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Document does not expire, this value is `null`. The Document resource might not be deleted immediately after it expires. DateExpires *time.Time `json:"date_expires,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The identity of the Sync Document's creator. If the Sync Document is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Document was created from the REST API, the value is `system`. + // The identity of the Sync Document's creator. If the Sync Document is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Document was created from the REST API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_document_permission.go b/rest/sync/v1/model_sync_v1_document_permission.go index 61c46f803..6dec1c957 100644 --- a/rest/sync/v1/model_sync_v1_document_permission.go +++ b/rest/sync/v1/model_sync_v1_document_permission.go @@ -13,23 +13,28 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SyncV1DocumentPermission struct for SyncV1DocumentPermission type SyncV1DocumentPermission struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document Permission resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document Permission resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Sync Document to which the Document Permission applies. + // The SID of the Sync Document to which the Document Permission applies. DocumentSid *string `json:"document_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. + // The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. Identity *string `json:"identity,omitempty"` - // Whether the identity can read the Sync Document. + // Whether the identity can read the Sync Document. Read *bool `json:"read,omitempty"` - // Whether the identity can update the Sync Document. + // Whether the identity can update the Sync Document. Write *bool `json:"write,omitempty"` - // Whether the identity can delete the Sync Document. + // Whether the identity can delete the Sync Document. Manage *bool `json:"manage,omitempty"` - // The absolute URL of the Sync Document Permission resource. + // The absolute URL of the Sync Document Permission resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_service.go b/rest/sync/v1/model_sync_v1_service.go index e81af7bd7..02fadd85e 100644 --- a/rest/sync/v1/model_sync_v1_service.go +++ b/rest/sync/v1/model_sync_v1_service.go @@ -13,39 +13,41 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1Service struct for SyncV1Service type SyncV1Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Service resource. + // The absolute URL of the Service resource. Url *string `json:"url,omitempty"` - // The URL we call when Sync objects are manipulated. + // The URL we call when Sync objects are manipulated. WebhookUrl *string `json:"webhook_url,omitempty"` - // Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. + // Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. WebhooksFromRestEnabled *bool `json:"webhooks_from_rest_enabled,omitempty"` - // Whether the service instance calls `webhook_url` when client endpoints connect to Sync. The default is `false`. + // Whether the service instance calls `webhook_url` when client endpoints connect to Sync. The default is `false`. ReachabilityWebhooksEnabled *bool `json:"reachability_webhooks_enabled,omitempty"` - // Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. It is disabled (false) by default. + // Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. It is disabled (false) by default. AclEnabled *bool `json:"acl_enabled,omitempty"` - // Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. + // Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. ReachabilityDebouncingEnabled *bool `json:"reachability_debouncing_enabled,omitempty"` - // The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring. + // The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring. ReachabilityDebouncingWindow *int `json:"reachability_debouncing_window,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_stream_message.go b/rest/sync/v1/model_sync_v1_stream_message.go index e38467083..78c3265da 100644 --- a/rest/sync/v1/model_sync_v1_stream_message.go +++ b/rest/sync/v1/model_sync_v1_stream_message.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SyncV1StreamMessage struct for SyncV1StreamMessage type SyncV1StreamMessage struct { - // The unique string that we created to identify the Stream Message resource. + // The unique string that we created to identify the Stream Message resource. Sid *string `json:"sid,omitempty"` - // An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length. + // An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length. Data *interface{} `json:"data,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_list.go b/rest/sync/v1/model_sync_v1_sync_list.go index 8245749a7..4103f34ae 100644 --- a/rest/sync/v1/model_sync_v1_sync_list.go +++ b/rest/sync/v1/model_sync_v1_sync_list.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1SyncList struct for SyncV1SyncList type SyncV1SyncList struct { - // The unique string that we created to identify the Sync List resource. + // The unique string that we created to identify the Sync List resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The absolute URL of the Sync List resource. + // The absolute URL of the Sync List resource. Url *string `json:"url,omitempty"` - // The URLs of the Sync List's nested resources. + // The URLs of the Sync List's nested resources. Links *map[string]interface{} `json:"links,omitempty"` - // The current revision of the Sync List, represented as a string. + // The current revision of the Sync List, represented as a string. Revision *string `json:"revision,omitempty"` - // The date and time in GMT when the Sync List expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync List does not expire, this value is `null`. The Sync List might not be deleted immediately after it expires. + // The date and time in GMT when the Sync List expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync List does not expire, this value is `null`. The Sync List might not be deleted immediately after it expires. DateExpires *time.Time `json:"date_expires,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The identity of the Sync List's creator. If the Sync List is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync List was created from the REST API, the value is `system`. + // The identity of the Sync List's creator. If the Sync List is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync List was created from the REST API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_list_item.go b/rest/sync/v1/model_sync_v1_sync_list_item.go index dda3dcb78..8617d830e 100644 --- a/rest/sync/v1/model_sync_v1_sync_list_item.go +++ b/rest/sync/v1/model_sync_v1_sync_list_item.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1SyncListItem struct for SyncV1SyncListItem type SyncV1SyncListItem struct { - // The automatically generated index of the List Item. The `index` values of the List Items in a Sync List can have gaps in their sequence. + // The automatically generated index of the List Item. The `index` values of the List Items in a Sync List can have gaps in their sequence. Index *int `json:"index,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the List Item resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the List Item resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Sync List that contains the List Item. + // The SID of the Sync List that contains the List Item. ListSid *string `json:"list_sid,omitempty"` - // The absolute URL of the List Item resource. + // The absolute URL of the List Item resource. Url *string `json:"url,omitempty"` - // The current revision of the item, represented as a string. + // The current revision of the item, represented as a string. Revision *string `json:"revision,omitempty"` - // An arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. + // An arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. Data *interface{} `json:"data,omitempty"` - // The date and time in GMT when the List Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the List Item does not expire, this value is `null`. The List Item resource might not be deleted immediately after it expires. + // The date and time in GMT when the List Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the List Item does not expire, this value is `null`. The List Item resource might not be deleted immediately after it expires. DateExpires *time.Time `json:"date_expires,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The identity of the List Item's creator. If the item is created from the client SDK, the value matches the Access Token's `identity` field. If the item was created from the REST API, the value is `system`. + // The identity of the List Item's creator. If the item is created from the client SDK, the value matches the Access Token's `identity` field. If the item was created from the REST API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_list_permission.go b/rest/sync/v1/model_sync_v1_sync_list_permission.go index 670102a6d..41461dbc8 100644 --- a/rest/sync/v1/model_sync_v1_sync_list_permission.go +++ b/rest/sync/v1/model_sync_v1_sync_list_permission.go @@ -13,23 +13,28 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SyncV1SyncListPermission struct for SyncV1SyncListPermission type SyncV1SyncListPermission struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List Permission resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List Permission resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Sync List to which the Permission applies. + // The SID of the Sync List to which the Permission applies. ListSid *string `json:"list_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. + // The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. Identity *string `json:"identity,omitempty"` - // Whether the identity can read the Sync List and its Items. + // Whether the identity can read the Sync List and its Items. Read *bool `json:"read,omitempty"` - // Whether the identity can create, update, and delete Items in the Sync List. + // Whether the identity can create, update, and delete Items in the Sync List. Write *bool `json:"write,omitempty"` - // Whether the identity can delete the Sync List. + // Whether the identity can delete the Sync List. Manage *bool `json:"manage,omitempty"` - // The absolute URL of the Sync List Permission resource. + // The absolute URL of the Sync List Permission resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_map.go b/rest/sync/v1/model_sync_v1_sync_map.go index fa596010d..01372512b 100644 --- a/rest/sync/v1/model_sync_v1_sync_map.go +++ b/rest/sync/v1/model_sync_v1_sync_map.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1SyncMap struct for SyncV1SyncMap type SyncV1SyncMap struct { - // The unique string that we created to identify the Sync Map resource. + // The unique string that we created to identify the Sync Map resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The absolute URL of the Sync Map resource. + // The absolute URL of the Sync Map resource. Url *string `json:"url,omitempty"` - // The URLs of the Sync Map's nested resources. + // The URLs of the Sync Map's nested resources. Links *map[string]interface{} `json:"links,omitempty"` - // The current revision of the Sync Map, represented as a string. + // The current revision of the Sync Map, represented as a string. Revision *string `json:"revision,omitempty"` - // The date and time in GMT when the Sync Map expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Map does not expire, this value is `null`. The Sync Map might not be deleted immediately after it expires. + // The date and time in GMT when the Sync Map expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Map does not expire, this value is `null`. The Sync Map might not be deleted immediately after it expires. DateExpires *time.Time `json:"date_expires,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The identity of the Sync Map's creator. If the Sync Map is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Map was created from the REST API, the value is `system`. + // The identity of the Sync Map's creator. If the Sync Map is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Map was created from the REST API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_map_item.go b/rest/sync/v1/model_sync_v1_sync_map_item.go index 4a30c31ce..512fcdadb 100644 --- a/rest/sync/v1/model_sync_v1_sync_map_item.go +++ b/rest/sync/v1/model_sync_v1_sync_map_item.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1SyncMapItem struct for SyncV1SyncMapItem type SyncV1SyncMapItem struct { - // The unique, user-defined key for the Map Item. + // The unique, user-defined key for the Map Item. Key *string `json:"key,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Map Item resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Map Item resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Sync Map that contains the Map Item. + // The SID of the Sync Map that contains the Map Item. MapSid *string `json:"map_sid,omitempty"` - // The absolute URL of the Map Item resource. + // The absolute URL of the Map Item resource. Url *string `json:"url,omitempty"` - // The current revision of the Map Item, represented as a string. + // The current revision of the Map Item, represented as a string. Revision *string `json:"revision,omitempty"` - // An arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. + // An arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. Data *interface{} `json:"data,omitempty"` - // The date and time in GMT when the Map Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Map Item does not expire, this value is `null`. The Map Item might not be deleted immediately after it expires. + // The date and time in GMT when the Map Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Map Item does not expire, this value is `null`. The Map Item might not be deleted immediately after it expires. DateExpires *time.Time `json:"date_expires,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The identity of the Map Item's creator. If the Map Item is created from the client SDK, the value matches the Access Token's `identity` field. If the Map Item was created from the REST API, the value is `system`. + // The identity of the Map Item's creator. If the Map Item is created from the client SDK, the value matches the Access Token's `identity` field. If the Map Item was created from the REST API, the value is `system`. CreatedBy *string `json:"created_by,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_map_permission.go b/rest/sync/v1/model_sync_v1_sync_map_permission.go index ca3dca32a..a2c10279c 100644 --- a/rest/sync/v1/model_sync_v1_sync_map_permission.go +++ b/rest/sync/v1/model_sync_v1_sync_map_permission.go @@ -13,23 +13,28 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // SyncV1SyncMapPermission struct for SyncV1SyncMapPermission type SyncV1SyncMapPermission struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the Sync Map to which the Permission applies. + // The SID of the Sync Map to which the Permission applies. MapSid *string `json:"map_sid,omitempty"` - // The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. + // The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. Identity *string `json:"identity,omitempty"` - // Whether the identity can read the Sync Map and its Items. + // Whether the identity can read the Sync Map and its Items. Read *bool `json:"read,omitempty"` - // Whether the identity can create, update, and delete Items in the Sync Map. + // Whether the identity can create, update, and delete Items in the Sync Map. Write *bool `json:"write,omitempty"` - // Whether the identity can delete the Sync Map. + // Whether the identity can delete the Sync Map. Manage *bool `json:"manage,omitempty"` - // The absolute URL of the Sync Map Permission resource. + // The absolute URL of the Sync Map Permission resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/sync/v1/model_sync_v1_sync_stream.go b/rest/sync/v1/model_sync_v1_sync_stream.go index 683e98033..8f1d17f5f 100644 --- a/rest/sync/v1/model_sync_v1_sync_stream.go +++ b/rest/sync/v1/model_sync_v1_sync_stream.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // SyncV1SyncStream struct for SyncV1SyncStream type SyncV1SyncStream struct { - // The unique string that we created to identify the Sync Stream resource. + // The unique string that we created to identify the Sync Stream resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Stream resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Stream resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + // The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The absolute URL of the Message Stream resource. + // The absolute URL of the Message Stream resource. Url *string `json:"url,omitempty"` - // The URLs of the Stream's nested resources. + // The URLs of the Stream's nested resources. Links *map[string]interface{} `json:"links,omitempty"` - // The date and time in GMT when the Message Stream expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Message Stream does not expire, this value is `null`. The Stream might not be deleted immediately after it expires. + // The date and time in GMT when the Message Stream expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Message Stream does not expire, this value is `null`. The Stream might not be deleted immediately after it expires. DateExpires *time.Time `json:"date_expires,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The identity of the Stream's creator. If the Stream is created from the client SDK, the value matches the Access Token's `identity` field. If the Stream was created from the REST API, the value is 'system'. + // The identity of the Stream's creator. If the Stream is created from the client SDK, the value matches the Access Token's `identity` field. If the Stream was created from the REST API, the value is 'system'. CreatedBy *string `json:"created_by,omitempty"` } + + diff --git a/rest/sync/v1/services.go b/rest/sync/v1/services.go index 848858339..3e4302fff 100644 --- a/rest/sync/v1/services.go +++ b/rest/sync/v1/services.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A string that you assign to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we should call when Sync objects are manipulated. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. - ReachabilityWebhooksEnabled *bool `json:"ReachabilityWebhooksEnabled,omitempty"` - // Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. - AclEnabled *bool `json:"AclEnabled,omitempty"` - // Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. - ReachabilityDebouncingEnabled *bool `json:"ReachabilityDebouncingEnabled,omitempty"` - // The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the `webhook_url` is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the call to `webhook_url`. - ReachabilityDebouncingWindow *int `json:"ReachabilityDebouncingWindow,omitempty"` - // Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. - WebhooksFromRestEnabled *bool `json:"WebhooksFromRestEnabled,omitempty"` + // A string that you assign to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we should call when Sync objects are manipulated. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. + ReachabilityWebhooksEnabled *bool `json:"ReachabilityWebhooksEnabled,omitempty"` + // Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. + AclEnabled *bool `json:"AclEnabled,omitempty"` + // Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. + ReachabilityDebouncingEnabled *bool `json:"ReachabilityDebouncingEnabled,omitempty"` + // The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the `webhook_url` is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the call to `webhook_url`. + ReachabilityDebouncingWindow *int `json:"ReachabilityDebouncingWindow,omitempty"` + // Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. + WebhooksFromRestEnabled *bool `json:"WebhooksFromRestEnabled,omitempty"` } -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateServiceParams) SetWebhookUrl(WebhookUrl string) *CreateServiceParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *CreateServiceParams) SetWebhookUrl(WebhookUrl string) (*CreateServiceParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *CreateServiceParams) SetReachabilityWebhooksEnabled(ReachabilityWebhooksEnabled bool) *CreateServiceParams { - params.ReachabilityWebhooksEnabled = &ReachabilityWebhooksEnabled - return params +func (params *CreateServiceParams) SetReachabilityWebhooksEnabled(ReachabilityWebhooksEnabled bool) (*CreateServiceParams){ + params.ReachabilityWebhooksEnabled = &ReachabilityWebhooksEnabled + return params } -func (params *CreateServiceParams) SetAclEnabled(AclEnabled bool) *CreateServiceParams { - params.AclEnabled = &AclEnabled - return params +func (params *CreateServiceParams) SetAclEnabled(AclEnabled bool) (*CreateServiceParams){ + params.AclEnabled = &AclEnabled + return params } -func (params *CreateServiceParams) SetReachabilityDebouncingEnabled(ReachabilityDebouncingEnabled bool) *CreateServiceParams { - params.ReachabilityDebouncingEnabled = &ReachabilityDebouncingEnabled - return params +func (params *CreateServiceParams) SetReachabilityDebouncingEnabled(ReachabilityDebouncingEnabled bool) (*CreateServiceParams){ + params.ReachabilityDebouncingEnabled = &ReachabilityDebouncingEnabled + return params } -func (params *CreateServiceParams) SetReachabilityDebouncingWindow(ReachabilityDebouncingWindow int) *CreateServiceParams { - params.ReachabilityDebouncingWindow = &ReachabilityDebouncingWindow - return params +func (params *CreateServiceParams) SetReachabilityDebouncingWindow(ReachabilityDebouncingWindow int) (*CreateServiceParams){ + params.ReachabilityDebouncingWindow = &ReachabilityDebouncingWindow + return params } -func (params *CreateServiceParams) SetWebhooksFromRestEnabled(WebhooksFromRestEnabled bool) *CreateServiceParams { - params.WebhooksFromRestEnabled = &WebhooksFromRestEnabled - return params +func (params *CreateServiceParams) SetWebhooksFromRestEnabled(WebhooksFromRestEnabled bool) (*CreateServiceParams){ + params.WebhooksFromRestEnabled = &WebhooksFromRestEnabled + return params } -// +// func (c *ApiService) CreateService(params *CreateServiceParams) (*SyncV1Service, error) { - path := "/v1/Services" - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.ReachabilityWebhooksEnabled != nil { + data.Set("ReachabilityWebhooksEnabled", fmt.Sprint(*params.ReachabilityWebhooksEnabled)) + } + if params != nil && params.AclEnabled != nil { + data.Set("AclEnabled", fmt.Sprint(*params.AclEnabled)) + } + if params != nil && params.ReachabilityDebouncingEnabled != nil { + data.Set("ReachabilityDebouncingEnabled", fmt.Sprint(*params.ReachabilityDebouncingEnabled)) + } + if params != nil && params.ReachabilityDebouncingWindow != nil { + data.Set("ReachabilityDebouncingWindow", fmt.Sprint(*params.ReachabilityDebouncingWindow)) + } + if params != nil && params.WebhooksFromRestEnabled != nil { + data.Set("WebhooksFromRestEnabled", fmt.Sprint(*params.WebhooksFromRestEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.ReachabilityWebhooksEnabled != nil { - data.Set("ReachabilityWebhooksEnabled", fmt.Sprint(*params.ReachabilityWebhooksEnabled)) - } - if params != nil && params.AclEnabled != nil { - data.Set("AclEnabled", fmt.Sprint(*params.AclEnabled)) - } - if params != nil && params.ReachabilityDebouncingEnabled != nil { - data.Set("ReachabilityDebouncingEnabled", fmt.Sprint(*params.ReachabilityDebouncingEnabled)) - } - if params != nil && params.ReachabilityDebouncingWindow != nil { - data.Set("ReachabilityDebouncingWindow", fmt.Sprint(*params.ReachabilityDebouncingWindow)) - } - if params != nil && params.WebhooksFromRestEnabled != nil { - data.Set("WebhooksFromRestEnabled", fmt.Sprint(*params.WebhooksFromRestEnabled)) - } +// +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &SyncV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } -// -func (c *ApiService) DeleteService(Sid string) error { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchService(Sid string, ) (*SyncV1Service, error) { + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchService(Sid string) (*SyncV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &SyncV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &SyncV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v1/Services" + path := "/v1/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan SyncV1Servic return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan SyncV1Service, errorChannel chan error) { curRecord := 1 @@ -274,111 +281,113 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // The URL we should call when Sync objects are manipulated. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // A string that you assign to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. - ReachabilityWebhooksEnabled *bool `json:"ReachabilityWebhooksEnabled,omitempty"` - // Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. - AclEnabled *bool `json:"AclEnabled,omitempty"` - // Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. - ReachabilityDebouncingEnabled *bool `json:"ReachabilityDebouncingEnabled,omitempty"` - // The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the webhook from being called. - ReachabilityDebouncingWindow *int `json:"ReachabilityDebouncingWindow,omitempty"` - // Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. - WebhooksFromRestEnabled *bool `json:"WebhooksFromRestEnabled,omitempty"` + // The URL we should call when Sync objects are manipulated. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // A string that you assign to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. + ReachabilityWebhooksEnabled *bool `json:"ReachabilityWebhooksEnabled,omitempty"` + // Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. + AclEnabled *bool `json:"AclEnabled,omitempty"` + // Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. + ReachabilityDebouncingEnabled *bool `json:"ReachabilityDebouncingEnabled,omitempty"` + // The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the webhook from being called. + ReachabilityDebouncingWindow *int `json:"ReachabilityDebouncingWindow,omitempty"` + // Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. + WebhooksFromRestEnabled *bool `json:"WebhooksFromRestEnabled,omitempty"` } -func (params *UpdateServiceParams) SetWebhookUrl(WebhookUrl string) *UpdateServiceParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *UpdateServiceParams) SetWebhookUrl(WebhookUrl string) (*UpdateServiceParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateServiceParams) SetReachabilityWebhooksEnabled(ReachabilityWebhooksEnabled bool) *UpdateServiceParams { - params.ReachabilityWebhooksEnabled = &ReachabilityWebhooksEnabled - return params +func (params *UpdateServiceParams) SetReachabilityWebhooksEnabled(ReachabilityWebhooksEnabled bool) (*UpdateServiceParams){ + params.ReachabilityWebhooksEnabled = &ReachabilityWebhooksEnabled + return params } -func (params *UpdateServiceParams) SetAclEnabled(AclEnabled bool) *UpdateServiceParams { - params.AclEnabled = &AclEnabled - return params +func (params *UpdateServiceParams) SetAclEnabled(AclEnabled bool) (*UpdateServiceParams){ + params.AclEnabled = &AclEnabled + return params } -func (params *UpdateServiceParams) SetReachabilityDebouncingEnabled(ReachabilityDebouncingEnabled bool) *UpdateServiceParams { - params.ReachabilityDebouncingEnabled = &ReachabilityDebouncingEnabled - return params +func (params *UpdateServiceParams) SetReachabilityDebouncingEnabled(ReachabilityDebouncingEnabled bool) (*UpdateServiceParams){ + params.ReachabilityDebouncingEnabled = &ReachabilityDebouncingEnabled + return params } -func (params *UpdateServiceParams) SetReachabilityDebouncingWindow(ReachabilityDebouncingWindow int) *UpdateServiceParams { - params.ReachabilityDebouncingWindow = &ReachabilityDebouncingWindow - return params +func (params *UpdateServiceParams) SetReachabilityDebouncingWindow(ReachabilityDebouncingWindow int) (*UpdateServiceParams){ + params.ReachabilityDebouncingWindow = &ReachabilityDebouncingWindow + return params } -func (params *UpdateServiceParams) SetWebhooksFromRestEnabled(WebhooksFromRestEnabled bool) *UpdateServiceParams { - params.WebhooksFromRestEnabled = &WebhooksFromRestEnabled - return params +func (params *UpdateServiceParams) SetWebhooksFromRestEnabled(WebhooksFromRestEnabled bool) (*UpdateServiceParams){ + params.WebhooksFromRestEnabled = &WebhooksFromRestEnabled + return params } -// +// func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*SyncV1Service, error) { - path := "/v1/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ReachabilityWebhooksEnabled != nil { - data.Set("ReachabilityWebhooksEnabled", fmt.Sprint(*params.ReachabilityWebhooksEnabled)) - } - if params != nil && params.AclEnabled != nil { - data.Set("AclEnabled", fmt.Sprint(*params.AclEnabled)) - } - if params != nil && params.ReachabilityDebouncingEnabled != nil { - data.Set("ReachabilityDebouncingEnabled", fmt.Sprint(*params.ReachabilityDebouncingEnabled)) - } - if params != nil && params.ReachabilityDebouncingWindow != nil { - data.Set("ReachabilityDebouncingWindow", fmt.Sprint(*params.ReachabilityDebouncingWindow)) - } - if params != nil && params.WebhooksFromRestEnabled != nil { - data.Set("WebhooksFromRestEnabled", fmt.Sprint(*params.WebhooksFromRestEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SyncV1Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ReachabilityWebhooksEnabled != nil { + data.Set("ReachabilityWebhooksEnabled", fmt.Sprint(*params.ReachabilityWebhooksEnabled)) + } + if params != nil && params.AclEnabled != nil { + data.Set("AclEnabled", fmt.Sprint(*params.AclEnabled)) + } + if params != nil && params.ReachabilityDebouncingEnabled != nil { + data.Set("ReachabilityDebouncingEnabled", fmt.Sprint(*params.ReachabilityDebouncingEnabled)) + } + if params != nil && params.ReachabilityDebouncingWindow != nil { + data.Set("ReachabilityDebouncingWindow", fmt.Sprint(*params.ReachabilityDebouncingWindow)) + } + if params != nil && params.WebhooksFromRestEnabled != nil { + data.Set("WebhooksFromRestEnabled", fmt.Sprint(*params.WebhooksFromRestEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/sync/v1/services_documents.go b/rest/sync/v1/services_documents.go index 53d2a1f40..98a38cbd4 100644 --- a/rest/sync/v1/services_documents.go +++ b/rest/sync/v1/services_documents.go @@ -18,166 +18,171 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateDocument' type CreateDocumentParams struct { - // An application-defined string that uniquely identifies the Sync Document - UniqueName *string `json:"UniqueName,omitempty"` - // A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. - Data *interface{} `json:"Data,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (the Sync Document's time-to-live). - Ttl *int `json:"Ttl,omitempty"` + // An application-defined string that uniquely identifies the Sync Document + UniqueName *string `json:"UniqueName,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. + Data *interface{} `json:"Data,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (the Sync Document's time-to-live). + Ttl *int `json:"Ttl,omitempty"` } -func (params *CreateDocumentParams) SetUniqueName(UniqueName string) *CreateDocumentParams { - params.UniqueName = &UniqueName - return params +func (params *CreateDocumentParams) SetUniqueName(UniqueName string) (*CreateDocumentParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateDocumentParams) SetData(Data interface{}) *CreateDocumentParams { - params.Data = &Data - return params +func (params *CreateDocumentParams) SetData(Data interface{}) (*CreateDocumentParams){ + params.Data = &Data + return params } -func (params *CreateDocumentParams) SetTtl(Ttl int) *CreateDocumentParams { - params.Ttl = &Ttl - return params +func (params *CreateDocumentParams) SetTtl(Ttl int) (*CreateDocumentParams){ + params.Ttl = &Ttl + return params } -// +// func (c *ApiService) CreateDocument(ServiceSid string, params *CreateDocumentParams) (*SyncV1Document, error) { - path := "/v1/Services/{ServiceSid}/Documents" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Documents" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Data", string(v)) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } + data.Set("Data", string(v)) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1Document{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SyncV1Document{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteDocument(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Documents/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteDocument(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Documents/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchDocument(ServiceSid string, Sid string) (*SyncV1Document, error) { - path := "/v1/Services/{ServiceSid}/Documents/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchDocument(ServiceSid string, Sid string, ) (*SyncV1Document, error) { + path := "/v1/Services/{ServiceSid}/Documents/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1Document{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1Document{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListDocument' type ListDocumentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDocumentParams) SetPageSize(PageSize int) *ListDocumentParams { - params.PageSize = &PageSize - return params +func (params *ListDocumentParams) SetPageSize(PageSize int) (*ListDocumentParams){ + params.PageSize = &PageSize + return params } -func (params *ListDocumentParams) SetLimit(Limit int) *ListDocumentParams { - params.Limit = &Limit - return params +func (params *ListDocumentParams) SetLimit(Limit int) (*ListDocumentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Document records from the API. Request is executed immediately. func (c *ApiService) PageDocument(ServiceSid string, params *ListDocumentParams, pageToken, pageNumber string) (*ListDocumentResponse, error) { - path := "/v1/Services/{ServiceSid}/Documents" + path := "/v1/Services/{ServiceSid}/Documents" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Document records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -218,6 +223,7 @@ func (c *ApiService) StreamDocument(ServiceSid string, params *ListDocumentParam return recordChannel, errorChannel } + func (c *ApiService) streamDocument(response *ListDocumentResponse, params *ListDocumentParams, recordChannel chan SyncV1Document, errorChannel chan error) { curRecord := 1 @@ -249,83 +255,84 @@ func (c *ApiService) streamDocument(response *ListDocumentResponse, params *List } func (c *ApiService) getNextListDocumentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateDocument' type UpdateDocumentParams struct { - // The If-Match HTTP request header - IfMatch *string `json:"If-Match,omitempty"` - // A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. - Data *interface{} `json:"Data,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (time-to-live). - Ttl *int `json:"Ttl,omitempty"` + // The If-Match HTTP request header + IfMatch *string `json:"If-Match,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. + Data *interface{} `json:"Data,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (time-to-live). + Ttl *int `json:"Ttl,omitempty"` } -func (params *UpdateDocumentParams) SetIfMatch(IfMatch string) *UpdateDocumentParams { - params.IfMatch = &IfMatch - return params +func (params *UpdateDocumentParams) SetIfMatch(IfMatch string) (*UpdateDocumentParams){ + params.IfMatch = &IfMatch + return params } -func (params *UpdateDocumentParams) SetData(Data interface{}) *UpdateDocumentParams { - params.Data = &Data - return params +func (params *UpdateDocumentParams) SetData(Data interface{}) (*UpdateDocumentParams){ + params.Data = &Data + return params } -func (params *UpdateDocumentParams) SetTtl(Ttl int) *UpdateDocumentParams { - params.Ttl = &Ttl - return params +func (params *UpdateDocumentParams) SetTtl(Ttl int) (*UpdateDocumentParams){ + params.Ttl = &Ttl + return params } -// +// func (c *ApiService) UpdateDocument(ServiceSid string, Sid string, params *UpdateDocumentParams) (*SyncV1Document, error) { - path := "/v1/Services/{ServiceSid}/Documents/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Documents/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } + + data.Set("Data", string(v)) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } - data.Set("Data", string(v)) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() - - ps := &SyncV1Document{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &SyncV1Document{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/sync/v1/services_documents_permissions.go b/rest/sync/v1/services_documents_permissions.go index d4517d884..a4ab15f90 100644 --- a/rest/sync/v1/services_documents_permissions.go +++ b/rest/sync/v1/services_documents_permissions.go @@ -18,107 +18,111 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific Sync Document Permission. -func (c *ApiService) DeleteDocumentPermission(ServiceSid string, DocumentSid string, Identity string) error { - path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) DeleteDocumentPermission(ServiceSid string, DocumentSid string, Identity string, ) (error) { + path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Sync Document Permission. -func (c *ApiService) FetchDocumentPermission(ServiceSid string, DocumentSid string, Identity string) (*SyncV1DocumentPermission, error) { - path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) FetchDocumentPermission(ServiceSid string, DocumentSid string, Identity string, ) (*SyncV1DocumentPermission, error) { + path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1DocumentPermission{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SyncV1DocumentPermission{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListDocumentPermission' type ListDocumentPermissionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDocumentPermissionParams) SetPageSize(PageSize int) *ListDocumentPermissionParams { - params.PageSize = &PageSize - return params +func (params *ListDocumentPermissionParams) SetPageSize(PageSize int) (*ListDocumentPermissionParams){ + params.PageSize = &PageSize + return params } -func (params *ListDocumentPermissionParams) SetLimit(Limit int) *ListDocumentPermissionParams { - params.Limit = &Limit - return params +func (params *ListDocumentPermissionParams) SetLimit(Limit int) (*ListDocumentPermissionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DocumentPermission records from the API. Request is executed immediately. func (c *ApiService) PageDocumentPermission(ServiceSid string, DocumentSid string, params *ListDocumentPermissionParams, pageToken, pageNumber string) (*ListDocumentPermissionResponse, error) { - path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions" + path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDocumentPermissionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDocumentPermissionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists DocumentPermission records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -159,6 +163,7 @@ func (c *ApiService) StreamDocumentPermission(ServiceSid string, DocumentSid str return recordChannel, errorChannel } + func (c *ApiService) streamDocumentPermission(response *ListDocumentPermissionResponse, params *ListDocumentPermissionParams, recordChannel chan SyncV1DocumentPermission, errorChannel chan error) { curRecord := 1 @@ -190,77 +195,79 @@ func (c *ApiService) streamDocumentPermission(response *ListDocumentPermissionRe } func (c *ApiService) getNextListDocumentPermissionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDocumentPermissionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDocumentPermissionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateDocumentPermission' type UpdateDocumentPermissionParams struct { - // Whether the identity can read the Sync Document. Default value is `false`. - Read *bool `json:"Read,omitempty"` - // Whether the identity can update the Sync Document. Default value is `false`. - Write *bool `json:"Write,omitempty"` - // Whether the identity can delete the Sync Document. Default value is `false`. - Manage *bool `json:"Manage,omitempty"` + // Whether the identity can read the Sync Document. Default value is `false`. + Read *bool `json:"Read,omitempty"` + // Whether the identity can update the Sync Document. Default value is `false`. + Write *bool `json:"Write,omitempty"` + // Whether the identity can delete the Sync Document. Default value is `false`. + Manage *bool `json:"Manage,omitempty"` } -func (params *UpdateDocumentPermissionParams) SetRead(Read bool) *UpdateDocumentPermissionParams { - params.Read = &Read - return params +func (params *UpdateDocumentPermissionParams) SetRead(Read bool) (*UpdateDocumentPermissionParams){ + params.Read = &Read + return params } -func (params *UpdateDocumentPermissionParams) SetWrite(Write bool) *UpdateDocumentPermissionParams { - params.Write = &Write - return params +func (params *UpdateDocumentPermissionParams) SetWrite(Write bool) (*UpdateDocumentPermissionParams){ + params.Write = &Write + return params } -func (params *UpdateDocumentPermissionParams) SetManage(Manage bool) *UpdateDocumentPermissionParams { - params.Manage = &Manage - return params +func (params *UpdateDocumentPermissionParams) SetManage(Manage bool) (*UpdateDocumentPermissionParams){ + params.Manage = &Manage + return params } // Update an identity's access to a specific Sync Document. func (c *ApiService) UpdateDocumentPermission(ServiceSid string, DocumentSid string, Identity string, params *UpdateDocumentPermissionParams) (*SyncV1DocumentPermission, error) { - path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Read != nil { - data.Set("Read", fmt.Sprint(*params.Read)) - } - if params != nil && params.Write != nil { - data.Set("Write", fmt.Sprint(*params.Write)) - } - if params != nil && params.Manage != nil { - data.Set("Manage", fmt.Sprint(*params.Manage)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SyncV1DocumentPermission{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Documents/{DocumentSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"DocumentSid"+"}", DocumentSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Read != nil { + data.Set("Read", fmt.Sprint(*params.Read)) + } + if params != nil && params.Write != nil { + data.Set("Write", fmt.Sprint(*params.Write)) + } + if params != nil && params.Manage != nil { + data.Set("Manage", fmt.Sprint(*params.Manage)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1DocumentPermission{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/sync/v1/services_lists.go b/rest/sync/v1/services_lists.go index 358ea56bf..116dfbd2c 100644 --- a/rest/sync/v1/services_lists.go +++ b/rest/sync/v1/services_lists.go @@ -18,160 +18,165 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSyncList' type CreateSyncListParams struct { - // An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // Alias for collection_ttl. If both are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // Alias for collection_ttl. If both are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *CreateSyncListParams) SetUniqueName(UniqueName string) *CreateSyncListParams { - params.UniqueName = &UniqueName - return params +func (params *CreateSyncListParams) SetUniqueName(UniqueName string) (*CreateSyncListParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateSyncListParams) SetTtl(Ttl int) *CreateSyncListParams { - params.Ttl = &Ttl - return params +func (params *CreateSyncListParams) SetTtl(Ttl int) (*CreateSyncListParams){ + params.Ttl = &Ttl + return params } -func (params *CreateSyncListParams) SetCollectionTtl(CollectionTtl int) *CreateSyncListParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *CreateSyncListParams) SetCollectionTtl(CollectionTtl int) (*CreateSyncListParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) CreateSyncList(ServiceSid string, params *CreateSyncListParams) (*SyncV1SyncList, error) { - path := "/v1/Services/{ServiceSid}/Lists" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Lists" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1SyncList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &SyncV1SyncList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteSyncList(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Lists/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteSyncList(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Lists/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchSyncList(ServiceSid string, Sid string) (*SyncV1SyncList, error) { - path := "/v1/Services/{ServiceSid}/Lists/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchSyncList(ServiceSid string, Sid string, ) (*SyncV1SyncList, error) { + path := "/v1/Services/{ServiceSid}/Lists/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSyncList' type ListSyncListParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncListParams) SetPageSize(PageSize int) *ListSyncListParams { - params.PageSize = &PageSize - return params +func (params *ListSyncListParams) SetPageSize(PageSize int) (*ListSyncListParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncListParams) SetLimit(Limit int) *ListSyncListParams { - params.Limit = &Limit - return params +func (params *ListSyncListParams) SetLimit(Limit int) (*ListSyncListParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncList records from the API. Request is executed immediately. func (c *ApiService) PageSyncList(ServiceSid string, params *ListSyncListParams, pageToken, pageNumber string) (*ListSyncListResponse, error) { - path := "/v1/Services/{ServiceSid}/Lists" + path := "/v1/Services/{ServiceSid}/Lists" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSyncListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSyncListResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SyncList records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -212,6 +217,7 @@ func (c *ApiService) StreamSyncList(ServiceSid string, params *ListSyncListParam return recordChannel, errorChannel } + func (c *ApiService) streamSyncList(response *ListSyncListResponse, params *ListSyncListParams, recordChannel chan SyncV1SyncList, errorChannel chan error) { curRecord := 1 @@ -243,67 +249,69 @@ func (c *ApiService) streamSyncList(response *ListSyncListResponse, params *List } func (c *ApiService) getNextListSyncListResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncListResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncList' type UpdateSyncListParams struct { - // An alias for `collection_ttl`. If both are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // An alias for `collection_ttl`. If both are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *UpdateSyncListParams) SetTtl(Ttl int) *UpdateSyncListParams { - params.Ttl = &Ttl - return params +func (params *UpdateSyncListParams) SetTtl(Ttl int) (*UpdateSyncListParams){ + params.Ttl = &Ttl + return params } -func (params *UpdateSyncListParams) SetCollectionTtl(CollectionTtl int) *UpdateSyncListParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *UpdateSyncListParams) SetCollectionTtl(CollectionTtl int) (*UpdateSyncListParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) UpdateSyncList(ServiceSid string, Sid string, params *UpdateSyncListParams) (*SyncV1SyncList, error) { - path := "/v1/Services/{ServiceSid}/Lists/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Lists/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1SyncList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SyncV1SyncList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/sync/v1/services_lists_items.go b/rest/sync/v1/services_lists_items.go index 3e0bec370..d1c9cb7e7 100644 --- a/rest/sync/v1/services_lists_items.go +++ b/rest/sync/v1/services_lists_items.go @@ -18,221 +18,225 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSyncListItem' type CreateSyncListItemParams struct { - // A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. - Data *interface{} `json:"Data,omitempty"` - // An alias for `item_ttl`. If both parameters are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. - ItemTtl *int `json:"ItemTtl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item's parent Sync List expires (time-to-live) and is deleted. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. + Data *interface{} `json:"Data,omitempty"` + // An alias for `item_ttl`. If both parameters are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. + ItemTtl *int `json:"ItemTtl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item's parent Sync List expires (time-to-live) and is deleted. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *CreateSyncListItemParams) SetData(Data interface{}) *CreateSyncListItemParams { - params.Data = &Data - return params +func (params *CreateSyncListItemParams) SetData(Data interface{}) (*CreateSyncListItemParams){ + params.Data = &Data + return params } -func (params *CreateSyncListItemParams) SetTtl(Ttl int) *CreateSyncListItemParams { - params.Ttl = &Ttl - return params +func (params *CreateSyncListItemParams) SetTtl(Ttl int) (*CreateSyncListItemParams){ + params.Ttl = &Ttl + return params } -func (params *CreateSyncListItemParams) SetItemTtl(ItemTtl int) *CreateSyncListItemParams { - params.ItemTtl = &ItemTtl - return params +func (params *CreateSyncListItemParams) SetItemTtl(ItemTtl int) (*CreateSyncListItemParams){ + params.ItemTtl = &ItemTtl + return params } -func (params *CreateSyncListItemParams) SetCollectionTtl(CollectionTtl int) *CreateSyncListItemParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *CreateSyncListItemParams) SetCollectionTtl(CollectionTtl int) (*CreateSyncListItemParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) CreateSyncListItem(ServiceSid string, ListSid string, params *CreateSyncListItemParams) (*SyncV1SyncListItem, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) - - if err != nil { - return nil, err - } - - data.Set("Data", string(v)) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.ItemTtl != nil { - data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SyncV1SyncListItem{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) + + if err != nil { + return nil, err + } + + data.Set("Data", string(v)) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.ItemTtl != nil { + data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncListItem{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSyncListItem' type DeleteSyncListItemParams struct { - // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). - IfMatch *string `json:"If-Match,omitempty"` + // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). + IfMatch *string `json:"If-Match,omitempty"` } -func (params *DeleteSyncListItemParams) SetIfMatch(IfMatch string) *DeleteSyncListItemParams { - params.IfMatch = &IfMatch - return params +func (params *DeleteSyncListItemParams) SetIfMatch(IfMatch string) (*DeleteSyncListItemParams){ + params.IfMatch = &IfMatch + return params } -// -func (c *ApiService) DeleteSyncListItem(ServiceSid string, ListSid string, Index int, params *DeleteSyncListItemParams) error { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - path = strings.Replace(path, "{"+"Index"+"}", fmt.Sprint(Index), -1) +// +func (c *ApiService) DeleteSyncListItem(ServiceSid string, ListSid string, Index int, params *DeleteSyncListItemParams) (error) { + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"Index"+"}", fmt.Sprint(Index), -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchSyncListItem(ServiceSid string, ListSid string, Index int) (*SyncV1SyncListItem, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - path = strings.Replace(path, "{"+"Index"+"}", fmt.Sprint(Index), -1) +// +func (c *ApiService) FetchSyncListItem(ServiceSid string, ListSid string, Index int, ) (*SyncV1SyncListItem, error) { + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"Index"+"}", fmt.Sprint(Index), -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncListItem{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncListItem{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSyncListItem' type ListSyncListItemParams struct { - // How to order the List Items returned by their `index` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. - Order *string `json:"Order,omitempty"` - // The `index` of the first Sync List Item resource to read. See also `bounds`. - From *string `json:"From,omitempty"` - // Whether to include the List Item referenced by the `from` parameter. Can be: `inclusive` to include the List Item referenced by the `from` parameter or `exclusive` to start with the next List Item. The default value is `inclusive`. - Bounds *string `json:"Bounds,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How to order the List Items returned by their `index` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. + Order *string `json:"Order,omitempty"` + // The `index` of the first Sync List Item resource to read. See also `bounds`. + From *string `json:"From,omitempty"` + // Whether to include the List Item referenced by the `from` parameter. Can be: `inclusive` to include the List Item referenced by the `from` parameter or `exclusive` to start with the next List Item. The default value is `inclusive`. + Bounds *string `json:"Bounds,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncListItemParams) SetOrder(Order string) *ListSyncListItemParams { - params.Order = &Order - return params +func (params *ListSyncListItemParams) SetOrder(Order string) (*ListSyncListItemParams){ + params.Order = &Order + return params } -func (params *ListSyncListItemParams) SetFrom(From string) *ListSyncListItemParams { - params.From = &From - return params +func (params *ListSyncListItemParams) SetFrom(From string) (*ListSyncListItemParams){ + params.From = &From + return params } -func (params *ListSyncListItemParams) SetBounds(Bounds string) *ListSyncListItemParams { - params.Bounds = &Bounds - return params +func (params *ListSyncListItemParams) SetBounds(Bounds string) (*ListSyncListItemParams){ + params.Bounds = &Bounds + return params } -func (params *ListSyncListItemParams) SetPageSize(PageSize int) *ListSyncListItemParams { - params.PageSize = &PageSize - return params +func (params *ListSyncListItemParams) SetPageSize(PageSize int) (*ListSyncListItemParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncListItemParams) SetLimit(Limit int) *ListSyncListItemParams { - params.Limit = &Limit - return params +func (params *ListSyncListItemParams) SetLimit(Limit int) (*ListSyncListItemParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncListItem records from the API. Request is executed immediately. func (c *ApiService) PageSyncListItem(ServiceSid string, ListSid string, params *ListSyncListItemParams, pageToken, pageNumber string) (*ListSyncListItemResponse, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Bounds != nil { - data.Set("Bounds", *params.Bounds) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncListItemResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Bounds != nil { + data.Set("Bounds", *params.Bounds) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncListItemResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists SyncListItem records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -273,6 +277,7 @@ func (c *ApiService) StreamSyncListItem(ServiceSid string, ListSid string, param return recordChannel, errorChannel } + func (c *ApiService) streamSyncListItem(response *ListSyncListItemResponse, params *ListSyncListItemParams, recordChannel chan SyncV1SyncListItem, errorChannel chan error) { curRecord := 1 @@ -304,102 +309,103 @@ func (c *ApiService) streamSyncListItem(response *ListSyncListItemResponse, para } func (c *ApiService) getNextListSyncListItemResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncListItemResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncListItemResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncListItem' type UpdateSyncListItemParams struct { - // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). - IfMatch *string `json:"If-Match,omitempty"` - // A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. - Data *interface{} `json:"Data,omitempty"` - // An alias for `item_ttl`. If both parameters are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. - ItemTtl *int `json:"ItemTtl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item's parent Sync List expires (time-to-live) and is deleted. This parameter can only be used when the List Item's `data` or `ttl` is updated in the same request. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). + IfMatch *string `json:"If-Match,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. + Data *interface{} `json:"Data,omitempty"` + // An alias for `item_ttl`. If both parameters are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. + ItemTtl *int `json:"ItemTtl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item's parent Sync List expires (time-to-live) and is deleted. This parameter can only be used when the List Item's `data` or `ttl` is updated in the same request. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *UpdateSyncListItemParams) SetIfMatch(IfMatch string) *UpdateSyncListItemParams { - params.IfMatch = &IfMatch - return params +func (params *UpdateSyncListItemParams) SetIfMatch(IfMatch string) (*UpdateSyncListItemParams){ + params.IfMatch = &IfMatch + return params } -func (params *UpdateSyncListItemParams) SetData(Data interface{}) *UpdateSyncListItemParams { - params.Data = &Data - return params +func (params *UpdateSyncListItemParams) SetData(Data interface{}) (*UpdateSyncListItemParams){ + params.Data = &Data + return params } -func (params *UpdateSyncListItemParams) SetTtl(Ttl int) *UpdateSyncListItemParams { - params.Ttl = &Ttl - return params +func (params *UpdateSyncListItemParams) SetTtl(Ttl int) (*UpdateSyncListItemParams){ + params.Ttl = &Ttl + return params } -func (params *UpdateSyncListItemParams) SetItemTtl(ItemTtl int) *UpdateSyncListItemParams { - params.ItemTtl = &ItemTtl - return params +func (params *UpdateSyncListItemParams) SetItemTtl(ItemTtl int) (*UpdateSyncListItemParams){ + params.ItemTtl = &ItemTtl + return params } -func (params *UpdateSyncListItemParams) SetCollectionTtl(CollectionTtl int) *UpdateSyncListItemParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *UpdateSyncListItemParams) SetCollectionTtl(CollectionTtl int) (*UpdateSyncListItemParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) UpdateSyncListItem(ServiceSid string, ListSid string, Index int, params *UpdateSyncListItemParams) (*SyncV1SyncListItem, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - path = strings.Replace(path, "{"+"Index"+"}", fmt.Sprint(Index), -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"Index"+"}", fmt.Sprint(Index), -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) + + if err != nil { + return nil, err + } + + data.Set("Data", string(v)) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.ItemTtl != nil { + data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) - - if err != nil { - return nil, err - } - - data.Set("Data", string(v)) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.ItemTtl != nil { - data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &SyncV1SyncListItem{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &SyncV1SyncListItem{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/sync/v1/services_lists_permissions.go b/rest/sync/v1/services_lists_permissions.go index d0a3bae2d..92ebfc4bb 100644 --- a/rest/sync/v1/services_lists_permissions.go +++ b/rest/sync/v1/services_lists_permissions.go @@ -18,107 +18,111 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific Sync List Permission. -func (c *ApiService) DeleteSyncListPermission(ServiceSid string, ListSid string, Identity string) error { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) DeleteSyncListPermission(ServiceSid string, ListSid string, Identity string, ) (error) { + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Sync List Permission. -func (c *ApiService) FetchSyncListPermission(ServiceSid string, ListSid string, Identity string) (*SyncV1SyncListPermission, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) FetchSyncListPermission(ServiceSid string, ListSid string, Identity string, ) (*SyncV1SyncListPermission, error) { + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncListPermission{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SyncV1SyncListPermission{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSyncListPermission' type ListSyncListPermissionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncListPermissionParams) SetPageSize(PageSize int) *ListSyncListPermissionParams { - params.PageSize = &PageSize - return params +func (params *ListSyncListPermissionParams) SetPageSize(PageSize int) (*ListSyncListPermissionParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncListPermissionParams) SetLimit(Limit int) *ListSyncListPermissionParams { - params.Limit = &Limit - return params +func (params *ListSyncListPermissionParams) SetLimit(Limit int) (*ListSyncListPermissionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncListPermission records from the API. Request is executed immediately. func (c *ApiService) PageSyncListPermission(ServiceSid string, ListSid string, params *ListSyncListPermissionParams, pageToken, pageNumber string) (*ListSyncListPermissionResponse, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions" + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSyncListPermissionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSyncListPermissionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SyncListPermission records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -159,6 +163,7 @@ func (c *ApiService) StreamSyncListPermission(ServiceSid string, ListSid string, return recordChannel, errorChannel } + func (c *ApiService) streamSyncListPermission(response *ListSyncListPermissionResponse, params *ListSyncListPermissionParams, recordChannel chan SyncV1SyncListPermission, errorChannel chan error) { curRecord := 1 @@ -190,77 +195,79 @@ func (c *ApiService) streamSyncListPermission(response *ListSyncListPermissionRe } func (c *ApiService) getNextListSyncListPermissionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncListPermissionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncListPermissionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncListPermission' type UpdateSyncListPermissionParams struct { - // Whether the identity can read the Sync List and its Items. Default value is `false`. - Read *bool `json:"Read,omitempty"` - // Whether the identity can create, update, and delete Items in the Sync List. Default value is `false`. - Write *bool `json:"Write,omitempty"` - // Whether the identity can delete the Sync List. Default value is `false`. - Manage *bool `json:"Manage,omitempty"` + // Whether the identity can read the Sync List and its Items. Default value is `false`. + Read *bool `json:"Read,omitempty"` + // Whether the identity can create, update, and delete Items in the Sync List. Default value is `false`. + Write *bool `json:"Write,omitempty"` + // Whether the identity can delete the Sync List. Default value is `false`. + Manage *bool `json:"Manage,omitempty"` } -func (params *UpdateSyncListPermissionParams) SetRead(Read bool) *UpdateSyncListPermissionParams { - params.Read = &Read - return params +func (params *UpdateSyncListPermissionParams) SetRead(Read bool) (*UpdateSyncListPermissionParams){ + params.Read = &Read + return params } -func (params *UpdateSyncListPermissionParams) SetWrite(Write bool) *UpdateSyncListPermissionParams { - params.Write = &Write - return params +func (params *UpdateSyncListPermissionParams) SetWrite(Write bool) (*UpdateSyncListPermissionParams){ + params.Write = &Write + return params } -func (params *UpdateSyncListPermissionParams) SetManage(Manage bool) *UpdateSyncListPermissionParams { - params.Manage = &Manage - return params +func (params *UpdateSyncListPermissionParams) SetManage(Manage bool) (*UpdateSyncListPermissionParams){ + params.Manage = &Manage + return params } // Update an identity's access to a specific Sync List. func (c *ApiService) UpdateSyncListPermission(ServiceSid string, ListSid string, Identity string, params *UpdateSyncListPermissionParams) (*SyncV1SyncListPermission, error) { - path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Read != nil { - data.Set("Read", fmt.Sprint(*params.Read)) - } - if params != nil && params.Write != nil { - data.Set("Write", fmt.Sprint(*params.Write)) - } - if params != nil && params.Manage != nil { - data.Set("Manage", fmt.Sprint(*params.Manage)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SyncV1SyncListPermission{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Lists/{ListSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ListSid"+"}", ListSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Read != nil { + data.Set("Read", fmt.Sprint(*params.Read)) + } + if params != nil && params.Write != nil { + data.Set("Write", fmt.Sprint(*params.Write)) + } + if params != nil && params.Manage != nil { + data.Set("Manage", fmt.Sprint(*params.Manage)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncListPermission{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/sync/v1/services_maps.go b/rest/sync/v1/services_maps.go index 731ada14d..efaa45f85 100644 --- a/rest/sync/v1/services_maps.go +++ b/rest/sync/v1/services_maps.go @@ -18,160 +18,165 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSyncMap' type CreateSyncMapParams struct { - // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // An alias for `collection_ttl`. If both parameters are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // An alias for `collection_ttl`. If both parameters are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *CreateSyncMapParams) SetUniqueName(UniqueName string) *CreateSyncMapParams { - params.UniqueName = &UniqueName - return params +func (params *CreateSyncMapParams) SetUniqueName(UniqueName string) (*CreateSyncMapParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateSyncMapParams) SetTtl(Ttl int) *CreateSyncMapParams { - params.Ttl = &Ttl - return params +func (params *CreateSyncMapParams) SetTtl(Ttl int) (*CreateSyncMapParams){ + params.Ttl = &Ttl + return params } -func (params *CreateSyncMapParams) SetCollectionTtl(CollectionTtl int) *CreateSyncMapParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *CreateSyncMapParams) SetCollectionTtl(CollectionTtl int) (*CreateSyncMapParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) CreateSyncMap(ServiceSid string, params *CreateSyncMapParams) (*SyncV1SyncMap, error) { - path := "/v1/Services/{ServiceSid}/Maps" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Maps" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1SyncMap{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &SyncV1SyncMap{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteSyncMap(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Maps/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteSyncMap(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Maps/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchSyncMap(ServiceSid string, Sid string) (*SyncV1SyncMap, error) { - path := "/v1/Services/{ServiceSid}/Maps/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchSyncMap(ServiceSid string, Sid string, ) (*SyncV1SyncMap, error) { + path := "/v1/Services/{ServiceSid}/Maps/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncMap{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncMap{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSyncMap' type ListSyncMapParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncMapParams) SetPageSize(PageSize int) *ListSyncMapParams { - params.PageSize = &PageSize - return params +func (params *ListSyncMapParams) SetPageSize(PageSize int) (*ListSyncMapParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncMapParams) SetLimit(Limit int) *ListSyncMapParams { - params.Limit = &Limit - return params +func (params *ListSyncMapParams) SetLimit(Limit int) (*ListSyncMapParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncMap records from the API. Request is executed immediately. func (c *ApiService) PageSyncMap(ServiceSid string, params *ListSyncMapParams, pageToken, pageNumber string) (*ListSyncMapResponse, error) { - path := "/v1/Services/{ServiceSid}/Maps" + path := "/v1/Services/{ServiceSid}/Maps" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSyncMapResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSyncMapResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SyncMap records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -212,6 +217,7 @@ func (c *ApiService) StreamSyncMap(ServiceSid string, params *ListSyncMapParams) return recordChannel, errorChannel } + func (c *ApiService) streamSyncMap(response *ListSyncMapResponse, params *ListSyncMapParams, recordChannel chan SyncV1SyncMap, errorChannel chan error) { curRecord := 1 @@ -243,67 +249,69 @@ func (c *ApiService) streamSyncMap(response *ListSyncMapResponse, params *ListSy } func (c *ApiService) getNextListSyncMapResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncMapResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncMapResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncMap' type UpdateSyncMapParams struct { - // An alias for `collection_ttl`. If both parameters are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // An alias for `collection_ttl`. If both parameters are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *UpdateSyncMapParams) SetTtl(Ttl int) *UpdateSyncMapParams { - params.Ttl = &Ttl - return params +func (params *UpdateSyncMapParams) SetTtl(Ttl int) (*UpdateSyncMapParams){ + params.Ttl = &Ttl + return params } -func (params *UpdateSyncMapParams) SetCollectionTtl(CollectionTtl int) *UpdateSyncMapParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *UpdateSyncMapParams) SetCollectionTtl(CollectionTtl int) (*UpdateSyncMapParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) UpdateSyncMap(ServiceSid string, Sid string, params *UpdateSyncMapParams) (*SyncV1SyncMap, error) { - path := "/v1/Services/{ServiceSid}/Maps/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Maps/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1SyncMap{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SyncV1SyncMap{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/sync/v1/services_maps_items.go b/rest/sync/v1/services_maps_items.go index 6a1a39e0d..3915ecd6e 100644 --- a/rest/sync/v1/services_maps_items.go +++ b/rest/sync/v1/services_maps_items.go @@ -18,230 +18,234 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSyncMapItem' type CreateSyncMapItemParams struct { - // The unique, user-defined key for the Map Item. Can be up to 320 characters long. - Key *string `json:"Key,omitempty"` - // A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. - Data *interface{} `json:"Data,omitempty"` - // An alias for `item_ttl`. If both parameters are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. - ItemTtl *int `json:"ItemTtl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // The unique, user-defined key for the Map Item. Can be up to 320 characters long. + Key *string `json:"Key,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. + Data *interface{} `json:"Data,omitempty"` + // An alias for `item_ttl`. If both parameters are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. + ItemTtl *int `json:"ItemTtl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *CreateSyncMapItemParams) SetKey(Key string) *CreateSyncMapItemParams { - params.Key = &Key - return params +func (params *CreateSyncMapItemParams) SetKey(Key string) (*CreateSyncMapItemParams){ + params.Key = &Key + return params } -func (params *CreateSyncMapItemParams) SetData(Data interface{}) *CreateSyncMapItemParams { - params.Data = &Data - return params +func (params *CreateSyncMapItemParams) SetData(Data interface{}) (*CreateSyncMapItemParams){ + params.Data = &Data + return params } -func (params *CreateSyncMapItemParams) SetTtl(Ttl int) *CreateSyncMapItemParams { - params.Ttl = &Ttl - return params +func (params *CreateSyncMapItemParams) SetTtl(Ttl int) (*CreateSyncMapItemParams){ + params.Ttl = &Ttl + return params } -func (params *CreateSyncMapItemParams) SetItemTtl(ItemTtl int) *CreateSyncMapItemParams { - params.ItemTtl = &ItemTtl - return params +func (params *CreateSyncMapItemParams) SetItemTtl(ItemTtl int) (*CreateSyncMapItemParams){ + params.ItemTtl = &ItemTtl + return params } -func (params *CreateSyncMapItemParams) SetCollectionTtl(CollectionTtl int) *CreateSyncMapItemParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *CreateSyncMapItemParams) SetCollectionTtl(CollectionTtl int) (*CreateSyncMapItemParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) CreateSyncMapItem(ServiceSid string, MapSid string, params *CreateSyncMapItemParams) (*SyncV1SyncMapItem, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Key != nil { - data.Set("Key", *params.Key) - } - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) - - if err != nil { - return nil, err - } - - data.Set("Data", string(v)) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.ItemTtl != nil { - data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SyncV1SyncMapItem{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Key != nil { + data.Set("Key", *params.Key) + } + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) + + if err != nil { + return nil, err + } + + data.Set("Data", string(v)) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.ItemTtl != nil { + data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncMapItem{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteSyncMapItem' type DeleteSyncMapItemParams struct { - // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). - IfMatch *string `json:"If-Match,omitempty"` + // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). + IfMatch *string `json:"If-Match,omitempty"` } -func (params *DeleteSyncMapItemParams) SetIfMatch(IfMatch string) *DeleteSyncMapItemParams { - params.IfMatch = &IfMatch - return params +func (params *DeleteSyncMapItemParams) SetIfMatch(IfMatch string) (*DeleteSyncMapItemParams){ + params.IfMatch = &IfMatch + return params } -// -func (c *ApiService) DeleteSyncMapItem(ServiceSid string, MapSid string, Key string, params *DeleteSyncMapItemParams) error { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +// +func (c *ApiService) DeleteSyncMapItem(ServiceSid string, MapSid string, Key string, params *DeleteSyncMapItemParams) (error) { + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchSyncMapItem(ServiceSid string, MapSid string, Key string) (*SyncV1SyncMapItem, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) +// +func (c *ApiService) FetchSyncMapItem(ServiceSid string, MapSid string, Key string, ) (*SyncV1SyncMapItem, error) { + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncMapItem{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncMapItem{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSyncMapItem' type ListSyncMapItemParams struct { - // How to order the Map Items returned by their `key` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. Map Items are [ordered lexicographically](https://en.wikipedia.org/wiki/Lexicographical_order) by Item key. - Order *string `json:"Order,omitempty"` - // The `key` of the first Sync Map Item resource to read. See also `bounds`. - From *string `json:"From,omitempty"` - // Whether to include the Map Item referenced by the `from` parameter. Can be: `inclusive` to include the Map Item referenced by the `from` parameter or `exclusive` to start with the next Map Item. The default value is `inclusive`. - Bounds *string `json:"Bounds,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How to order the Map Items returned by their `key` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. Map Items are [ordered lexicographically](https://en.wikipedia.org/wiki/Lexicographical_order) by Item key. + Order *string `json:"Order,omitempty"` + // The `key` of the first Sync Map Item resource to read. See also `bounds`. + From *string `json:"From,omitempty"` + // Whether to include the Map Item referenced by the `from` parameter. Can be: `inclusive` to include the Map Item referenced by the `from` parameter or `exclusive` to start with the next Map Item. The default value is `inclusive`. + Bounds *string `json:"Bounds,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncMapItemParams) SetOrder(Order string) *ListSyncMapItemParams { - params.Order = &Order - return params +func (params *ListSyncMapItemParams) SetOrder(Order string) (*ListSyncMapItemParams){ + params.Order = &Order + return params } -func (params *ListSyncMapItemParams) SetFrom(From string) *ListSyncMapItemParams { - params.From = &From - return params +func (params *ListSyncMapItemParams) SetFrom(From string) (*ListSyncMapItemParams){ + params.From = &From + return params } -func (params *ListSyncMapItemParams) SetBounds(Bounds string) *ListSyncMapItemParams { - params.Bounds = &Bounds - return params +func (params *ListSyncMapItemParams) SetBounds(Bounds string) (*ListSyncMapItemParams){ + params.Bounds = &Bounds + return params } -func (params *ListSyncMapItemParams) SetPageSize(PageSize int) *ListSyncMapItemParams { - params.PageSize = &PageSize - return params +func (params *ListSyncMapItemParams) SetPageSize(PageSize int) (*ListSyncMapItemParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncMapItemParams) SetLimit(Limit int) *ListSyncMapItemParams { - params.Limit = &Limit - return params +func (params *ListSyncMapItemParams) SetLimit(Limit int) (*ListSyncMapItemParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncMapItem records from the API. Request is executed immediately. func (c *ApiService) PageSyncMapItem(ServiceSid string, MapSid string, params *ListSyncMapItemParams, pageToken, pageNumber string) (*ListSyncMapItemResponse, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.Bounds != nil { - data.Set("Bounds", *params.Bounds) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncMapItemResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.Bounds != nil { + data.Set("Bounds", *params.Bounds) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncMapItemResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists SyncMapItem records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -282,6 +286,7 @@ func (c *ApiService) StreamSyncMapItem(ServiceSid string, MapSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamSyncMapItem(response *ListSyncMapItemResponse, params *ListSyncMapItemParams, recordChannel chan SyncV1SyncMapItem, errorChannel chan error) { curRecord := 1 @@ -313,102 +318,103 @@ func (c *ApiService) streamSyncMapItem(response *ListSyncMapItemResponse, params } func (c *ApiService) getNextListSyncMapItemResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncMapItemResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncMapItemResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncMapItem' type UpdateSyncMapItemParams struct { - // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). - IfMatch *string `json:"If-Match,omitempty"` - // A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. - Data *interface{} `json:"Data,omitempty"` - // An alias for `item_ttl`. If both parameters are provided, this value is ignored. - Ttl *int `json:"Ttl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. - ItemTtl *int `json:"ItemTtl,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. This parameter can only be used when the Map Item's `data` or `ttl` is updated in the same request. - CollectionTtl *int `json:"CollectionTtl,omitempty"` + // If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). + IfMatch *string `json:"If-Match,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. + Data *interface{} `json:"Data,omitempty"` + // An alias for `item_ttl`. If both parameters are provided, this value is ignored. + Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. + ItemTtl *int `json:"ItemTtl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. This parameter can only be used when the Map Item's `data` or `ttl` is updated in the same request. + CollectionTtl *int `json:"CollectionTtl,omitempty"` } -func (params *UpdateSyncMapItemParams) SetIfMatch(IfMatch string) *UpdateSyncMapItemParams { - params.IfMatch = &IfMatch - return params +func (params *UpdateSyncMapItemParams) SetIfMatch(IfMatch string) (*UpdateSyncMapItemParams){ + params.IfMatch = &IfMatch + return params } -func (params *UpdateSyncMapItemParams) SetData(Data interface{}) *UpdateSyncMapItemParams { - params.Data = &Data - return params +func (params *UpdateSyncMapItemParams) SetData(Data interface{}) (*UpdateSyncMapItemParams){ + params.Data = &Data + return params } -func (params *UpdateSyncMapItemParams) SetTtl(Ttl int) *UpdateSyncMapItemParams { - params.Ttl = &Ttl - return params +func (params *UpdateSyncMapItemParams) SetTtl(Ttl int) (*UpdateSyncMapItemParams){ + params.Ttl = &Ttl + return params } -func (params *UpdateSyncMapItemParams) SetItemTtl(ItemTtl int) *UpdateSyncMapItemParams { - params.ItemTtl = &ItemTtl - return params +func (params *UpdateSyncMapItemParams) SetItemTtl(ItemTtl int) (*UpdateSyncMapItemParams){ + params.ItemTtl = &ItemTtl + return params } -func (params *UpdateSyncMapItemParams) SetCollectionTtl(CollectionTtl int) *UpdateSyncMapItemParams { - params.CollectionTtl = &CollectionTtl - return params +func (params *UpdateSyncMapItemParams) SetCollectionTtl(CollectionTtl int) (*UpdateSyncMapItemParams){ + params.CollectionTtl = &CollectionTtl + return params } -// +// func (c *ApiService) UpdateSyncMapItem(ServiceSid string, MapSid string, Key string, params *UpdateSyncMapItemParams) (*SyncV1SyncMapItem, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - path = strings.Replace(path, "{"+"Key"+"}", Key, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"Key"+"}", Key, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) + + if err != nil { + return nil, err + } + + data.Set("Data", string(v)) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + if params != nil && params.ItemTtl != nil { + data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) + } + if params != nil && params.CollectionTtl != nil { + data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) + } - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) - - if err != nil { - return nil, err - } - - data.Set("Data", string(v)) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - if params != nil && params.ItemTtl != nil { - data.Set("ItemTtl", fmt.Sprint(*params.ItemTtl)) - } - if params != nil && params.CollectionTtl != nil { - data.Set("CollectionTtl", fmt.Sprint(*params.CollectionTtl)) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &SyncV1SyncMapItem{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &SyncV1SyncMapItem{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/sync/v1/services_maps_permissions.go b/rest/sync/v1/services_maps_permissions.go index 70b4dd777..969926f44 100644 --- a/rest/sync/v1/services_maps_permissions.go +++ b/rest/sync/v1/services_maps_permissions.go @@ -18,107 +18,111 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a specific Sync Map Permission. -func (c *ApiService) DeleteSyncMapPermission(ServiceSid string, MapSid string, Identity string) error { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) DeleteSyncMapPermission(ServiceSid string, MapSid string, Identity string, ) (error) { + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Sync Map Permission. -func (c *ApiService) FetchSyncMapPermission(ServiceSid string, MapSid string, Identity string) (*SyncV1SyncMapPermission, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) FetchSyncMapPermission(ServiceSid string, MapSid string, Identity string, ) (*SyncV1SyncMapPermission, error) { + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncMapPermission{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &SyncV1SyncMapPermission{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSyncMapPermission' type ListSyncMapPermissionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncMapPermissionParams) SetPageSize(PageSize int) *ListSyncMapPermissionParams { - params.PageSize = &PageSize - return params +func (params *ListSyncMapPermissionParams) SetPageSize(PageSize int) (*ListSyncMapPermissionParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncMapPermissionParams) SetLimit(Limit int) *ListSyncMapPermissionParams { - params.Limit = &Limit - return params +func (params *ListSyncMapPermissionParams) SetLimit(Limit int) (*ListSyncMapPermissionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncMapPermission records from the API. Request is executed immediately. func (c *ApiService) PageSyncMapPermission(ServiceSid string, MapSid string, params *ListSyncMapPermissionParams, pageToken, pageNumber string) (*ListSyncMapPermissionResponse, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions" + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSyncMapPermissionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSyncMapPermissionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SyncMapPermission records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -159,6 +163,7 @@ func (c *ApiService) StreamSyncMapPermission(ServiceSid string, MapSid string, p return recordChannel, errorChannel } + func (c *ApiService) streamSyncMapPermission(response *ListSyncMapPermissionResponse, params *ListSyncMapPermissionParams, recordChannel chan SyncV1SyncMapPermission, errorChannel chan error) { curRecord := 1 @@ -190,77 +195,79 @@ func (c *ApiService) streamSyncMapPermission(response *ListSyncMapPermissionResp } func (c *ApiService) getNextListSyncMapPermissionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncMapPermissionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncMapPermissionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncMapPermission' type UpdateSyncMapPermissionParams struct { - // Whether the identity can read the Sync Map and its Items. Default value is `false`. - Read *bool `json:"Read,omitempty"` - // Whether the identity can create, update, and delete Items in the Sync Map. Default value is `false`. - Write *bool `json:"Write,omitempty"` - // Whether the identity can delete the Sync Map. Default value is `false`. - Manage *bool `json:"Manage,omitempty"` + // Whether the identity can read the Sync Map and its Items. Default value is `false`. + Read *bool `json:"Read,omitempty"` + // Whether the identity can create, update, and delete Items in the Sync Map. Default value is `false`. + Write *bool `json:"Write,omitempty"` + // Whether the identity can delete the Sync Map. Default value is `false`. + Manage *bool `json:"Manage,omitempty"` } -func (params *UpdateSyncMapPermissionParams) SetRead(Read bool) *UpdateSyncMapPermissionParams { - params.Read = &Read - return params +func (params *UpdateSyncMapPermissionParams) SetRead(Read bool) (*UpdateSyncMapPermissionParams){ + params.Read = &Read + return params } -func (params *UpdateSyncMapPermissionParams) SetWrite(Write bool) *UpdateSyncMapPermissionParams { - params.Write = &Write - return params +func (params *UpdateSyncMapPermissionParams) SetWrite(Write bool) (*UpdateSyncMapPermissionParams){ + params.Write = &Write + return params } -func (params *UpdateSyncMapPermissionParams) SetManage(Manage bool) *UpdateSyncMapPermissionParams { - params.Manage = &Manage - return params +func (params *UpdateSyncMapPermissionParams) SetManage(Manage bool) (*UpdateSyncMapPermissionParams){ + params.Manage = &Manage + return params } // Update an identity's access to a specific Sync Map. func (c *ApiService) UpdateSyncMapPermission(ServiceSid string, MapSid string, Identity string, params *UpdateSyncMapPermissionParams) (*SyncV1SyncMapPermission, error) { - path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Read != nil { - data.Set("Read", fmt.Sprint(*params.Read)) - } - if params != nil && params.Write != nil { - data.Set("Write", fmt.Sprint(*params.Write)) - } - if params != nil && params.Manage != nil { - data.Set("Manage", fmt.Sprint(*params.Manage)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &SyncV1SyncMapPermission{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Services/{ServiceSid}/Maps/{MapSid}/Permissions/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"MapSid"+"}", MapSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Read != nil { + data.Set("Read", fmt.Sprint(*params.Read)) + } + if params != nil && params.Write != nil { + data.Set("Write", fmt.Sprint(*params.Write)) + } + if params != nil && params.Manage != nil { + data.Set("Manage", fmt.Sprint(*params.Manage)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &SyncV1SyncMapPermission{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/sync/v1/services_streams.go b/rest/sync/v1/services_streams.go index d16add427..ed3440294 100644 --- a/rest/sync/v1/services_streams.go +++ b/rest/sync/v1/services_streams.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSyncStream' type CreateSyncStreamParams struct { - // An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). - Ttl *int `json:"Ttl,omitempty"` + // An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). + Ttl *int `json:"Ttl,omitempty"` } -func (params *CreateSyncStreamParams) SetUniqueName(UniqueName string) *CreateSyncStreamParams { - params.UniqueName = &UniqueName - return params +func (params *CreateSyncStreamParams) SetUniqueName(UniqueName string) (*CreateSyncStreamParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateSyncStreamParams) SetTtl(Ttl int) *CreateSyncStreamParams { - params.Ttl = &Ttl - return params +func (params *CreateSyncStreamParams) SetTtl(Ttl int) (*CreateSyncStreamParams){ + params.Ttl = &Ttl + return params } // Create a new Stream. func (c *ApiService) CreateSyncStream(ServiceSid string, params *CreateSyncStreamParams) (*SyncV1SyncStream, error) { - path := "/v1/Services/{ServiceSid}/Streams" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v1/Services/{ServiceSid}/Streams" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1SyncStream{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SyncV1SyncStream{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Stream. -func (c *ApiService) DeleteSyncStream(ServiceSid string, Sid string) error { - path := "/v1/Services/{ServiceSid}/Streams/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSyncStream(ServiceSid string, Sid string, ) (error) { + path := "/v1/Services/{ServiceSid}/Streams/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific Stream. -func (c *ApiService) FetchSyncStream(ServiceSid string, Sid string) (*SyncV1SyncStream, error) { - path := "/v1/Services/{ServiceSid}/Streams/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSyncStream(ServiceSid string, Sid string, ) (*SyncV1SyncStream, error) { + path := "/v1/Services/{ServiceSid}/Streams/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &SyncV1SyncStream{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &SyncV1SyncStream{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSyncStream' type ListSyncStreamParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSyncStreamParams) SetPageSize(PageSize int) *ListSyncStreamParams { - params.PageSize = &PageSize - return params +func (params *ListSyncStreamParams) SetPageSize(PageSize int) (*ListSyncStreamParams){ + params.PageSize = &PageSize + return params } -func (params *ListSyncStreamParams) SetLimit(Limit int) *ListSyncStreamParams { - params.Limit = &Limit - return params +func (params *ListSyncStreamParams) SetLimit(Limit int) (*ListSyncStreamParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SyncStream records from the API. Request is executed immediately. func (c *ApiService) PageSyncStream(ServiceSid string, params *ListSyncStreamParams, pageToken, pageNumber string) (*ListSyncStreamResponse, error) { - path := "/v1/Services/{ServiceSid}/Streams" + path := "/v1/Services/{ServiceSid}/Streams" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSyncStreamResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSyncStreamResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SyncStream records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamSyncStream(ServiceSid string, params *ListSyncStreamP return recordChannel, errorChannel } + func (c *ApiService) streamSyncStream(response *ListSyncStreamResponse, params *ListSyncStreamParams, recordChannel chan SyncV1SyncStream, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamSyncStream(response *ListSyncStreamResponse, params * } func (c *ApiService) getNextListSyncStreamResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSyncStreamResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSyncStreamResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSyncStream' type UpdateSyncStreamParams struct { - // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). - Ttl *int `json:"Ttl,omitempty"` + // How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). + Ttl *int `json:"Ttl,omitempty"` } -func (params *UpdateSyncStreamParams) SetTtl(Ttl int) *UpdateSyncStreamParams { - params.Ttl = &Ttl - return params +func (params *UpdateSyncStreamParams) SetTtl(Ttl int) (*UpdateSyncStreamParams){ + params.Ttl = &Ttl + return params } // Update a specific Stream. func (c *ApiService) UpdateSyncStream(ServiceSid string, Sid string, params *UpdateSyncStreamParams) (*SyncV1SyncStream, error) { - path := "/v1/Services/{ServiceSid}/Streams/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Services/{ServiceSid}/Streams/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &SyncV1SyncStream{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &SyncV1SyncStream{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/sync/v1/services_streams_messages.go b/rest/sync/v1/services_streams_messages.go index ab4a47f4e..1e57f4c7d 100644 --- a/rest/sync/v1/services_streams_messages.go +++ b/rest/sync/v1/services_streams_messages.go @@ -16,51 +16,55 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateStreamMessage' type CreateStreamMessageParams struct { - // A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body. Can be up to 4 KiB in length. - Data *interface{} `json:"Data,omitempty"` + // A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body. Can be up to 4 KiB in length. + Data *interface{} `json:"Data,omitempty"` } -func (params *CreateStreamMessageParams) SetData(Data interface{}) *CreateStreamMessageParams { - params.Data = &Data - return params +func (params *CreateStreamMessageParams) SetData(Data interface{}) (*CreateStreamMessageParams){ + params.Data = &Data + return params } // Create a new Stream Message. func (c *ApiService) CreateStreamMessage(ServiceSid string, StreamSid string, params *CreateStreamMessageParams) (*SyncV1StreamMessage, error) { - path := "/v1/Services/{ServiceSid}/Streams/{StreamSid}/Messages" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"StreamSid"+"}", StreamSid, -1) + path := "/v1/Services/{ServiceSid}/Streams/{StreamSid}/Messages" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"StreamSid"+"}", StreamSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Data != nil { + v, err := json.Marshal(params.Data) - if params != nil && params.Data != nil { - v, err := json.Marshal(params.Data) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Data", string(v)) + } - data.Set("Data", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &SyncV1StreamMessage{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &SyncV1StreamMessage{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/README.md b/rest/taskrouter/v1/README.md index 12210f8c5..116fba44c 100644 --- a/rest/taskrouter/v1/README.md +++ b/rest/taskrouter/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -57,6 +57,7 @@ Class | Method | HTTP request | Description *WorkspacesTaskQueuesApi* | [**ListTaskQueue**](docs/WorkspacesTaskQueuesApi.md#listtaskqueue) | **Get** /v1/Workspaces/{WorkspaceSid}/TaskQueues | *WorkspacesTaskQueuesApi* | [**UpdateTaskQueue**](docs/WorkspacesTaskQueuesApi.md#updatetaskqueue) | **Post** /v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid} | *WorkspacesTaskQueuesCumulativeStatisticsApi* | [**FetchTaskQueueCumulativeStatistics**](docs/WorkspacesTaskQueuesCumulativeStatisticsApi.md#fetchtaskqueuecumulativestatistics) | **Get** /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/CumulativeStatistics | +*WorkspacesTaskQueuesRealTimeStatisticsApi* | [**CreateTaskQueueBulkRealTimeStatistics**](docs/WorkspacesTaskQueuesRealTimeStatisticsApi.md#createtaskqueuebulkrealtimestatistics) | **Post** /v1/Workspaces/{WorkspaceSid}/TaskQueues/RealTimeStatistics | *WorkspacesTaskQueuesRealTimeStatisticsApi* | [**FetchTaskQueueRealTimeStatistics**](docs/WorkspacesTaskQueuesRealTimeStatisticsApi.md#fetchtaskqueuerealtimestatistics) | **Get** /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/RealTimeStatistics | *WorkspacesTaskQueuesStatisticsApi* | [**FetchTaskQueueStatistics**](docs/WorkspacesTaskQueuesStatisticsApi.md#fetchtaskqueuestatistics) | **Get** /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/Statistics | *WorkspacesTaskQueuesStatisticsApi* | [**ListTaskQueuesStatistics**](docs/WorkspacesTaskQueuesStatisticsApi.md#listtaskqueuesstatistics) | **Get** /v1/Workspaces/{WorkspaceSid}/TaskQueues/Statistics | diff --git a/rest/taskrouter/v1/api_service.go b/rest/taskrouter/v1/api_service.go index 233d22d0b..e2e0953ea 100644 --- a/rest/taskrouter/v1/api_service.go +++ b/rest/taskrouter/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://taskrouter.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/taskrouter/v1/docs/ListActivityResponseMeta.md b/rest/taskrouter/v1/docs/ListActivityResponseMeta.md index 49a6ec885..757ae1515 100644 --- a/rest/taskrouter/v1/docs/ListActivityResponseMeta.md +++ b/rest/taskrouter/v1/docs/ListActivityResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/taskrouter/v1/docs/TaskrouterV1Task.md b/rest/taskrouter/v1/docs/TaskrouterV1Task.md index 16cfa28d3..0be8ba3ad 100644 --- a/rest/taskrouter/v1/docs/TaskrouterV1Task.md +++ b/rest/taskrouter/v1/docs/TaskrouterV1Task.md @@ -25,7 +25,6 @@ Name | Type | Description | Notes **WorkspaceSid** | Pointer to **string** | The SID of the Workspace that contains the Task. | **Url** | Pointer to **string** | The absolute URL of the Task resource. | **Links** | Pointer to **map[string]interface{}** | The URLs of related resources. | -**VirtualStartTime** | Pointer to [**time.Time**](time.Time.md) | The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/taskrouter/v1/docs/TaskrouterV1TaskQueueBulkRealTimeStatistics.md b/rest/taskrouter/v1/docs/TaskrouterV1TaskQueueBulkRealTimeStatistics.md index 4413279ef..9468cdd92 100644 --- a/rest/taskrouter/v1/docs/TaskrouterV1TaskQueueBulkRealTimeStatistics.md +++ b/rest/taskrouter/v1/docs/TaskrouterV1TaskQueueBulkRealTimeStatistics.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AccountSid** | Pointer to **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. | **WorkspaceSid** | Pointer to **string** | The SID of the Workspace that contains the TaskQueue. | -**TaskQueueData** | Pointer to **[]interface{}** | The TaskQueue RealTime Statistics for each requested TaskQueue SID, represented as an array of TaskQueue results corresponding to the requested TaskQueue SIDs, each result contains the following attributes: task_queue_sid: The SID of the TaskQueue from which these statistics were calculated, total_available_workers: The total number of Workers available for Tasks in the TaskQueue, total_eligible_workers: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state, total_tasks: The total number of Tasks, longest_task_waiting_age: The age of the longest waiting Task, longest_task_waiting_sid: The SID of the longest waiting Task, tasks_by_status: The number of Tasks by their current status, tasks_by_priority: The number of Tasks by priority, activity_statistics: The number of current Workers by Activity. | +**TaskQueueData** | Pointer to **interface{}** | The TaskQueue RealTime Statistics for each requested TaskQueue SID, represented as a map of TaskQueue SID to the TaskQueue result, each result contains the following attributes: task_queue_sid: The SID of the TaskQueue from which these statistics were calculated, total_available_workers: The total number of Workers available for Tasks in the TaskQueue, total_eligible_workers: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state, total_tasks: The total number of Tasks, longest_task_waiting_age: The age of the longest waiting Task, longest_task_waiting_sid: The SID of the longest waiting Task, tasks_by_status: The number of Tasks by their current status, tasks_by_priority: The number of Tasks by priority, activity_statistics: The number of current Workers by Activity. | **TaskQueueResponseCount** | Pointer to **int** | The number of TaskQueue statistics received in task_queue_data. | **Url** | Pointer to **string** | The absolute URL of the TaskQueue statistics resource. | diff --git a/rest/taskrouter/v1/docs/WorkspacesTaskQueuesRealTimeStatisticsApi.md b/rest/taskrouter/v1/docs/WorkspacesTaskQueuesRealTimeStatisticsApi.md index ec87f6c1d..ff13afc0b 100644 --- a/rest/taskrouter/v1/docs/WorkspacesTaskQueuesRealTimeStatisticsApi.md +++ b/rest/taskrouter/v1/docs/WorkspacesTaskQueuesRealTimeStatisticsApi.md @@ -4,10 +4,53 @@ All URIs are relative to *https://taskrouter.twilio.com* Method | HTTP request | Description ------------- | ------------- | ------------- +[**CreateTaskQueueBulkRealTimeStatistics**](WorkspacesTaskQueuesRealTimeStatisticsApi.md#CreateTaskQueueBulkRealTimeStatistics) | **Post** /v1/Workspaces/{WorkspaceSid}/TaskQueues/RealTimeStatistics | [**FetchTaskQueueRealTimeStatistics**](WorkspacesTaskQueuesRealTimeStatisticsApi.md#FetchTaskQueueRealTimeStatistics) | **Get** /v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/RealTimeStatistics | +## CreateTaskQueueBulkRealTimeStatistics + +> TaskrouterV1TaskQueueBulkRealTimeStatistics CreateTaskQueueBulkRealTimeStatistics(ctx, WorkspaceSid) + + + +Fetch a Task Queue Real Time Statistics in bulk for the array of TaskQueue SIDs, support upto 50 in a request. + +### Path Parameters + + +Name | Type | Description +------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**WorkspaceSid** | **string** | The unique SID identifier of the Workspace. + +### Other Parameters + +Other parameters are passed through a pointer to a CreateTaskQueueBulkRealTimeStatisticsParams struct + + +Name | Type | Description +------------- | ------------- | ------------- + +### Return type + +[**TaskrouterV1TaskQueueBulkRealTimeStatistics**](TaskrouterV1TaskQueueBulkRealTimeStatistics.md) + +### Authorization + +[accountSid_authToken](../README.md#accountSid_authToken) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## FetchTaskQueueRealTimeStatistics > TaskrouterV1TaskQueueRealTimeStatistics FetchTaskQueueRealTimeStatistics(ctx, WorkspaceSidTaskQueueSidoptional) diff --git a/rest/taskrouter/v1/docs/WorkspacesTasksApi.md b/rest/taskrouter/v1/docs/WorkspacesTasksApi.md index a6a8e37b4..363824904 100644 --- a/rest/taskrouter/v1/docs/WorkspacesTasksApi.md +++ b/rest/taskrouter/v1/docs/WorkspacesTasksApi.md @@ -40,7 +40,6 @@ Name | Type | Description **TaskChannel** | **string** | When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. **WorkflowSid** | **string** | The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. **Attributes** | **string** | A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. -**VirtualStartTime** | **time.Time** | The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. ### Return type @@ -177,7 +176,7 @@ Name | Type | Description **TaskQueueSid** | **string** | The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. **TaskQueueName** | **string** | The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. **EvaluateTaskAttributes** | **string** | The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. -**Ordering** | **string** | How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. +**Ordering** | **string** | How to order the returned Task resources. y default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `Priority` or `DateCreated` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Multiple sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. **HasAddons** | **bool** | Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. **Limit** | **int** | Max number of records to return. @@ -230,7 +229,6 @@ Name | Type | Description **Reason** | **string** | The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. **Priority** | **int** | The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). **TaskChannel** | **string** | When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. -**VirtualStartTime** | **time.Time** | The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. ### Return type diff --git a/rest/taskrouter/v1/model_list_activity_response.go b/rest/taskrouter/v1/model_list_activity_response.go index 114f84a3d..b95b5d9e6 100644 --- a/rest/taskrouter/v1/model_list_activity_response.go +++ b/rest/taskrouter/v1/model_list_activity_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListActivityResponse struct for ListActivityResponse type ListActivityResponse struct { - Activities []TaskrouterV1Activity `json:"activities,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Activities []TaskrouterV1Activity `json:"activities,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_activity_response_meta.go b/rest/taskrouter/v1/model_list_activity_response_meta.go index 31c21b0c5..32d8112e1 100644 --- a/rest/taskrouter/v1/model_list_activity_response_meta.go +++ b/rest/taskrouter/v1/model_list_activity_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListActivityResponseMeta struct for ListActivityResponseMeta type ListActivityResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_event_response.go b/rest/taskrouter/v1/model_list_event_response.go index 1c6d57219..fc6146474 100644 --- a/rest/taskrouter/v1/model_list_event_response.go +++ b/rest/taskrouter/v1/model_list_event_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEventResponse struct for ListEventResponse type ListEventResponse struct { - Events []TaskrouterV1Event `json:"events,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Events []TaskrouterV1Event `json:"events,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_task_channel_response.go b/rest/taskrouter/v1/model_list_task_channel_response.go index 3df6a7b26..03db91b04 100644 --- a/rest/taskrouter/v1/model_list_task_channel_response.go +++ b/rest/taskrouter/v1/model_list_task_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTaskChannelResponse struct for ListTaskChannelResponse type ListTaskChannelResponse struct { Channels []TaskrouterV1TaskChannel `json:"channels,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_task_queue_response.go b/rest/taskrouter/v1/model_list_task_queue_response.go index 0981415c1..bf3de72a6 100644 --- a/rest/taskrouter/v1/model_list_task_queue_response.go +++ b/rest/taskrouter/v1/model_list_task_queue_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTaskQueueResponse struct for ListTaskQueueResponse type ListTaskQueueResponse struct { - TaskQueues []TaskrouterV1TaskQueue `json:"task_queues,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + TaskQueues []TaskrouterV1TaskQueue `json:"task_queues,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_task_queues_statistics_response.go b/rest/taskrouter/v1/model_list_task_queues_statistics_response.go index ad5ab7b6f..a21c2e603 100644 --- a/rest/taskrouter/v1/model_list_task_queues_statistics_response.go +++ b/rest/taskrouter/v1/model_list_task_queues_statistics_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTaskQueuesStatisticsResponse struct for ListTaskQueuesStatisticsResponse type ListTaskQueuesStatisticsResponse struct { TaskQueuesStatistics []TaskrouterV1TaskQueuesStatistics `json:"task_queues_statistics,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_task_reservation_response.go b/rest/taskrouter/v1/model_list_task_reservation_response.go index 9bdf50d9c..1b7c0bd55 100644 --- a/rest/taskrouter/v1/model_list_task_reservation_response.go +++ b/rest/taskrouter/v1/model_list_task_reservation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTaskReservationResponse struct for ListTaskReservationResponse type ListTaskReservationResponse struct { Reservations []TaskrouterV1TaskReservation `json:"reservations,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_task_response.go b/rest/taskrouter/v1/model_list_task_response.go index 2cab61dd0..6f3bb7bd2 100644 --- a/rest/taskrouter/v1/model_list_task_response.go +++ b/rest/taskrouter/v1/model_list_task_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTaskResponse struct for ListTaskResponse type ListTaskResponse struct { - Tasks []TaskrouterV1Task `json:"tasks,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Tasks []TaskrouterV1Task `json:"tasks,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_worker_channel_response.go b/rest/taskrouter/v1/model_list_worker_channel_response.go index 96288abb0..f432d9177 100644 --- a/rest/taskrouter/v1/model_list_worker_channel_response.go +++ b/rest/taskrouter/v1/model_list_worker_channel_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWorkerChannelResponse struct for ListWorkerChannelResponse type ListWorkerChannelResponse struct { Channels []TaskrouterV1WorkerChannel `json:"channels,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_worker_reservation_response.go b/rest/taskrouter/v1/model_list_worker_reservation_response.go index c8dc755db..e952467e5 100644 --- a/rest/taskrouter/v1/model_list_worker_reservation_response.go +++ b/rest/taskrouter/v1/model_list_worker_reservation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWorkerReservationResponse struct for ListWorkerReservationResponse type ListWorkerReservationResponse struct { Reservations []TaskrouterV1WorkerReservation `json:"reservations,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_worker_response.go b/rest/taskrouter/v1/model_list_worker_response.go index 1c0a439fc..b26d8127d 100644 --- a/rest/taskrouter/v1/model_list_worker_response.go +++ b/rest/taskrouter/v1/model_list_worker_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWorkerResponse struct for ListWorkerResponse type ListWorkerResponse struct { - Workers []TaskrouterV1Worker `json:"workers,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Workers []TaskrouterV1Worker `json:"workers,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_workflow_response.go b/rest/taskrouter/v1/model_list_workflow_response.go index 7b2fe6d34..5a5c52c06 100644 --- a/rest/taskrouter/v1/model_list_workflow_response.go +++ b/rest/taskrouter/v1/model_list_workflow_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWorkflowResponse struct for ListWorkflowResponse type ListWorkflowResponse struct { - Workflows []TaskrouterV1Workflow `json:"workflows,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Workflows []TaskrouterV1Workflow `json:"workflows,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_list_workspace_response.go b/rest/taskrouter/v1/model_list_workspace_response.go index d09c0e070..b3da04d77 100644 --- a/rest/taskrouter/v1/model_list_workspace_response.go +++ b/rest/taskrouter/v1/model_list_workspace_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWorkspaceResponse struct for ListWorkspaceResponse type ListWorkspaceResponse struct { - Workspaces []TaskrouterV1Workspace `json:"workspaces,omitempty"` - Meta ListActivityResponseMeta `json:"meta,omitempty"` + Workspaces []TaskrouterV1Workspace `json:"workspaces,omitempty"` + Meta ListActivityResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_activity.go b/rest/taskrouter/v1/model_taskrouter_v1_activity.go index d82a361c3..3740d3cb9 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_activity.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_activity.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1Activity struct for TaskrouterV1Activity type TaskrouterV1Activity struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Activity resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Activity resource. AccountSid *string `json:"account_sid,omitempty"` - // Whether the Worker is eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` indicates the Activity is available. All other values indicate that it is not. The value cannot be changed after the Activity is created. + // Whether the Worker is eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` indicates the Activity is available. All other values indicate that it is not. The value cannot be changed after the Activity is created. Available *bool `json:"available,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the Activity resource. + // The string that you assigned to describe the Activity resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that we created to identify the Activity resource. + // The unique string that we created to identify the Activity resource. Sid *string `json:"sid,omitempty"` - // The SID of the Workspace that contains the Activity. + // The SID of the Workspace that contains the Activity. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Activity resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the Activity resource. + Url *string `json:"url,omitempty"` Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_event.go b/rest/taskrouter/v1/model_taskrouter_v1_event.go index b7811469e..90a8670da 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_event.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_event.go @@ -13,45 +13,47 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1Event struct for TaskrouterV1Event type TaskrouterV1Event struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the resource that triggered the event. + // The SID of the resource that triggered the event. ActorSid *string `json:"actor_sid,omitempty"` - // The type of resource that triggered the event. + // The type of resource that triggered the event. ActorType *string `json:"actor_type,omitempty"` - // The absolute URL of the resource that triggered the event. + // The absolute URL of the resource that triggered the event. ActorUrl *string `json:"actor_url,omitempty"` - // A description of the event. + // A description of the event. Description *string `json:"description,omitempty"` - // Data about the event. For more information, see [Event types](https://www.twilio.com/docs/taskrouter/api/event#event-types). + // Data about the event. For more information, see [Event types](https://www.twilio.com/docs/taskrouter/api/event#event-types). EventData *interface{} `json:"event_data,omitempty"` - // The time the event was sent, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The time the event was sent, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. EventDate *time.Time `json:"event_date,omitempty"` - // The time the event was sent in milliseconds. + // The time the event was sent in milliseconds. EventDateMs *int64 `json:"event_date_ms,omitempty"` - // The identifier for the event. + // The identifier for the event. EventType *string `json:"event_type,omitempty"` - // The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid. + // The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid. ResourceSid *string `json:"resource_sid,omitempty"` - // The type of object the event is most relevant to, such as a Task, Reservation, or a Worker). + // The type of object the event is most relevant to, such as a Task, Reservation, or a Worker). ResourceType *string `json:"resource_type,omitempty"` - // The URL of the resource the event is most relevant to. + // The URL of the resource the event is most relevant to. ResourceUrl *string `json:"resource_url,omitempty"` - // The unique string that we created to identify the Event resource. + // The unique string that we created to identify the Event resource. Sid *string `json:"sid,omitempty"` - // Where the Event originated. + // Where the Event originated. Source *string `json:"source,omitempty"` - // The IP from which the Event originated. + // The IP from which the Event originated. SourceIpAddress *string `json:"source_ip_address,omitempty"` - // The absolute URL of the Event resource. + // The absolute URL of the Event resource. Url *string `json:"url,omitempty"` - // The SID of the Workspace that contains the Event. + // The SID of the Workspace that contains the Event. WorkspaceSid *string `json:"workspace_sid,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task.go b/rest/taskrouter/v1/model_taskrouter_v1_task.go index 4732dce7f..2482ce42a 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task.go @@ -13,54 +13,54 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1Task struct for TaskrouterV1Task type TaskrouterV1Task struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. AccountSid *string `json:"account_sid,omitempty"` - // The number of seconds since the Task was created. - Age *int `json:"age,omitempty"` + // The number of seconds since the Task was created. + Age *int `json:"age,omitempty"` AssignmentStatus *string `json:"assignment_status,omitempty"` - // The JSON string with custom attributes of the work. **Note** If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null. + // The JSON string with custom attributes of the work. **Note** If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null. Attributes *string `json:"attributes,omitempty"` - // An object that contains the [addon](https://www.twilio.com/docs/taskrouter/marketplace) data for all installed addons. + // An object that contains the [addon](https://www.twilio.com/docs/taskrouter/marketplace) data for all installed addons. Addons *string `json:"addons,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. TaskQueueEnteredDate *time.Time `json:"task_queue_entered_date,omitempty"` - // The current priority score of the Task as assigned to a Worker by the workflow. Tasks with higher priority values will be assigned before Tasks with lower values. + // The current priority score of the Task as assigned to a Worker by the workflow. Tasks with higher priority values will be assigned before Tasks with lower values. Priority *int `json:"priority,omitempty"` - // The reason the Task was canceled or completed, if applicable. + // The reason the Task was canceled or completed, if applicable. Reason *string `json:"reason,omitempty"` - // The unique string that we created to identify the Task resource. + // The unique string that we created to identify the Task resource. Sid *string `json:"sid,omitempty"` - // The SID of the TaskQueue. + // The SID of the TaskQueue. TaskQueueSid *string `json:"task_queue_sid,omitempty"` - // The friendly name of the TaskQueue. + // The friendly name of the TaskQueue. TaskQueueFriendlyName *string `json:"task_queue_friendly_name,omitempty"` - // The SID of the TaskChannel. + // The SID of the TaskChannel. TaskChannelSid *string `json:"task_channel_sid,omitempty"` - // The unique name of the TaskChannel. + // The unique name of the TaskChannel. TaskChannelUniqueName *string `json:"task_channel_unique_name,omitempty"` - // The amount of time in seconds that the Task can live before being assigned. + // The amount of time in seconds that the Task can live before being assigned. Timeout *int `json:"timeout,omitempty"` - // The SID of the Workflow that is controlling the Task. + // The SID of the Workflow that is controlling the Task. WorkflowSid *string `json:"workflow_sid,omitempty"` - // The friendly name of the Workflow that is controlling the Task. + // The friendly name of the Workflow that is controlling the Task. WorkflowFriendlyName *string `json:"workflow_friendly_name,omitempty"` - // The SID of the Workspace that contains the Task. + // The SID of the Workspace that contains the Task. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Task resource. + // The absolute URL of the Task resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - VirtualStartTime *time.Time `json:"virtual_start_time,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_channel.go b/rest/taskrouter/v1/model_taskrouter_v1_task_channel.go index e1a3d907f..fd15fcbb3 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_channel.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_channel.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1TaskChannel struct for TaskrouterV1TaskChannel type TaskrouterV1TaskChannel struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task Channel resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task Channel resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that we created to identify the Task Channel resource. + // The unique string that we created to identify the Task Channel resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. + // An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the Workspace that contains the Task Channel. + // The SID of the Workspace that contains the Task Channel. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // Whether the Task Channel will prioritize Workers that have been idle. When `true`, Workers that have been idle the longest are prioritized. + // Whether the Task Channel will prioritize Workers that have been idle. When `true`, Workers that have been idle the longest are prioritized. ChannelOptimizedRouting *bool `json:"channel_optimized_routing,omitempty"` - // The absolute URL of the Task Channel resource. + // The absolute URL of the Task Channel resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_queue.go b/rest/taskrouter/v1/model_taskrouter_v1_task_queue.go index 7108e6bcf..6150e6239 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_queue.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_queue.go @@ -13,40 +13,42 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1TaskQueue struct for TaskrouterV1TaskQueue type TaskrouterV1TaskQueue struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Activity to assign Workers when a task is assigned for them. + // The SID of the Activity to assign Workers when a task is assigned for them. AssignmentActivitySid *string `json:"assignment_activity_sid,omitempty"` - // The name of the Activity to assign Workers when a task is assigned for them. + // The name of the Activity to assign Workers when a task is assigned for them. AssignmentActivityName *string `json:"assignment_activity_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The maximum number of Workers to reserve for the assignment of a task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. + // The maximum number of Workers to reserve for the assignment of a task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. MaxReservedWorkers *int `json:"max_reserved_workers,omitempty"` - // The SID of the Activity to assign Workers once a task is reserved for them. + // The SID of the Activity to assign Workers once a task is reserved for them. ReservationActivitySid *string `json:"reservation_activity_sid,omitempty"` - // The name of the Activity to assign Workers once a task is reserved for them. + // The name of the Activity to assign Workers once a task is reserved for them. ReservationActivityName *string `json:"reservation_activity_name,omitempty"` - // The unique string that we created to identify the TaskQueue resource. + // The unique string that we created to identify the TaskQueue resource. Sid *string `json:"sid,omitempty"` - // A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example `'\"language\" == \"spanish\"'` If no TargetWorkers parameter is provided, Tasks will wait in the TaskQueue until they are either deleted or moved to another TaskQueue. Additional examples on how to describing Worker selection criteria below. Defaults to 1==1. + // A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example `'\"language\" == \"spanish\"'` If no TargetWorkers parameter is provided, Tasks will wait in the TaskQueue until they are either deleted or moved to another TaskQueue. Additional examples on how to describing Worker selection criteria below. Defaults to 1==1. TargetWorkers *string `json:"target_workers,omitempty"` - TaskOrder *string `json:"task_order,omitempty"` - // The absolute URL of the TaskQueue resource. + TaskOrder *string `json:"task_order,omitempty"` + // The absolute URL of the TaskQueue resource. Url *string `json:"url,omitempty"` - // The SID of the Workspace that contains the TaskQueue. + // The SID of the Workspace that contains the TaskQueue. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_bulk_real_time_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_bulk_real_time_statistics.go index 823ea61b2..4ebe8e1ee 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_bulk_real_time_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_bulk_real_time_statistics.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1TaskQueueBulkRealTimeStatistics struct for TaskrouterV1TaskQueueBulkRealTimeStatistics type TaskrouterV1TaskQueueBulkRealTimeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Workspace that contains the TaskQueue. + // The SID of the Workspace that contains the TaskQueue. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The TaskQueue RealTime Statistics for each requested TaskQueue SID, represented as an array of TaskQueue results corresponding to the requested TaskQueue SIDs, each result contains the following attributes: task_queue_sid: The SID of the TaskQueue from which these statistics were calculated, total_available_workers: The total number of Workers available for Tasks in the TaskQueue, total_eligible_workers: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state, total_tasks: The total number of Tasks, longest_task_waiting_age: The age of the longest waiting Task, longest_task_waiting_sid: The SID of the longest waiting Task, tasks_by_status: The number of Tasks by their current status, tasks_by_priority: The number of Tasks by priority, activity_statistics: The number of current Workers by Activity. - TaskQueueData *[]interface{} `json:"task_queue_data,omitempty"` - // The number of TaskQueue statistics received in task_queue_data. + // The TaskQueue RealTime Statistics for each requested TaskQueue SID, represented as a map of TaskQueue SID to the TaskQueue result, each result contains the following attributes: task_queue_sid: The SID of the TaskQueue from which these statistics were calculated, total_available_workers: The total number of Workers available for Tasks in the TaskQueue, total_eligible_workers: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state, total_tasks: The total number of Tasks, longest_task_waiting_age: The age of the longest waiting Task, longest_task_waiting_sid: The SID of the longest waiting Task, tasks_by_status: The number of Tasks by their current status, tasks_by_priority: The number of Tasks by priority, activity_statistics: The number of current Workers by Activity. + TaskQueueData *interface{} `json:"task_queue_data,omitempty"` + // The number of TaskQueue statistics received in task_queue_data. TaskQueueResponseCount *int `json:"task_queue_response_count,omitempty"` - // The absolute URL of the TaskQueue statistics resource. + // The absolute URL of the TaskQueue statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_cumulative_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_cumulative_statistics.go index 1bb6cc0d5..9cace2e56 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_cumulative_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_cumulative_statistics.go @@ -13,55 +13,57 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1TaskQueueCumulativeStatistics struct for TaskrouterV1TaskQueueCumulativeStatistics type TaskrouterV1TaskQueueCumulativeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. AccountSid *string `json:"account_sid,omitempty"` - // The average time in seconds between Task creation and acceptance. + // The average time in seconds between Task creation and acceptance. AvgTaskAcceptanceTime *int `json:"avg_task_acceptance_time,omitempty"` - // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. StartTime *time.Time `json:"start_time,omitempty"` - // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. EndTime *time.Time `json:"end_time,omitempty"` - // The total number of Reservations created for Tasks in the TaskQueue. + // The total number of Reservations created for Tasks in the TaskQueue. ReservationsCreated *int `json:"reservations_created,omitempty"` - // The total number of Reservations accepted for Tasks in the TaskQueue. + // The total number of Reservations accepted for Tasks in the TaskQueue. ReservationsAccepted *int `json:"reservations_accepted,omitempty"` - // The total number of Reservations rejected for Tasks in the TaskQueue. + // The total number of Reservations rejected for Tasks in the TaskQueue. ReservationsRejected *int `json:"reservations_rejected,omitempty"` - // The total number of Reservations that timed out for Tasks in the TaskQueue. + // The total number of Reservations that timed out for Tasks in the TaskQueue. ReservationsTimedOut *int `json:"reservations_timed_out,omitempty"` - // The total number of Reservations canceled for Tasks in the TaskQueue. + // The total number of Reservations canceled for Tasks in the TaskQueue. ReservationsCanceled *int `json:"reservations_canceled,omitempty"` - // The total number of Reservations rescinded. + // The total number of Reservations rescinded. ReservationsRescinded *int `json:"reservations_rescinded,omitempty"` - // A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. + // A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. SplitByWaitTime *interface{} `json:"split_by_wait_time,omitempty"` - // The SID of the TaskQueue from which these statistics were calculated. + // The SID of the TaskQueue from which these statistics were calculated. TaskQueueSid *string `json:"task_queue_sid,omitempty"` - // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks were created. For transfers, the wait duration is counted from the moment ***the Task was created***, and not from when the transfer was initiated. + // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks were created. For transfers, the wait duration is counted from the moment ***the Task was created***, and not from when the transfer was initiated. WaitDurationUntilAccepted *interface{} `json:"wait_duration_until_accepted,omitempty"` - // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks canceled while in the TaskQueue. + // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks canceled while in the TaskQueue. WaitDurationUntilCanceled *interface{} `json:"wait_duration_until_canceled,omitempty"` - // The relative wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks entered the TaskQueue. + // The relative wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks entered the TaskQueue. WaitDurationInQueueUntilAccepted *interface{} `json:"wait_duration_in_queue_until_accepted,omitempty"` - // The total number of Tasks canceled in the TaskQueue. + // The total number of Tasks canceled in the TaskQueue. TasksCanceled *int `json:"tasks_canceled,omitempty"` - // The total number of Tasks completed in the TaskQueue. + // The total number of Tasks completed in the TaskQueue. TasksCompleted *int `json:"tasks_completed,omitempty"` - // The total number of Tasks deleted in the TaskQueue. + // The total number of Tasks deleted in the TaskQueue. TasksDeleted *int `json:"tasks_deleted,omitempty"` - // The total number of Tasks entered into the TaskQueue. + // The total number of Tasks entered into the TaskQueue. TasksEntered *int `json:"tasks_entered,omitempty"` - // The total number of Tasks that were moved from one queue to another. + // The total number of Tasks that were moved from one queue to another. TasksMoved *int `json:"tasks_moved,omitempty"` - // The SID of the Workspace that contains the TaskQueue. + // The SID of the Workspace that contains the TaskQueue. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the TaskQueue statistics resource. + // The absolute URL of the TaskQueue statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_real_time_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_real_time_statistics.go index 6daea4e36..5bde5cdb9 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_real_time_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_real_time_statistics.go @@ -13,35 +13,40 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1TaskQueueRealTimeStatistics struct for TaskrouterV1TaskQueueRealTimeStatistics type TaskrouterV1TaskQueueRealTimeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. AccountSid *string `json:"account_sid,omitempty"` - // The number of current Workers by Activity. + // The number of current Workers by Activity. ActivityStatistics *[]interface{} `json:"activity_statistics,omitempty"` - // The age of the longest waiting Task. + // The age of the longest waiting Task. LongestTaskWaitingAge *int `json:"longest_task_waiting_age,omitempty"` - // The SID of the longest waiting Task. + // The SID of the longest waiting Task. LongestTaskWaitingSid *string `json:"longest_task_waiting_sid,omitempty"` - // The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue. + // The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue. LongestRelativeTaskAgeInQueue *int `json:"longest_relative_task_age_in_queue,omitempty"` - // The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue. + // The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue. LongestRelativeTaskSidInQueue *string `json:"longest_relative_task_sid_in_queue,omitempty"` - // The SID of the TaskQueue from which these statistics were calculated. + // The SID of the TaskQueue from which these statistics were calculated. TaskQueueSid *string `json:"task_queue_sid,omitempty"` - // The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. + // The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. TasksByPriority *interface{} `json:"tasks_by_priority,omitempty"` - // The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. + // The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. TasksByStatus *interface{} `json:"tasks_by_status,omitempty"` - // The total number of Workers available for Tasks in the TaskQueue. + // The total number of Workers available for Tasks in the TaskQueue. TotalAvailableWorkers *int `json:"total_available_workers,omitempty"` - // The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state. + // The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state. TotalEligibleWorkers *int `json:"total_eligible_workers,omitempty"` - // The total number of Tasks. + // The total number of Tasks. TotalTasks *int `json:"total_tasks,omitempty"` - // The SID of the Workspace that contains the TaskQueue. + // The SID of the Workspace that contains the TaskQueue. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the TaskQueue statistics resource. + // The absolute URL of the TaskQueue statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_statistics.go index c122755ef..df3315aa1 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_queue_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_queue_statistics.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1TaskQueueStatistics struct for TaskrouterV1TaskQueueStatistics type TaskrouterV1TaskQueueStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. AccountSid *string `json:"account_sid,omitempty"` - // An object that contains the cumulative statistics for the TaskQueue. + // An object that contains the cumulative statistics for the TaskQueue. Cumulative *interface{} `json:"cumulative,omitempty"` - // An object that contains the real-time statistics for the TaskQueue. + // An object that contains the real-time statistics for the TaskQueue. Realtime *interface{} `json:"realtime,omitempty"` - // The SID of the TaskQueue from which these statistics were calculated. + // The SID of the TaskQueue from which these statistics were calculated. TaskQueueSid *string `json:"task_queue_sid,omitempty"` - // The SID of the Workspace that contains the TaskQueue. + // The SID of the Workspace that contains the TaskQueue. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the TaskQueue statistics resource. + // The absolute URL of the TaskQueue statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_queues_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_task_queues_statistics.go index 6ff710806..8a2ed8756 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_queues_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_queues_statistics.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1TaskQueuesStatistics struct for TaskrouterV1TaskQueuesStatistics type TaskrouterV1TaskQueuesStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. AccountSid *string `json:"account_sid,omitempty"` - // An object that contains the cumulative statistics for the TaskQueues. + // An object that contains the cumulative statistics for the TaskQueues. Cumulative *interface{} `json:"cumulative,omitempty"` - // An object that contains the real-time statistics for the TaskQueues. + // An object that contains the real-time statistics for the TaskQueues. Realtime *interface{} `json:"realtime,omitempty"` - // The SID of the TaskQueue from which these statistics were calculated. + // The SID of the TaskQueue from which these statistics were calculated. TaskQueueSid *string `json:"task_queue_sid,omitempty"` - // The SID of the Workspace that contains the TaskQueues. + // The SID of the Workspace that contains the TaskQueues. WorkspaceSid *string `json:"workspace_sid,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_task_reservation.go b/rest/taskrouter/v1/model_taskrouter_v1_task_reservation.go index c0c52817c..5a73e5e48 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_task_reservation.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_task_reservation.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1TaskReservation struct for TaskrouterV1TaskReservation type TaskrouterV1TaskReservation struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskReservation resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskReservation resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - DateUpdated *time.Time `json:"date_updated,omitempty"` - ReservationStatus *string `json:"reservation_status,omitempty"` - // The unique string that we created to identify the TaskReservation resource. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + DateUpdated *time.Time `json:"date_updated,omitempty"` + ReservationStatus *string `json:"reservation_status,omitempty"` + // The unique string that we created to identify the TaskReservation resource. Sid *string `json:"sid,omitempty"` - // The SID of the reserved Task resource. + // The SID of the reserved Task resource. TaskSid *string `json:"task_sid,omitempty"` - // The `friendly_name` of the Worker that is reserved. + // The `friendly_name` of the Worker that is reserved. WorkerName *string `json:"worker_name,omitempty"` - // The SID of the reserved Worker resource. + // The SID of the reserved Worker resource. WorkerSid *string `json:"worker_sid,omitempty"` - // The SID of the Workspace that this task is contained within. + // The SID of the Workspace that this task is contained within. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the TaskReservation reservation. + // The absolute URL of the TaskReservation reservation. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_worker.go b/rest/taskrouter/v1/model_taskrouter_v1_worker.go index e79f8a25d..024f3e937 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_worker.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_worker.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1Worker struct for TaskrouterV1Worker type TaskrouterV1Worker struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. AccountSid *string `json:"account_sid,omitempty"` - // The `friendly_name` of the Worker's current Activity. + // The `friendly_name` of the Worker's current Activity. ActivityName *string `json:"activity_name,omitempty"` - // The SID of the Worker's current Activity. + // The SID of the Worker's current Activity. ActivitySid *string `json:"activity_sid,omitempty"` - // The JSON string that describes the Worker. For example: `{ \"email\": \"Bob@example.com\", \"phone\": \"+5095551234\" }`. **Note** If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. + // The JSON string that describes the Worker. For example: `{ \"email\": \"Bob@example.com\", \"phone\": \"+5095551234\" }`. **Note** If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Attributes *string `json:"attributes,omitempty"` - // Whether the Worker is available to perform tasks. + // Whether the Worker is available to perform tasks. Available *bool `json:"available,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT of the last change to the Worker's activity specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Used to calculate Workflow statistics. + // The date and time in GMT of the last change to the Worker's activity specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Used to calculate Workflow statistics. DateStatusChanged *time.Time `json:"date_status_changed,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace. + // The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that we created to identify the Worker resource. + // The unique string that we created to identify the Worker resource. Sid *string `json:"sid,omitempty"` - // The SID of the Workspace that contains the Worker. + // The SID of the Workspace that contains the Worker. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Worker resource. + // The absolute URL of the Worker resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_worker_channel.go b/rest/taskrouter/v1/model_taskrouter_v1_worker_channel.go index 8a0d97742..2f9c2b8e4 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_worker_channel.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_worker_channel.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1WorkerChannel struct for TaskrouterV1WorkerChannel type TaskrouterV1WorkerChannel struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. AccountSid *string `json:"account_sid,omitempty"` - // The total number of Tasks assigned to Worker for the TaskChannel type. + // The total number of Tasks assigned to Worker for the TaskChannel type. AssignedTasks *int `json:"assigned_tasks,omitempty"` - // Whether the Worker should receive Tasks of the TaskChannel type. + // Whether the Worker should receive Tasks of the TaskChannel type. Available *bool `json:"available,omitempty"` - // The current percentage of capacity the TaskChannel has available. Can be a number between `0` and `100`. A value of `0` indicates that TaskChannel has no capacity available and a value of `100` means the Worker is available to receive any Tasks of this TaskChannel type. + // The current percentage of capacity the TaskChannel has available. Can be a number between `0` and `100`. A value of `0` indicates that TaskChannel has no capacity available and a value of `100` means the Worker is available to receive any Tasks of this TaskChannel type. AvailableCapacityPercentage *int `json:"available_capacity_percentage,omitempty"` - // The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value. + // The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value. ConfiguredCapacity *int `json:"configured_capacity,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that we created to identify the WorkerChannel resource. + // The unique string that we created to identify the WorkerChannel resource. Sid *string `json:"sid,omitempty"` - // The SID of the TaskChannel. + // The SID of the TaskChannel. TaskChannelSid *string `json:"task_channel_sid,omitempty"` - // The unique name of the TaskChannel, such as `voice` or `sms`. + // The unique name of the TaskChannel, such as `voice` or `sms`. TaskChannelUniqueName *string `json:"task_channel_unique_name,omitempty"` - // The SID of the Worker that contains the WorkerChannel. + // The SID of the Worker that contains the WorkerChannel. WorkerSid *string `json:"worker_sid,omitempty"` - // The SID of the Workspace that contains the WorkerChannel. + // The SID of the Workspace that contains the WorkerChannel. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the WorkerChannel resource. + // The absolute URL of the WorkerChannel resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_worker_instance_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_worker_instance_statistics.go index 8ac60a204..070daf8b4 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_worker_instance_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_worker_instance_statistics.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkerInstanceStatistics struct for TaskrouterV1WorkerInstanceStatistics type TaskrouterV1WorkerInstanceStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. AccountSid *string `json:"account_sid,omitempty"` - // An object that contains the cumulative statistics for the Worker. + // An object that contains the cumulative statistics for the Worker. Cumulative *interface{} `json:"cumulative,omitempty"` - // The SID of the Worker that contains the WorkerChannel. + // The SID of the Worker that contains the WorkerChannel. WorkerSid *string `json:"worker_sid,omitempty"` - // The SID of the Workspace that contains the WorkerChannel. + // The SID of the Workspace that contains the WorkerChannel. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the WorkerChannel statistics resource. + // The absolute URL of the WorkerChannel statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_worker_reservation.go b/rest/taskrouter/v1/model_taskrouter_v1_worker_reservation.go index 6d1c9397b..7a2d45950 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_worker_reservation.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_worker_reservation.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1WorkerReservation struct for TaskrouterV1WorkerReservation type TaskrouterV1WorkerReservation struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - DateUpdated *time.Time `json:"date_updated,omitempty"` - ReservationStatus *string `json:"reservation_status,omitempty"` - // The unique string that we created to identify the WorkerReservation resource. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + DateUpdated *time.Time `json:"date_updated,omitempty"` + ReservationStatus *string `json:"reservation_status,omitempty"` + // The unique string that we created to identify the WorkerReservation resource. Sid *string `json:"sid,omitempty"` - // The SID of the reserved Task resource. + // The SID of the reserved Task resource. TaskSid *string `json:"task_sid,omitempty"` - // The `friendly_name` of the Worker that is reserved. + // The `friendly_name` of the Worker that is reserved. WorkerName *string `json:"worker_name,omitempty"` - // The SID of the reserved Worker resource. + // The SID of the reserved Worker resource. WorkerSid *string `json:"worker_sid,omitempty"` - // The SID of the Workspace that this worker is contained within. + // The SID of the Workspace that this worker is contained within. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the WorkerReservation resource. + // The absolute URL of the WorkerReservation resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_worker_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_worker_statistics.go index e6e2d9b5b..0a49118b1 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_worker_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_worker_statistics.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkerStatistics struct for TaskrouterV1WorkerStatistics type TaskrouterV1WorkerStatistics struct { - // An object that contains the real-time statistics for the Worker. + // An object that contains the real-time statistics for the Worker. Realtime *interface{} `json:"realtime,omitempty"` - // An object that contains the cumulative statistics for the Worker. + // An object that contains the cumulative statistics for the Worker. Cumulative *interface{} `json:"cumulative,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Workspace that contains the Worker. + // The SID of the Workspace that contains the Worker. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Worker statistics resource. + // The absolute URL of the Worker statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workers_cumulative_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workers_cumulative_statistics.go index 844762ada..e806496d4 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workers_cumulative_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workers_cumulative_statistics.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1WorkersCumulativeStatistics struct for TaskrouterV1WorkersCumulativeStatistics type TaskrouterV1WorkersCumulativeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. AccountSid *string `json:"account_sid,omitempty"` - // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. StartTime *time.Time `json:"start_time,omitempty"` - // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. EndTime *time.Time `json:"end_time,omitempty"` - // The minimum, average, maximum, and total time (in seconds) that Workers spent in each Activity. + // The minimum, average, maximum, and total time (in seconds) that Workers spent in each Activity. ActivityDurations *[]interface{} `json:"activity_durations,omitempty"` - // The total number of Reservations that were created. + // The total number of Reservations that were created. ReservationsCreated *int `json:"reservations_created,omitempty"` - // The total number of Reservations that were accepted. + // The total number of Reservations that were accepted. ReservationsAccepted *int `json:"reservations_accepted,omitempty"` - // The total number of Reservations that were rejected. + // The total number of Reservations that were rejected. ReservationsRejected *int `json:"reservations_rejected,omitempty"` - // The total number of Reservations that were timed out. + // The total number of Reservations that were timed out. ReservationsTimedOut *int `json:"reservations_timed_out,omitempty"` - // The total number of Reservations that were canceled. + // The total number of Reservations that were canceled. ReservationsCanceled *int `json:"reservations_canceled,omitempty"` - // The total number of Reservations that were rescinded. + // The total number of Reservations that were rescinded. ReservationsRescinded *int `json:"reservations_rescinded,omitempty"` - // The SID of the Workspace that contains the Workers. + // The SID of the Workspace that contains the Workers. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workers statistics resource. + // The absolute URL of the Workers statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workers_real_time_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workers_real_time_statistics.go index af517944e..f4859803d 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workers_real_time_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workers_real_time_statistics.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkersRealTimeStatistics struct for TaskrouterV1WorkersRealTimeStatistics type TaskrouterV1WorkersRealTimeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. AccountSid *string `json:"account_sid,omitempty"` - // The number of current Workers by Activity. + // The number of current Workers by Activity. ActivityStatistics *[]interface{} `json:"activity_statistics,omitempty"` - // The total number of Workers. + // The total number of Workers. TotalWorkers *int `json:"total_workers,omitempty"` - // The SID of the Workspace that contains the Workers. + // The SID of the Workspace that contains the Workers. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workers statistics resource. + // The absolute URL of the Workers statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workflow.go b/rest/taskrouter/v1/model_taskrouter_v1_workflow.go index c10ef0dc7..6931130d7 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workflow.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workflow.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1Workflow struct for TaskrouterV1Workflow type TaskrouterV1Workflow struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. AccountSid *string `json:"account_sid,omitempty"` - // The URL that we call when a task managed by the Workflow is assigned to a Worker. See Assignment Callback URL for more information. + // The URL that we call when a task managed by the Workflow is assigned to a Worker. See Assignment Callback URL for more information. AssignmentCallbackUrl *string `json:"assignment_callback_url,omitempty"` - // A JSON string that contains the Workflow's configuration. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. + // A JSON string that contains the Workflow's configuration. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. Configuration *string `json:"configuration,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The MIME type of the document. + // The MIME type of the document. DocumentContentType *string `json:"document_content_type,omitempty"` - // The URL that we call when a call to the `assignment_callback_url` fails. + // The URL that we call when a call to the `assignment_callback_url` fails. FallbackAssignmentCallbackUrl *string `json:"fallback_assignment_callback_url,omitempty"` - // The string that you assigned to describe the Workflow resource. For example, `Customer Support` or `2014 Election Campaign`. + // The string that you assigned to describe the Workflow resource. For example, `Customer Support` or `2014 Election Campaign`. FriendlyName *string `json:"friendly_name,omitempty"` - // The unique string that we created to identify the Workflow resource. + // The unique string that we created to identify the Workflow resource. Sid *string `json:"sid,omitempty"` - // How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. + // How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. TaskReservationTimeout *int `json:"task_reservation_timeout,omitempty"` - // The SID of the Workspace that contains the Workflow. + // The SID of the Workspace that contains the Workflow. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workflow resource. + // The absolute URL of the Workflow resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workflow_cumulative_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workflow_cumulative_statistics.go index abf7c77fa..e8c767606 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workflow_cumulative_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workflow_cumulative_statistics.go @@ -13,55 +13,57 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1WorkflowCumulativeStatistics struct for TaskrouterV1WorkflowCumulativeStatistics type TaskrouterV1WorkflowCumulativeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. AccountSid *string `json:"account_sid,omitempty"` - // The average time in seconds between Task creation and acceptance. + // The average time in seconds between Task creation and acceptance. AvgTaskAcceptanceTime *int `json:"avg_task_acceptance_time,omitempty"` - // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. StartTime *time.Time `json:"start_time,omitempty"` - // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. EndTime *time.Time `json:"end_time,omitempty"` - // The total number of Reservations that were created for Workers. + // The total number of Reservations that were created for Workers. ReservationsCreated *int `json:"reservations_created,omitempty"` - // The total number of Reservations accepted by Workers. + // The total number of Reservations accepted by Workers. ReservationsAccepted *int `json:"reservations_accepted,omitempty"` - // The total number of Reservations that were rejected. + // The total number of Reservations that were rejected. ReservationsRejected *int `json:"reservations_rejected,omitempty"` - // The total number of Reservations that were timed out. + // The total number of Reservations that were timed out. ReservationsTimedOut *int `json:"reservations_timed_out,omitempty"` - // The total number of Reservations that were canceled. + // The total number of Reservations that were canceled. ReservationsCanceled *int `json:"reservations_canceled,omitempty"` - // The total number of Reservations that were rescinded. + // The total number of Reservations that were rescinded. ReservationsRescinded *int `json:"reservations_rescinded,omitempty"` - // A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. + // A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. SplitByWaitTime *interface{} `json:"split_by_wait_time,omitempty"` - // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. + // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. WaitDurationUntilAccepted *interface{} `json:"wait_duration_until_accepted,omitempty"` - // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. + // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. WaitDurationUntilCanceled *interface{} `json:"wait_duration_until_canceled,omitempty"` - // The total number of Tasks that were canceled. + // The total number of Tasks that were canceled. TasksCanceled *int `json:"tasks_canceled,omitempty"` - // The total number of Tasks that were completed. + // The total number of Tasks that were completed. TasksCompleted *int `json:"tasks_completed,omitempty"` - // The total number of Tasks that entered the Workflow. + // The total number of Tasks that entered the Workflow. TasksEntered *int `json:"tasks_entered,omitempty"` - // The total number of Tasks that were deleted. + // The total number of Tasks that were deleted. TasksDeleted *int `json:"tasks_deleted,omitempty"` - // The total number of Tasks that were moved from one queue to another. + // The total number of Tasks that were moved from one queue to another. TasksMoved *int `json:"tasks_moved,omitempty"` - // The total number of Tasks that were timed out of their Workflows (and deleted). + // The total number of Tasks that were timed out of their Workflows (and deleted). TasksTimedOutInWorkflow *int `json:"tasks_timed_out_in_workflow,omitempty"` - // Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value. + // Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value. WorkflowSid *string `json:"workflow_sid,omitempty"` - // The SID of the Workspace that contains the Workflow. + // The SID of the Workspace that contains the Workflow. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workflow statistics resource. + // The absolute URL of the Workflow statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workflow_real_time_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workflow_real_time_statistics.go index 4f8fc3f01..b7db55df0 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workflow_real_time_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workflow_real_time_statistics.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkflowRealTimeStatistics struct for TaskrouterV1WorkflowRealTimeStatistics type TaskrouterV1WorkflowRealTimeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. AccountSid *string `json:"account_sid,omitempty"` - // The age of the longest waiting Task. + // The age of the longest waiting Task. LongestTaskWaitingAge *int `json:"longest_task_waiting_age,omitempty"` - // The SID of the longest waiting Task. + // The SID of the longest waiting Task. LongestTaskWaitingSid *string `json:"longest_task_waiting_sid,omitempty"` - // The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. + // The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. TasksByPriority *interface{} `json:"tasks_by_priority,omitempty"` - // The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. + // The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. TasksByStatus *interface{} `json:"tasks_by_status,omitempty"` - // The total number of Tasks. + // The total number of Tasks. TotalTasks *int `json:"total_tasks,omitempty"` - // Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. + // Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. WorkflowSid *string `json:"workflow_sid,omitempty"` - // The SID of the Workspace that contains the Workflow. + // The SID of the Workspace that contains the Workflow. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workflow statistics resource. + // The absolute URL of the Workflow statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workflow_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workflow_statistics.go index c9b3782de..5f570130b 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workflow_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workflow_statistics.go @@ -13,19 +13,24 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkflowStatistics struct for TaskrouterV1WorkflowStatistics type TaskrouterV1WorkflowStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. AccountSid *string `json:"account_sid,omitempty"` - // An object that contains the cumulative statistics for the Workflow. + // An object that contains the cumulative statistics for the Workflow. Cumulative *interface{} `json:"cumulative,omitempty"` - // An object that contains the real-time statistics for the Workflow. + // An object that contains the real-time statistics for the Workflow. Realtime *interface{} `json:"realtime,omitempty"` - // Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. + // Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. WorkflowSid *string `json:"workflow_sid,omitempty"` - // The SID of the Workspace that contains the Workflow. + // The SID of the Workspace that contains the Workflow. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workflow statistics resource. + // The absolute URL of the Workflow statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workspace.go b/rest/taskrouter/v1/model_taskrouter_v1_workspace.go index 9c4289028..d41aa4da8 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workspace.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workspace.go @@ -13,40 +13,42 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1Workspace struct for TaskrouterV1Workspace type TaskrouterV1Workspace struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. AccountSid *string `json:"account_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The name of the default activity. + // The name of the default activity. DefaultActivityName *string `json:"default_activity_name,omitempty"` - // The SID of the Activity that will be used when new Workers are created in the Workspace. + // The SID of the Activity that will be used when new Workers are created in the Workspace. DefaultActivitySid *string `json:"default_activity_sid,omitempty"` - // The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). + // The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). EventCallbackUrl *string `json:"event_callback_url,omitempty"` - // The list of Workspace events for which to call `event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. + // The list of Workspace events for which to call `event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. EventsFilter *string `json:"events_filter,omitempty"` - // The string that you assigned to describe the Workspace resource. For example `Customer Support` or `2014 Election Campaign`. + // The string that you assigned to describe the Workspace resource. For example `Customer Support` or `2014 Election Campaign`. FriendlyName *string `json:"friendly_name,omitempty"` - // Whether multi-tasking is enabled. The default is `true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). + // Whether multi-tasking is enabled. The default is `true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). MultiTaskEnabled *bool `json:"multi_task_enabled,omitempty"` - // The unique string that we created to identify the Workspace resource. + // The unique string that we created to identify the Workspace resource. Sid *string `json:"sid,omitempty"` - // The name of the timeout activity. + // The name of the timeout activity. TimeoutActivityName *string `json:"timeout_activity_name,omitempty"` - // The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. - TimeoutActivitySid *string `json:"timeout_activity_sid,omitempty"` + // The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. + TimeoutActivitySid *string `json:"timeout_activity_sid,omitempty"` PrioritizeQueueOrder *string `json:"prioritize_queue_order,omitempty"` - // The absolute URL of the Workspace resource. + // The absolute URL of the Workspace resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workspace_cumulative_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workspace_cumulative_statistics.go index 149dd1874..d7c3b7f18 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workspace_cumulative_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workspace_cumulative_statistics.go @@ -13,53 +13,55 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TaskrouterV1WorkspaceCumulativeStatistics struct for TaskrouterV1WorkspaceCumulativeStatistics type TaskrouterV1WorkspaceCumulativeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. AccountSid *string `json:"account_sid,omitempty"` - // The average time in seconds between Task creation and acceptance. + // The average time in seconds between Task creation and acceptance. AvgTaskAcceptanceTime *int `json:"avg_task_acceptance_time,omitempty"` - // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. StartTime *time.Time `json:"start_time,omitempty"` - // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. EndTime *time.Time `json:"end_time,omitempty"` - // The total number of Reservations that were created for Workers. + // The total number of Reservations that were created for Workers. ReservationsCreated *int `json:"reservations_created,omitempty"` - // The total number of Reservations accepted by Workers. + // The total number of Reservations accepted by Workers. ReservationsAccepted *int `json:"reservations_accepted,omitempty"` - // The total number of Reservations that were rejected. + // The total number of Reservations that were rejected. ReservationsRejected *int `json:"reservations_rejected,omitempty"` - // The total number of Reservations that were timed out. + // The total number of Reservations that were timed out. ReservationsTimedOut *int `json:"reservations_timed_out,omitempty"` - // The total number of Reservations that were canceled. + // The total number of Reservations that were canceled. ReservationsCanceled *int `json:"reservations_canceled,omitempty"` - // The total number of Reservations that were rescinded. + // The total number of Reservations that were rescinded. ReservationsRescinded *int `json:"reservations_rescinded,omitempty"` - // A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. + // A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. SplitByWaitTime *interface{} `json:"split_by_wait_time,omitempty"` - // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. + // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. WaitDurationUntilAccepted *interface{} `json:"wait_duration_until_accepted,omitempty"` - // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. + // The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. WaitDurationUntilCanceled *interface{} `json:"wait_duration_until_canceled,omitempty"` - // The total number of Tasks that were canceled. + // The total number of Tasks that were canceled. TasksCanceled *int `json:"tasks_canceled,omitempty"` - // The total number of Tasks that were completed. + // The total number of Tasks that were completed. TasksCompleted *int `json:"tasks_completed,omitempty"` - // The total number of Tasks created. + // The total number of Tasks created. TasksCreated *int `json:"tasks_created,omitempty"` - // The total number of Tasks that were deleted. + // The total number of Tasks that were deleted. TasksDeleted *int `json:"tasks_deleted,omitempty"` - // The total number of Tasks that were moved from one queue to another. + // The total number of Tasks that were moved from one queue to another. TasksMoved *int `json:"tasks_moved,omitempty"` - // The total number of Tasks that were timed out of their Workflows (and deleted). + // The total number of Tasks that were timed out of their Workflows (and deleted). TasksTimedOutInWorkflow *int `json:"tasks_timed_out_in_workflow,omitempty"` - // The SID of the Workspace. + // The SID of the Workspace. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workspace statistics resource. + // The absolute URL of the Workspace statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workspace_real_time_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workspace_real_time_statistics.go index 1091a397f..cffebc1b5 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workspace_real_time_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workspace_real_time_statistics.go @@ -13,27 +13,32 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkspaceRealTimeStatistics struct for TaskrouterV1WorkspaceRealTimeStatistics type TaskrouterV1WorkspaceRealTimeStatistics struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. AccountSid *string `json:"account_sid,omitempty"` - // The number of current Workers by Activity. + // The number of current Workers by Activity. ActivityStatistics *[]interface{} `json:"activity_statistics,omitempty"` - // The age of the longest waiting Task. + // The age of the longest waiting Task. LongestTaskWaitingAge *int `json:"longest_task_waiting_age,omitempty"` - // The SID of the longest waiting Task. + // The SID of the longest waiting Task. LongestTaskWaitingSid *string `json:"longest_task_waiting_sid,omitempty"` - // The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. + // The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. TasksByPriority *interface{} `json:"tasks_by_priority,omitempty"` - // The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. + // The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. TasksByStatus *interface{} `json:"tasks_by_status,omitempty"` - // The total number of Tasks. + // The total number of Tasks. TotalTasks *int `json:"total_tasks,omitempty"` - // The total number of Workers in the Workspace. + // The total number of Workers in the Workspace. TotalWorkers *int `json:"total_workers,omitempty"` - // The SID of the Workspace. + // The SID of the Workspace. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workspace statistics resource. + // The absolute URL of the Workspace statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/model_taskrouter_v1_workspace_statistics.go b/rest/taskrouter/v1/model_taskrouter_v1_workspace_statistics.go index 3fe5e0509..2259ac727 100644 --- a/rest/taskrouter/v1/model_taskrouter_v1_workspace_statistics.go +++ b/rest/taskrouter/v1/model_taskrouter_v1_workspace_statistics.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TaskrouterV1WorkspaceStatistics struct for TaskrouterV1WorkspaceStatistics type TaskrouterV1WorkspaceStatistics struct { - // An object that contains the real-time statistics for the Workspace. + // An object that contains the real-time statistics for the Workspace. Realtime *interface{} `json:"realtime,omitempty"` - // An object that contains the cumulative statistics for the Workspace. + // An object that contains the cumulative statistics for the Workspace. Cumulative *interface{} `json:"cumulative,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Workspace. + // The SID of the Workspace. WorkspaceSid *string `json:"workspace_sid,omitempty"` - // The absolute URL of the Workspace statistics resource. + // The absolute URL of the Workspace statistics resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/taskrouter/v1/workspaces.go b/rest/taskrouter/v1/workspaces.go index a1890a26a..8b5b6cc5d 100644 --- a/rest/taskrouter/v1/workspaces.go +++ b/rest/taskrouter/v1/workspaces.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWorkspace' type CreateWorkspaceParams struct { - // A descriptive string that you create to describe the Workspace resource. It can be up to 64 characters long. For example: `Customer Support` or `2014 Election Campaign`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we should call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). - EventCallbackUrl *string `json:"EventCallbackUrl,omitempty"` - // The list of Workspace events for which to call event_callback_url. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. - EventsFilter *string `json:"EventsFilter,omitempty"` - // Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be created as multi-tasking. The default is `true`. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). - MultiTaskEnabled *bool `json:"MultiTaskEnabled,omitempty"` - // An available template name. Can be: `NONE` or `FIFO` and the default is `NONE`. Pre-configures the Workspace with the Workflow and Activities specified in the template. `NONE` will create a Workspace with only a set of default activities. `FIFO` will configure TaskRouter with a set of default activities and a single TaskQueue for first-in, first-out distribution, which can be useful when you are getting started with TaskRouter. - Template *string `json:"Template,omitempty"` - // - PrioritizeQueueOrder *string `json:"PrioritizeQueueOrder,omitempty"` + // A descriptive string that you create to describe the Workspace resource. It can be up to 64 characters long. For example: `Customer Support` or `2014 Election Campaign`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we should call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). + EventCallbackUrl *string `json:"EventCallbackUrl,omitempty"` + // The list of Workspace events for which to call event_callback_url. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. + EventsFilter *string `json:"EventsFilter,omitempty"` + // Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be created as multi-tasking. The default is `true`. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). + MultiTaskEnabled *bool `json:"MultiTaskEnabled,omitempty"` + // An available template name. Can be: `NONE` or `FIFO` and the default is `NONE`. Pre-configures the Workspace with the Workflow and Activities specified in the template. `NONE` will create a Workspace with only a set of default activities. `FIFO` will configure TaskRouter with a set of default activities and a single TaskQueue for first-in, first-out distribution, which can be useful when you are getting started with TaskRouter. + Template *string `json:"Template,omitempty"` + // + PrioritizeQueueOrder *string `json:"PrioritizeQueueOrder,omitempty"` } -func (params *CreateWorkspaceParams) SetFriendlyName(FriendlyName string) *CreateWorkspaceParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateWorkspaceParams) SetFriendlyName(FriendlyName string) (*CreateWorkspaceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateWorkspaceParams) SetEventCallbackUrl(EventCallbackUrl string) *CreateWorkspaceParams { - params.EventCallbackUrl = &EventCallbackUrl - return params +func (params *CreateWorkspaceParams) SetEventCallbackUrl(EventCallbackUrl string) (*CreateWorkspaceParams){ + params.EventCallbackUrl = &EventCallbackUrl + return params } -func (params *CreateWorkspaceParams) SetEventsFilter(EventsFilter string) *CreateWorkspaceParams { - params.EventsFilter = &EventsFilter - return params +func (params *CreateWorkspaceParams) SetEventsFilter(EventsFilter string) (*CreateWorkspaceParams){ + params.EventsFilter = &EventsFilter + return params } -func (params *CreateWorkspaceParams) SetMultiTaskEnabled(MultiTaskEnabled bool) *CreateWorkspaceParams { - params.MultiTaskEnabled = &MultiTaskEnabled - return params +func (params *CreateWorkspaceParams) SetMultiTaskEnabled(MultiTaskEnabled bool) (*CreateWorkspaceParams){ + params.MultiTaskEnabled = &MultiTaskEnabled + return params } -func (params *CreateWorkspaceParams) SetTemplate(Template string) *CreateWorkspaceParams { - params.Template = &Template - return params +func (params *CreateWorkspaceParams) SetTemplate(Template string) (*CreateWorkspaceParams){ + params.Template = &Template + return params } -func (params *CreateWorkspaceParams) SetPrioritizeQueueOrder(PrioritizeQueueOrder string) *CreateWorkspaceParams { - params.PrioritizeQueueOrder = &PrioritizeQueueOrder - return params +func (params *CreateWorkspaceParams) SetPrioritizeQueueOrder(PrioritizeQueueOrder string) (*CreateWorkspaceParams){ + params.PrioritizeQueueOrder = &PrioritizeQueueOrder + return params } -// +// func (c *ApiService) CreateWorkspace(params *CreateWorkspaceParams) (*TaskrouterV1Workspace, error) { - path := "/v1/Workspaces" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.EventCallbackUrl != nil { - data.Set("EventCallbackUrl", *params.EventCallbackUrl) - } - if params != nil && params.EventsFilter != nil { - data.Set("EventsFilter", *params.EventsFilter) - } - if params != nil && params.MultiTaskEnabled != nil { - data.Set("MultiTaskEnabled", fmt.Sprint(*params.MultiTaskEnabled)) - } - if params != nil && params.Template != nil { - data.Set("Template", *params.Template) - } - if params != nil && params.PrioritizeQueueOrder != nil { - data.Set("PrioritizeQueueOrder", *params.PrioritizeQueueOrder) - } + path := "/v1/Workspaces" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.EventCallbackUrl != nil { + data.Set("EventCallbackUrl", *params.EventCallbackUrl) + } + if params != nil && params.EventsFilter != nil { + data.Set("EventsFilter", *params.EventsFilter) + } + if params != nil && params.MultiTaskEnabled != nil { + data.Set("MultiTaskEnabled", fmt.Sprint(*params.MultiTaskEnabled)) + } + if params != nil && params.Template != nil { + data.Set("Template", *params.Template) + } + if params != nil && params.PrioritizeQueueOrder != nil { + data.Set("PrioritizeQueueOrder", *params.PrioritizeQueueOrder) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1Workspace{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteWorkspace(Sid string, ) (error) { + path := "/v1/Workspaces/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &TaskrouterV1Workspace{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteWorkspace(Sid string) error { - path := "/v1/Workspaces/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchWorkspace(Sid string, ) (*TaskrouterV1Workspace, error) { + path := "/v1/Workspaces/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchWorkspace(Sid string) (*TaskrouterV1Workspace, error) { - path := "/v1/Workspaces/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1Workspace{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1Workspace{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListWorkspace' type ListWorkspaceParams struct { - // The `friendly_name` of the Workspace resources to read. For example `Customer Support` or `2014 Election Campaign`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The `friendly_name` of the Workspace resources to read. For example `Customer Support` or `2014 Election Campaign`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWorkspaceParams) SetFriendlyName(FriendlyName string) *ListWorkspaceParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListWorkspaceParams) SetFriendlyName(FriendlyName string) (*ListWorkspaceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListWorkspaceParams) SetPageSize(PageSize int) *ListWorkspaceParams { - params.PageSize = &PageSize - return params +func (params *ListWorkspaceParams) SetPageSize(PageSize int) (*ListWorkspaceParams){ + params.PageSize = &PageSize + return params } -func (params *ListWorkspaceParams) SetLimit(Limit int) *ListWorkspaceParams { - params.Limit = &Limit - return params +func (params *ListWorkspaceParams) SetLimit(Limit int) (*ListWorkspaceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Workspace records from the API. Request is executed immediately. func (c *ApiService) PageWorkspace(params *ListWorkspaceParams, pageToken, pageNumber string) (*ListWorkspaceResponse, error) { - path := "/v1/Workspaces" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWorkspaceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWorkspaceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Workspace records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamWorkspace(params *ListWorkspaceParams) (chan Taskrout return recordChannel, errorChannel } + func (c *ApiService) streamWorkspace(response *ListWorkspaceResponse, params *ListWorkspaceParams, recordChannel chan TaskrouterV1Workspace, errorChannel chan error) { curRecord := 1 @@ -274,111 +281,113 @@ func (c *ApiService) streamWorkspace(response *ListWorkspaceResponse, params *Li } func (c *ApiService) getNextListWorkspaceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWorkspaceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWorkspaceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWorkspace' type UpdateWorkspaceParams struct { - // The SID of the Activity that will be used when new Workers are created in the Workspace. - DefaultActivitySid *string `json:"DefaultActivitySid,omitempty"` - // The URL we should call when an event occurs. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). - EventCallbackUrl *string `json:"EventCallbackUrl,omitempty"` - // The list of Workspace events for which to call event_callback_url. For example if `EventsFilter=task.created,task.canceled,worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. - EventsFilter *string `json:"EventsFilter,omitempty"` - // A descriptive string that you create to describe the Workspace resource. For example: `Sales Call Center` or `Customer Support Team`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). - MultiTaskEnabled *bool `json:"MultiTaskEnabled,omitempty"` - // The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. - TimeoutActivitySid *string `json:"TimeoutActivitySid,omitempty"` - // - PrioritizeQueueOrder *string `json:"PrioritizeQueueOrder,omitempty"` + // The SID of the Activity that will be used when new Workers are created in the Workspace. + DefaultActivitySid *string `json:"DefaultActivitySid,omitempty"` + // The URL we should call when an event occurs. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). + EventCallbackUrl *string `json:"EventCallbackUrl,omitempty"` + // The list of Workspace events for which to call event_callback_url. For example if `EventsFilter=task.created,task.canceled,worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. + EventsFilter *string `json:"EventsFilter,omitempty"` + // A descriptive string that you create to describe the Workspace resource. For example: `Sales Call Center` or `Customer Support Team`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). + MultiTaskEnabled *bool `json:"MultiTaskEnabled,omitempty"` + // The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. + TimeoutActivitySid *string `json:"TimeoutActivitySid,omitempty"` + // + PrioritizeQueueOrder *string `json:"PrioritizeQueueOrder,omitempty"` } -func (params *UpdateWorkspaceParams) SetDefaultActivitySid(DefaultActivitySid string) *UpdateWorkspaceParams { - params.DefaultActivitySid = &DefaultActivitySid - return params +func (params *UpdateWorkspaceParams) SetDefaultActivitySid(DefaultActivitySid string) (*UpdateWorkspaceParams){ + params.DefaultActivitySid = &DefaultActivitySid + return params } -func (params *UpdateWorkspaceParams) SetEventCallbackUrl(EventCallbackUrl string) *UpdateWorkspaceParams { - params.EventCallbackUrl = &EventCallbackUrl - return params +func (params *UpdateWorkspaceParams) SetEventCallbackUrl(EventCallbackUrl string) (*UpdateWorkspaceParams){ + params.EventCallbackUrl = &EventCallbackUrl + return params } -func (params *UpdateWorkspaceParams) SetEventsFilter(EventsFilter string) *UpdateWorkspaceParams { - params.EventsFilter = &EventsFilter - return params +func (params *UpdateWorkspaceParams) SetEventsFilter(EventsFilter string) (*UpdateWorkspaceParams){ + params.EventsFilter = &EventsFilter + return params } -func (params *UpdateWorkspaceParams) SetFriendlyName(FriendlyName string) *UpdateWorkspaceParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateWorkspaceParams) SetFriendlyName(FriendlyName string) (*UpdateWorkspaceParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateWorkspaceParams) SetMultiTaskEnabled(MultiTaskEnabled bool) *UpdateWorkspaceParams { - params.MultiTaskEnabled = &MultiTaskEnabled - return params +func (params *UpdateWorkspaceParams) SetMultiTaskEnabled(MultiTaskEnabled bool) (*UpdateWorkspaceParams){ + params.MultiTaskEnabled = &MultiTaskEnabled + return params } -func (params *UpdateWorkspaceParams) SetTimeoutActivitySid(TimeoutActivitySid string) *UpdateWorkspaceParams { - params.TimeoutActivitySid = &TimeoutActivitySid - return params +func (params *UpdateWorkspaceParams) SetTimeoutActivitySid(TimeoutActivitySid string) (*UpdateWorkspaceParams){ + params.TimeoutActivitySid = &TimeoutActivitySid + return params } -func (params *UpdateWorkspaceParams) SetPrioritizeQueueOrder(PrioritizeQueueOrder string) *UpdateWorkspaceParams { - params.PrioritizeQueueOrder = &PrioritizeQueueOrder - return params +func (params *UpdateWorkspaceParams) SetPrioritizeQueueOrder(PrioritizeQueueOrder string) (*UpdateWorkspaceParams){ + params.PrioritizeQueueOrder = &PrioritizeQueueOrder + return params } -// +// func (c *ApiService) UpdateWorkspace(Sid string, params *UpdateWorkspaceParams) (*TaskrouterV1Workspace, error) { - path := "/v1/Workspaces/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DefaultActivitySid != nil { - data.Set("DefaultActivitySid", *params.DefaultActivitySid) - } - if params != nil && params.EventCallbackUrl != nil { - data.Set("EventCallbackUrl", *params.EventCallbackUrl) - } - if params != nil && params.EventsFilter != nil { - data.Set("EventsFilter", *params.EventsFilter) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.MultiTaskEnabled != nil { - data.Set("MultiTaskEnabled", fmt.Sprint(*params.MultiTaskEnabled)) - } - if params != nil && params.TimeoutActivitySid != nil { - data.Set("TimeoutActivitySid", *params.TimeoutActivitySid) - } - if params != nil && params.PrioritizeQueueOrder != nil { - data.Set("PrioritizeQueueOrder", *params.PrioritizeQueueOrder) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TaskrouterV1Workspace{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DefaultActivitySid != nil { + data.Set("DefaultActivitySid", *params.DefaultActivitySid) + } + if params != nil && params.EventCallbackUrl != nil { + data.Set("EventCallbackUrl", *params.EventCallbackUrl) + } + if params != nil && params.EventsFilter != nil { + data.Set("EventsFilter", *params.EventsFilter) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.MultiTaskEnabled != nil { + data.Set("MultiTaskEnabled", fmt.Sprint(*params.MultiTaskEnabled)) + } + if params != nil && params.TimeoutActivitySid != nil { + data.Set("TimeoutActivitySid", *params.TimeoutActivitySid) + } + if params != nil && params.PrioritizeQueueOrder != nil { + data.Set("PrioritizeQueueOrder", *params.PrioritizeQueueOrder) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1Workspace{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_activities.go b/rest/taskrouter/v1/workspaces_activities.go index 563c227c4..da04c27f7 100644 --- a/rest/taskrouter/v1/workspaces_activities.go +++ b/rest/taskrouter/v1/workspaces_activities.go @@ -18,169 +18,174 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateActivity' type CreateActivityParams struct { - // A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether the Worker should be eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` specifies the Activity is available. All other values specify that it is not. The value cannot be changed after the Activity is created. - Available *bool `json:"Available,omitempty"` + // A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether the Worker should be eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` specifies the Activity is available. All other values specify that it is not. The value cannot be changed after the Activity is created. + Available *bool `json:"Available,omitempty"` } -func (params *CreateActivityParams) SetFriendlyName(FriendlyName string) *CreateActivityParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateActivityParams) SetFriendlyName(FriendlyName string) (*CreateActivityParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateActivityParams) SetAvailable(Available bool) *CreateActivityParams { - params.Available = &Available - return params +func (params *CreateActivityParams) SetAvailable(Available bool) (*CreateActivityParams){ + params.Available = &Available + return params } -// +// func (c *ApiService) CreateActivity(WorkspaceSid string, params *CreateActivityParams) (*TaskrouterV1Activity, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Activities" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Activities" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Available != nil { - data.Set("Available", fmt.Sprint(*params.Available)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Available != nil { + data.Set("Available", fmt.Sprint(*params.Available)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1Activity{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TaskrouterV1Activity{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteActivity(WorkspaceSid string, Sid string) error { - path := "/v1/Workspaces/{WorkspaceSid}/Activities/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteActivity(WorkspaceSid string, Sid string, ) (error) { + path := "/v1/Workspaces/{WorkspaceSid}/Activities/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchActivity(WorkspaceSid string, Sid string) (*TaskrouterV1Activity, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Activities/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchActivity(WorkspaceSid string, Sid string, ) (*TaskrouterV1Activity, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Activities/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TaskrouterV1Activity{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &TaskrouterV1Activity{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListActivity' type ListActivityParams struct { - // The `friendly_name` of the Activity resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether return only Activity resources that are available or unavailable. A value of `true` returns only available activities. Values of '1' or `yes` also indicate `true`. All other values represent `false` and return activities that are unavailable. - Available *string `json:"Available,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The `friendly_name` of the Activity resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether return only Activity resources that are available or unavailable. A value of `true` returns only available activities. Values of '1' or `yes` also indicate `true`. All other values represent `false` and return activities that are unavailable. + Available *string `json:"Available,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListActivityParams) SetFriendlyName(FriendlyName string) *ListActivityParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListActivityParams) SetFriendlyName(FriendlyName string) (*ListActivityParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListActivityParams) SetAvailable(Available string) *ListActivityParams { - params.Available = &Available - return params +func (params *ListActivityParams) SetAvailable(Available string) (*ListActivityParams){ + params.Available = &Available + return params } -func (params *ListActivityParams) SetPageSize(PageSize int) *ListActivityParams { - params.PageSize = &PageSize - return params +func (params *ListActivityParams) SetPageSize(PageSize int) (*ListActivityParams){ + params.PageSize = &PageSize + return params } -func (params *ListActivityParams) SetLimit(Limit int) *ListActivityParams { - params.Limit = &Limit - return params +func (params *ListActivityParams) SetLimit(Limit int) (*ListActivityParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Activity records from the API. Request is executed immediately. func (c *ApiService) PageActivity(WorkspaceSid string, params *ListActivityParams, pageToken, pageNumber string) (*ListActivityResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Activities" - - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Available != nil { - data.Set("Available", *params.Available) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListActivityResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Activities" + + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Available != nil { + data.Set("Available", *params.Available) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListActivityResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Activity records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -221,6 +226,7 @@ func (c *ApiService) StreamActivity(WorkspaceSid string, params *ListActivityPar return recordChannel, errorChannel } + func (c *ApiService) streamActivity(response *ListActivityResponse, params *ListActivityParams, recordChannel chan TaskrouterV1Activity, errorChannel chan error) { curRecord := 1 @@ -252,58 +258,60 @@ func (c *ApiService) streamActivity(response *ListActivityResponse, params *List } func (c *ApiService) getNextListActivityResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListActivityResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListActivityResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateActivity' type UpdateActivityParams struct { - // A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateActivityParams) SetFriendlyName(FriendlyName string) *UpdateActivityParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateActivityParams) SetFriendlyName(FriendlyName string) (*UpdateActivityParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateActivity(WorkspaceSid string, Sid string, params *UpdateActivityParams) (*TaskrouterV1Activity, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Activities/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Activities/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1Activity{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TaskrouterV1Activity{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_cumulative_statistics.go b/rest/taskrouter/v1/workspaces_cumulative_statistics.go index 5bf253374..c357a4d89 100644 --- a/rest/taskrouter/v1/workspaces_cumulative_statistics.go +++ b/rest/taskrouter/v1/workspaces_cumulative_statistics.go @@ -18,80 +18,82 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkspaceCumulativeStatistics' type FetchWorkspaceCumulativeStatisticsParams struct { - // Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` } -func (params *FetchWorkspaceCumulativeStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkspaceCumulativeStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkspaceCumulativeStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkspaceCumulativeStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkspaceCumulativeStatisticsParams) SetMinutes(Minutes int) *FetchWorkspaceCumulativeStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkspaceCumulativeStatisticsParams) SetMinutes(Minutes int) (*FetchWorkspaceCumulativeStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkspaceCumulativeStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkspaceCumulativeStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkspaceCumulativeStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkspaceCumulativeStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkspaceCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkspaceCumulativeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkspaceCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkspaceCumulativeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *FetchWorkspaceCumulativeStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *FetchWorkspaceCumulativeStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *FetchWorkspaceCumulativeStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*FetchWorkspaceCumulativeStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -// +// func (c *ApiService) FetchWorkspaceCumulativeStatistics(WorkspaceSid string, params *FetchWorkspaceCumulativeStatisticsParams) (*TaskrouterV1WorkspaceCumulativeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/CumulativeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/CumulativeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkspaceCumulativeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkspaceCumulativeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_events.go b/rest/taskrouter/v1/workspaces_events.go index b9bc46cbf..39261342c 100644 --- a/rest/taskrouter/v1/workspaces_events.go +++ b/rest/taskrouter/v1/workspaces_events.go @@ -18,185 +18,186 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchEvent(WorkspaceSid string, Sid string) (*TaskrouterV1Event, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Events/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchEvent(WorkspaceSid string, Sid string, ) (*TaskrouterV1Event, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Events/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &TaskrouterV1Event{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1Event{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEvent' type ListEventParams struct { - // Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // The type of Events to read. Returns only Events of the type specified. - EventType *string `json:"EventType,omitempty"` - // The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted. - Minutes *int `json:"Minutes,omitempty"` - // The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation. - ReservationSid *string `json:"ReservationSid,omitempty"` - // Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted. - StartDate *time.Time `json:"StartDate,omitempty"` - // The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue. - TaskQueueSid *string `json:"TaskQueueSid,omitempty"` - // The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task. - TaskSid *string `json:"TaskSid,omitempty"` - // The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker. - WorkerSid *string `json:"WorkerSid,omitempty"` - // The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow. - WorkflowSid *string `json:"WorkflowSid,omitempty"` - // The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel. - TaskChannel *string `json:"TaskChannel,omitempty"` - // The SID of the Event resource to read. - Sid *string `json:"Sid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // The type of Events to read. Returns only Events of the type specified. + EventType *string `json:"EventType,omitempty"` + // The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted. + Minutes *int `json:"Minutes,omitempty"` + // The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation. + ReservationSid *string `json:"ReservationSid,omitempty"` + // Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted. + StartDate *time.Time `json:"StartDate,omitempty"` + // The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue. + TaskQueueSid *string `json:"TaskQueueSid,omitempty"` + // The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task. + TaskSid *string `json:"TaskSid,omitempty"` + // The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker. + WorkerSid *string `json:"WorkerSid,omitempty"` + // The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow. + WorkflowSid *string `json:"WorkflowSid,omitempty"` + // The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel. + TaskChannel *string `json:"TaskChannel,omitempty"` + // The SID of the Event resource to read. + Sid *string `json:"Sid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEventParams) SetEndDate(EndDate time.Time) *ListEventParams { - params.EndDate = &EndDate - return params +func (params *ListEventParams) SetEndDate(EndDate time.Time) (*ListEventParams){ + params.EndDate = &EndDate + return params } -func (params *ListEventParams) SetEventType(EventType string) *ListEventParams { - params.EventType = &EventType - return params +func (params *ListEventParams) SetEventType(EventType string) (*ListEventParams){ + params.EventType = &EventType + return params } -func (params *ListEventParams) SetMinutes(Minutes int) *ListEventParams { - params.Minutes = &Minutes - return params +func (params *ListEventParams) SetMinutes(Minutes int) (*ListEventParams){ + params.Minutes = &Minutes + return params } -func (params *ListEventParams) SetReservationSid(ReservationSid string) *ListEventParams { - params.ReservationSid = &ReservationSid - return params +func (params *ListEventParams) SetReservationSid(ReservationSid string) (*ListEventParams){ + params.ReservationSid = &ReservationSid + return params } -func (params *ListEventParams) SetStartDate(StartDate time.Time) *ListEventParams { - params.StartDate = &StartDate - return params +func (params *ListEventParams) SetStartDate(StartDate time.Time) (*ListEventParams){ + params.StartDate = &StartDate + return params } -func (params *ListEventParams) SetTaskQueueSid(TaskQueueSid string) *ListEventParams { - params.TaskQueueSid = &TaskQueueSid - return params +func (params *ListEventParams) SetTaskQueueSid(TaskQueueSid string) (*ListEventParams){ + params.TaskQueueSid = &TaskQueueSid + return params } -func (params *ListEventParams) SetTaskSid(TaskSid string) *ListEventParams { - params.TaskSid = &TaskSid - return params +func (params *ListEventParams) SetTaskSid(TaskSid string) (*ListEventParams){ + params.TaskSid = &TaskSid + return params } -func (params *ListEventParams) SetWorkerSid(WorkerSid string) *ListEventParams { - params.WorkerSid = &WorkerSid - return params +func (params *ListEventParams) SetWorkerSid(WorkerSid string) (*ListEventParams){ + params.WorkerSid = &WorkerSid + return params } -func (params *ListEventParams) SetWorkflowSid(WorkflowSid string) *ListEventParams { - params.WorkflowSid = &WorkflowSid - return params +func (params *ListEventParams) SetWorkflowSid(WorkflowSid string) (*ListEventParams){ + params.WorkflowSid = &WorkflowSid + return params } -func (params *ListEventParams) SetTaskChannel(TaskChannel string) *ListEventParams { - params.TaskChannel = &TaskChannel - return params +func (params *ListEventParams) SetTaskChannel(TaskChannel string) (*ListEventParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *ListEventParams) SetSid(Sid string) *ListEventParams { - params.Sid = &Sid - return params +func (params *ListEventParams) SetSid(Sid string) (*ListEventParams){ + params.Sid = &Sid + return params } -func (params *ListEventParams) SetPageSize(PageSize int) *ListEventParams { - params.PageSize = &PageSize - return params +func (params *ListEventParams) SetPageSize(PageSize int) (*ListEventParams){ + params.PageSize = &PageSize + return params } -func (params *ListEventParams) SetLimit(Limit int) *ListEventParams { - params.Limit = &Limit - return params +func (params *ListEventParams) SetLimit(Limit int) (*ListEventParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Event records from the API. Request is executed immediately. func (c *ApiService) PageEvent(WorkspaceSid string, params *ListEventParams, pageToken, pageNumber string) (*ListEventResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Events" - - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.EventType != nil { - data.Set("EventType", *params.EventType) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.ReservationSid != nil { - data.Set("ReservationSid", *params.ReservationSid) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskQueueSid != nil { - data.Set("TaskQueueSid", *params.TaskQueueSid) - } - if params != nil && params.TaskSid != nil { - data.Set("TaskSid", *params.TaskSid) - } - if params != nil && params.WorkerSid != nil { - data.Set("WorkerSid", *params.WorkerSid) - } - if params != nil && params.WorkflowSid != nil { - data.Set("WorkflowSid", *params.WorkflowSid) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.Sid != nil { - data.Set("Sid", *params.Sid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Events" + + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.EventType != nil { + data.Set("EventType", *params.EventType) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.ReservationSid != nil { + data.Set("ReservationSid", *params.ReservationSid) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskQueueSid != nil { + data.Set("TaskQueueSid", *params.TaskQueueSid) + } + if params != nil && params.TaskSid != nil { + data.Set("TaskSid", *params.TaskSid) + } + if params != nil && params.WorkerSid != nil { + data.Set("WorkerSid", *params.WorkerSid) + } + if params != nil && params.WorkflowSid != nil { + data.Set("WorkflowSid", *params.WorkflowSid) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.Sid != nil { + data.Set("Sid", *params.Sid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Event records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -237,6 +238,7 @@ func (c *ApiService) StreamEvent(WorkspaceSid string, params *ListEventParams) ( return recordChannel, errorChannel } + func (c *ApiService) streamEvent(response *ListEventResponse, params *ListEventParams, recordChannel chan TaskrouterV1Event, errorChannel chan error) { curRecord := 1 @@ -268,19 +270,20 @@ func (c *ApiService) streamEvent(response *ListEventResponse, params *ListEventP } func (c *ApiService) getNextListEventResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEventResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEventResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/taskrouter/v1/workspaces_real_time_statistics.go b/rest/taskrouter/v1/workspaces_real_time_statistics.go index 75593edef..19f60acf5 100644 --- a/rest/taskrouter/v1/workspaces_real_time_statistics.go +++ b/rest/taskrouter/v1/workspaces_real_time_statistics.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkspaceRealTimeStatistics' type FetchWorkspaceRealTimeStatisticsParams struct { - // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchWorkspaceRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkspaceRealTimeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkspaceRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkspaceRealTimeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchWorkspaceRealTimeStatistics(WorkspaceSid string, params *FetchWorkspaceRealTimeStatisticsParams) (*TaskrouterV1WorkspaceRealTimeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/RealTimeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/RealTimeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkspaceRealTimeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkspaceRealTimeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_statistics.go b/rest/taskrouter/v1/workspaces_statistics.go index 1d92d7d28..e636596be 100644 --- a/rest/taskrouter/v1/workspaces_statistics.go +++ b/rest/taskrouter/v1/workspaces_statistics.go @@ -18,80 +18,82 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkspaceStatistics' type FetchWorkspaceStatisticsParams struct { - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` } -func (params *FetchWorkspaceStatisticsParams) SetMinutes(Minutes int) *FetchWorkspaceStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkspaceStatisticsParams) SetMinutes(Minutes int) (*FetchWorkspaceStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkspaceStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkspaceStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkspaceStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkspaceStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkspaceStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkspaceStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkspaceStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkspaceStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkspaceStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkspaceStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkspaceStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkspaceStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *FetchWorkspaceStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *FetchWorkspaceStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *FetchWorkspaceStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*FetchWorkspaceStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -// +// func (c *ApiService) FetchWorkspaceStatistics(WorkspaceSid string, params *FetchWorkspaceStatisticsParams) (*TaskrouterV1WorkspaceStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Statistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Statistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkspaceStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkspaceStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_task_channels.go b/rest/taskrouter/v1/workspaces_task_channels.go index ab0035c54..4c56e21bd 100644 --- a/rest/taskrouter/v1/workspaces_task_channels.go +++ b/rest/taskrouter/v1/workspaces_task_channels.go @@ -18,160 +18,165 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTaskChannel' type CreateTaskChannelParams struct { - // A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. - UniqueName *string `json:"UniqueName,omitempty"` - // Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. - ChannelOptimizedRouting *bool `json:"ChannelOptimizedRouting,omitempty"` + // A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. + UniqueName *string `json:"UniqueName,omitempty"` + // Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. + ChannelOptimizedRouting *bool `json:"ChannelOptimizedRouting,omitempty"` } -func (params *CreateTaskChannelParams) SetFriendlyName(FriendlyName string) *CreateTaskChannelParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateTaskChannelParams) SetFriendlyName(FriendlyName string) (*CreateTaskChannelParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateTaskChannelParams) SetUniqueName(UniqueName string) *CreateTaskChannelParams { - params.UniqueName = &UniqueName - return params +func (params *CreateTaskChannelParams) SetUniqueName(UniqueName string) (*CreateTaskChannelParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateTaskChannelParams) SetChannelOptimizedRouting(ChannelOptimizedRouting bool) *CreateTaskChannelParams { - params.ChannelOptimizedRouting = &ChannelOptimizedRouting - return params +func (params *CreateTaskChannelParams) SetChannelOptimizedRouting(ChannelOptimizedRouting bool) (*CreateTaskChannelParams){ + params.ChannelOptimizedRouting = &ChannelOptimizedRouting + return params } -// +// func (c *ApiService) CreateTaskChannel(WorkspaceSid string, params *CreateTaskChannelParams) (*TaskrouterV1TaskChannel, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.ChannelOptimizedRouting != nil { - data.Set("ChannelOptimizedRouting", fmt.Sprint(*params.ChannelOptimizedRouting)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.ChannelOptimizedRouting != nil { + data.Set("ChannelOptimizedRouting", fmt.Sprint(*params.ChannelOptimizedRouting)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1TaskChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &TaskrouterV1TaskChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// -func (c *ApiService) DeleteTaskChannel(WorkspaceSid string, Sid string) error { - path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteTaskChannel(WorkspaceSid string, Sid string, ) (error) { + path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchTaskChannel(WorkspaceSid string, Sid string) (*TaskrouterV1TaskChannel, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchTaskChannel(WorkspaceSid string, Sid string, ) (*TaskrouterV1TaskChannel, error) { + path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TaskrouterV1TaskChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1TaskChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTaskChannel' type ListTaskChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTaskChannelParams) SetPageSize(PageSize int) *ListTaskChannelParams { - params.PageSize = &PageSize - return params +func (params *ListTaskChannelParams) SetPageSize(PageSize int) (*ListTaskChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListTaskChannelParams) SetLimit(Limit int) *ListTaskChannelParams { - params.Limit = &Limit - return params +func (params *ListTaskChannelParams) SetLimit(Limit int) (*ListTaskChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TaskChannel records from the API. Request is executed immediately. func (c *ApiService) PageTaskChannel(WorkspaceSid string, params *ListTaskChannelParams, pageToken, pageNumber string) (*ListTaskChannelResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels" + path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTaskChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTaskChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists TaskChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -212,6 +217,7 @@ func (c *ApiService) StreamTaskChannel(WorkspaceSid string, params *ListTaskChan return recordChannel, errorChannel } + func (c *ApiService) streamTaskChannel(response *ListTaskChannelResponse, params *ListTaskChannelParams, recordChannel chan TaskrouterV1TaskChannel, errorChannel chan error) { curRecord := 1 @@ -243,67 +249,69 @@ func (c *ApiService) streamTaskChannel(response *ListTaskChannelResponse, params } func (c *ApiService) getNextListTaskChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTaskChannel' type UpdateTaskChannelParams struct { - // A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether the TaskChannel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. - ChannelOptimizedRouting *bool `json:"ChannelOptimizedRouting,omitempty"` + // A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether the TaskChannel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. + ChannelOptimizedRouting *bool `json:"ChannelOptimizedRouting,omitempty"` } -func (params *UpdateTaskChannelParams) SetFriendlyName(FriendlyName string) *UpdateTaskChannelParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateTaskChannelParams) SetFriendlyName(FriendlyName string) (*UpdateTaskChannelParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateTaskChannelParams) SetChannelOptimizedRouting(ChannelOptimizedRouting bool) *UpdateTaskChannelParams { - params.ChannelOptimizedRouting = &ChannelOptimizedRouting - return params +func (params *UpdateTaskChannelParams) SetChannelOptimizedRouting(ChannelOptimizedRouting bool) (*UpdateTaskChannelParams){ + params.ChannelOptimizedRouting = &ChannelOptimizedRouting + return params } -// +// func (c *ApiService) UpdateTaskChannel(WorkspaceSid string, Sid string, params *UpdateTaskChannelParams) (*TaskrouterV1TaskChannel, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/TaskChannels/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ChannelOptimizedRouting != nil { - data.Set("ChannelOptimizedRouting", fmt.Sprint(*params.ChannelOptimizedRouting)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ChannelOptimizedRouting != nil { + data.Set("ChannelOptimizedRouting", fmt.Sprint(*params.ChannelOptimizedRouting)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1TaskChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TaskrouterV1TaskChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_task_queues.go b/rest/taskrouter/v1/workspaces_task_queues.go index 9bdfc7224..34b6215a6 100644 --- a/rest/taskrouter/v1/workspaces_task_queues.go +++ b/rest/taskrouter/v1/workspaces_task_queues.go @@ -18,223 +18,228 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTaskQueue' type CreateTaskQueueParams struct { - // A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // A string that describes the Worker selection criteria for any Tasks that enter the TaskQueue. For example, `'\\\"language\\\" == \\\"spanish\\\"'`. The default value is `1==1`. If this value is empty, Tasks will wait in the TaskQueue until they are deleted or moved to another TaskQueue. For more information about Worker selection, see [Describing Worker selection criteria](https://www.twilio.com/docs/taskrouter/api/taskqueues#target-workers). - TargetWorkers *string `json:"TargetWorkers,omitempty"` - // The maximum number of Workers to reserve for the assignment of a Task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. - MaxReservedWorkers *int `json:"MaxReservedWorkers,omitempty"` - // - TaskOrder *string `json:"TaskOrder,omitempty"` - // The SID of the Activity to assign Workers when a task is reserved for them. - ReservationActivitySid *string `json:"ReservationActivitySid,omitempty"` - // The SID of the Activity to assign Workers when a task is assigned to them. - AssignmentActivitySid *string `json:"AssignmentActivitySid,omitempty"` + // A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // A string that describes the Worker selection criteria for any Tasks that enter the TaskQueue. For example, `'\\\"language\\\" == \\\"spanish\\\"'`. The default value is `1==1`. If this value is empty, Tasks will wait in the TaskQueue until they are deleted or moved to another TaskQueue. For more information about Worker selection, see [Describing Worker selection criteria](https://www.twilio.com/docs/taskrouter/api/taskqueues#target-workers). + TargetWorkers *string `json:"TargetWorkers,omitempty"` + // The maximum number of Workers to reserve for the assignment of a Task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. + MaxReservedWorkers *int `json:"MaxReservedWorkers,omitempty"` + // + TaskOrder *string `json:"TaskOrder,omitempty"` + // The SID of the Activity to assign Workers when a task is reserved for them. + ReservationActivitySid *string `json:"ReservationActivitySid,omitempty"` + // The SID of the Activity to assign Workers when a task is assigned to them. + AssignmentActivitySid *string `json:"AssignmentActivitySid,omitempty"` } -func (params *CreateTaskQueueParams) SetFriendlyName(FriendlyName string) *CreateTaskQueueParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateTaskQueueParams) SetFriendlyName(FriendlyName string) (*CreateTaskQueueParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateTaskQueueParams) SetTargetWorkers(TargetWorkers string) *CreateTaskQueueParams { - params.TargetWorkers = &TargetWorkers - return params +func (params *CreateTaskQueueParams) SetTargetWorkers(TargetWorkers string) (*CreateTaskQueueParams){ + params.TargetWorkers = &TargetWorkers + return params } -func (params *CreateTaskQueueParams) SetMaxReservedWorkers(MaxReservedWorkers int) *CreateTaskQueueParams { - params.MaxReservedWorkers = &MaxReservedWorkers - return params +func (params *CreateTaskQueueParams) SetMaxReservedWorkers(MaxReservedWorkers int) (*CreateTaskQueueParams){ + params.MaxReservedWorkers = &MaxReservedWorkers + return params } -func (params *CreateTaskQueueParams) SetTaskOrder(TaskOrder string) *CreateTaskQueueParams { - params.TaskOrder = &TaskOrder - return params +func (params *CreateTaskQueueParams) SetTaskOrder(TaskOrder string) (*CreateTaskQueueParams){ + params.TaskOrder = &TaskOrder + return params } -func (params *CreateTaskQueueParams) SetReservationActivitySid(ReservationActivitySid string) *CreateTaskQueueParams { - params.ReservationActivitySid = &ReservationActivitySid - return params +func (params *CreateTaskQueueParams) SetReservationActivitySid(ReservationActivitySid string) (*CreateTaskQueueParams){ + params.ReservationActivitySid = &ReservationActivitySid + return params } -func (params *CreateTaskQueueParams) SetAssignmentActivitySid(AssignmentActivitySid string) *CreateTaskQueueParams { - params.AssignmentActivitySid = &AssignmentActivitySid - return params +func (params *CreateTaskQueueParams) SetAssignmentActivitySid(AssignmentActivitySid string) (*CreateTaskQueueParams){ + params.AssignmentActivitySid = &AssignmentActivitySid + return params } -// +// func (c *ApiService) CreateTaskQueue(WorkspaceSid string, params *CreateTaskQueueParams) (*TaskrouterV1TaskQueue, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.TargetWorkers != nil { - data.Set("TargetWorkers", *params.TargetWorkers) - } - if params != nil && params.MaxReservedWorkers != nil { - data.Set("MaxReservedWorkers", fmt.Sprint(*params.MaxReservedWorkers)) - } - if params != nil && params.TaskOrder != nil { - data.Set("TaskOrder", *params.TaskOrder) - } - if params != nil && params.ReservationActivitySid != nil { - data.Set("ReservationActivitySid", *params.ReservationActivitySid) - } - if params != nil && params.AssignmentActivitySid != nil { - data.Set("AssignmentActivitySid", *params.AssignmentActivitySid) - } + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.TargetWorkers != nil { + data.Set("TargetWorkers", *params.TargetWorkers) + } + if params != nil && params.MaxReservedWorkers != nil { + data.Set("MaxReservedWorkers", fmt.Sprint(*params.MaxReservedWorkers)) + } + if params != nil && params.TaskOrder != nil { + data.Set("TaskOrder", *params.TaskOrder) + } + if params != nil && params.ReservationActivitySid != nil { + data.Set("ReservationActivitySid", *params.ReservationActivitySid) + } + if params != nil && params.AssignmentActivitySid != nil { + data.Set("AssignmentActivitySid", *params.AssignmentActivitySid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1TaskQueue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteTaskQueue(WorkspaceSid string, Sid string, ) (error) { + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &TaskrouterV1TaskQueue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteTaskQueue(WorkspaceSid string, Sid string) error { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchTaskQueue(WorkspaceSid string, Sid string, ) (*TaskrouterV1TaskQueue, error) { + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchTaskQueue(WorkspaceSid string, Sid string) (*TaskrouterV1TaskQueue, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1TaskQueue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1TaskQueue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTaskQueue' type ListTaskQueueParams struct { - // The `friendly_name` of the TaskQueue resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. - EvaluateWorkerAttributes *string `json:"EvaluateWorkerAttributes,omitempty"` - // The SID of the Worker with the TaskQueue resources to read. - WorkerSid *string `json:"WorkerSid,omitempty"` - // Sorting parameter for TaskQueues - Ordering *string `json:"Ordering,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The `friendly_name` of the TaskQueue resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. + EvaluateWorkerAttributes *string `json:"EvaluateWorkerAttributes,omitempty"` + // The SID of the Worker with the TaskQueue resources to read. + WorkerSid *string `json:"WorkerSid,omitempty"` + // Sorting parameter for TaskQueues + Ordering *string `json:"Ordering,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTaskQueueParams) SetFriendlyName(FriendlyName string) *ListTaskQueueParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListTaskQueueParams) SetFriendlyName(FriendlyName string) (*ListTaskQueueParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListTaskQueueParams) SetEvaluateWorkerAttributes(EvaluateWorkerAttributes string) *ListTaskQueueParams { - params.EvaluateWorkerAttributes = &EvaluateWorkerAttributes - return params +func (params *ListTaskQueueParams) SetEvaluateWorkerAttributes(EvaluateWorkerAttributes string) (*ListTaskQueueParams){ + params.EvaluateWorkerAttributes = &EvaluateWorkerAttributes + return params } -func (params *ListTaskQueueParams) SetWorkerSid(WorkerSid string) *ListTaskQueueParams { - params.WorkerSid = &WorkerSid - return params +func (params *ListTaskQueueParams) SetWorkerSid(WorkerSid string) (*ListTaskQueueParams){ + params.WorkerSid = &WorkerSid + return params } -func (params *ListTaskQueueParams) SetOrdering(Ordering string) *ListTaskQueueParams { - params.Ordering = &Ordering - return params +func (params *ListTaskQueueParams) SetOrdering(Ordering string) (*ListTaskQueueParams){ + params.Ordering = &Ordering + return params } -func (params *ListTaskQueueParams) SetPageSize(PageSize int) *ListTaskQueueParams { - params.PageSize = &PageSize - return params +func (params *ListTaskQueueParams) SetPageSize(PageSize int) (*ListTaskQueueParams){ + params.PageSize = &PageSize + return params } -func (params *ListTaskQueueParams) SetLimit(Limit int) *ListTaskQueueParams { - params.Limit = &Limit - return params +func (params *ListTaskQueueParams) SetLimit(Limit int) (*ListTaskQueueParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TaskQueue records from the API. Request is executed immediately. func (c *ApiService) PageTaskQueue(WorkspaceSid string, params *ListTaskQueueParams, pageToken, pageNumber string) (*ListTaskQueueResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues" - - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.EvaluateWorkerAttributes != nil { - data.Set("EvaluateWorkerAttributes", *params.EvaluateWorkerAttributes) - } - if params != nil && params.WorkerSid != nil { - data.Set("WorkerSid", *params.WorkerSid) - } - if params != nil && params.Ordering != nil { - data.Set("Ordering", *params.Ordering) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskQueueResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues" + + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.EvaluateWorkerAttributes != nil { + data.Set("EvaluateWorkerAttributes", *params.EvaluateWorkerAttributes) + } + if params != nil && params.WorkerSid != nil { + data.Set("WorkerSid", *params.WorkerSid) + } + if params != nil && params.Ordering != nil { + data.Set("Ordering", *params.Ordering) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskQueueResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists TaskQueue records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -275,6 +280,7 @@ func (c *ApiService) StreamTaskQueue(WorkspaceSid string, params *ListTaskQueueP return recordChannel, errorChannel } + func (c *ApiService) streamTaskQueue(response *ListTaskQueueResponse, params *ListTaskQueueParams, recordChannel chan TaskrouterV1TaskQueue, errorChannel chan error) { curRecord := 1 @@ -306,103 +312,105 @@ func (c *ApiService) streamTaskQueue(response *ListTaskQueueResponse, params *Li } func (c *ApiService) getNextListTaskQueueResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskQueueResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskQueueResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTaskQueue' type UpdateTaskQueueParams struct { - // A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example '\\\"language\\\" == \\\"spanish\\\"' If no TargetWorkers parameter is provided, Tasks will wait in the queue until they are either deleted or moved to another queue. Additional examples on how to describing Worker selection criteria below. - TargetWorkers *string `json:"TargetWorkers,omitempty"` - // The SID of the Activity to assign Workers when a task is reserved for them. - ReservationActivitySid *string `json:"ReservationActivitySid,omitempty"` - // The SID of the Activity to assign Workers when a task is assigned for them. - AssignmentActivitySid *string `json:"AssignmentActivitySid,omitempty"` - // The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. - MaxReservedWorkers *int `json:"MaxReservedWorkers,omitempty"` - // - TaskOrder *string `json:"TaskOrder,omitempty"` + // A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example '\\\"language\\\" == \\\"spanish\\\"' If no TargetWorkers parameter is provided, Tasks will wait in the queue until they are either deleted or moved to another queue. Additional examples on how to describing Worker selection criteria below. + TargetWorkers *string `json:"TargetWorkers,omitempty"` + // The SID of the Activity to assign Workers when a task is reserved for them. + ReservationActivitySid *string `json:"ReservationActivitySid,omitempty"` + // The SID of the Activity to assign Workers when a task is assigned for them. + AssignmentActivitySid *string `json:"AssignmentActivitySid,omitempty"` + // The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. + MaxReservedWorkers *int `json:"MaxReservedWorkers,omitempty"` + // + TaskOrder *string `json:"TaskOrder,omitempty"` } -func (params *UpdateTaskQueueParams) SetFriendlyName(FriendlyName string) *UpdateTaskQueueParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateTaskQueueParams) SetFriendlyName(FriendlyName string) (*UpdateTaskQueueParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateTaskQueueParams) SetTargetWorkers(TargetWorkers string) *UpdateTaskQueueParams { - params.TargetWorkers = &TargetWorkers - return params +func (params *UpdateTaskQueueParams) SetTargetWorkers(TargetWorkers string) (*UpdateTaskQueueParams){ + params.TargetWorkers = &TargetWorkers + return params } -func (params *UpdateTaskQueueParams) SetReservationActivitySid(ReservationActivitySid string) *UpdateTaskQueueParams { - params.ReservationActivitySid = &ReservationActivitySid - return params +func (params *UpdateTaskQueueParams) SetReservationActivitySid(ReservationActivitySid string) (*UpdateTaskQueueParams){ + params.ReservationActivitySid = &ReservationActivitySid + return params } -func (params *UpdateTaskQueueParams) SetAssignmentActivitySid(AssignmentActivitySid string) *UpdateTaskQueueParams { - params.AssignmentActivitySid = &AssignmentActivitySid - return params +func (params *UpdateTaskQueueParams) SetAssignmentActivitySid(AssignmentActivitySid string) (*UpdateTaskQueueParams){ + params.AssignmentActivitySid = &AssignmentActivitySid + return params } -func (params *UpdateTaskQueueParams) SetMaxReservedWorkers(MaxReservedWorkers int) *UpdateTaskQueueParams { - params.MaxReservedWorkers = &MaxReservedWorkers - return params +func (params *UpdateTaskQueueParams) SetMaxReservedWorkers(MaxReservedWorkers int) (*UpdateTaskQueueParams){ + params.MaxReservedWorkers = &MaxReservedWorkers + return params } -func (params *UpdateTaskQueueParams) SetTaskOrder(TaskOrder string) *UpdateTaskQueueParams { - params.TaskOrder = &TaskOrder - return params +func (params *UpdateTaskQueueParams) SetTaskOrder(TaskOrder string) (*UpdateTaskQueueParams){ + params.TaskOrder = &TaskOrder + return params } -// +// func (c *ApiService) UpdateTaskQueue(WorkspaceSid string, Sid string, params *UpdateTaskQueueParams) (*TaskrouterV1TaskQueue, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.TargetWorkers != nil { - data.Set("TargetWorkers", *params.TargetWorkers) - } - if params != nil && params.ReservationActivitySid != nil { - data.Set("ReservationActivitySid", *params.ReservationActivitySid) - } - if params != nil && params.AssignmentActivitySid != nil { - data.Set("AssignmentActivitySid", *params.AssignmentActivitySid) - } - if params != nil && params.MaxReservedWorkers != nil { - data.Set("MaxReservedWorkers", fmt.Sprint(*params.MaxReservedWorkers)) - } - if params != nil && params.TaskOrder != nil { - data.Set("TaskOrder", *params.TaskOrder) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TaskrouterV1TaskQueue{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.TargetWorkers != nil { + data.Set("TargetWorkers", *params.TargetWorkers) + } + if params != nil && params.ReservationActivitySid != nil { + data.Set("ReservationActivitySid", *params.ReservationActivitySid) + } + if params != nil && params.AssignmentActivitySid != nil { + data.Set("AssignmentActivitySid", *params.AssignmentActivitySid) + } + if params != nil && params.MaxReservedWorkers != nil { + data.Set("MaxReservedWorkers", fmt.Sprint(*params.MaxReservedWorkers)) + } + if params != nil && params.TaskOrder != nil { + data.Set("TaskOrder", *params.TaskOrder) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1TaskQueue{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_task_queues_cumulative_statistics.go b/rest/taskrouter/v1/workspaces_task_queues_cumulative_statistics.go index 2216de575..7bf9529c1 100644 --- a/rest/taskrouter/v1/workspaces_task_queues_cumulative_statistics.go +++ b/rest/taskrouter/v1/workspaces_task_queues_cumulative_statistics.go @@ -18,81 +18,83 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchTaskQueueCumulativeStatistics' type FetchTaskQueueCumulativeStatisticsParams struct { - // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics since this many minutes in the past. The default is 15 minutes. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. TaskRouter will calculate statistics on up to 10,000 Tasks/Reservations for any given threshold. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics since this many minutes in the past. The default is 15 minutes. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. TaskRouter will calculate statistics on up to 10,000 Tasks/Reservations for any given threshold. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` } -func (params *FetchTaskQueueCumulativeStatisticsParams) SetEndDate(EndDate time.Time) *FetchTaskQueueCumulativeStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchTaskQueueCumulativeStatisticsParams) SetEndDate(EndDate time.Time) (*FetchTaskQueueCumulativeStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchTaskQueueCumulativeStatisticsParams) SetMinutes(Minutes int) *FetchTaskQueueCumulativeStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchTaskQueueCumulativeStatisticsParams) SetMinutes(Minutes int) (*FetchTaskQueueCumulativeStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchTaskQueueCumulativeStatisticsParams) SetStartDate(StartDate time.Time) *FetchTaskQueueCumulativeStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchTaskQueueCumulativeStatisticsParams) SetStartDate(StartDate time.Time) (*FetchTaskQueueCumulativeStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchTaskQueueCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchTaskQueueCumulativeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchTaskQueueCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchTaskQueueCumulativeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *FetchTaskQueueCumulativeStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *FetchTaskQueueCumulativeStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *FetchTaskQueueCumulativeStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*FetchTaskQueueCumulativeStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -// +// func (c *ApiService) FetchTaskQueueCumulativeStatistics(WorkspaceSid string, TaskQueueSid string, params *FetchTaskQueueCumulativeStatisticsParams) (*TaskrouterV1TaskQueueCumulativeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/CumulativeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"TaskQueueSid"+"}", TaskQueueSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/CumulativeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"TaskQueueSid"+"}", TaskQueueSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1TaskQueueCumulativeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1TaskQueueCumulativeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_task_queues_real_time_statistics.go b/rest/taskrouter/v1/workspaces_task_queues_real_time_statistics.go index b1605a619..50cdd7ac7 100644 --- a/rest/taskrouter/v1/workspaces_task_queues_real_time_statistics.go +++ b/rest/taskrouter/v1/workspaces_task_queues_real_time_statistics.go @@ -16,45 +16,74 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + +// Fetch a Task Queue Real Time Statistics in bulk for the array of TaskQueue SIDs, support upto 50 in a request. +func (c *ApiService) CreateTaskQueueBulkRealTimeStatistics(WorkspaceSid string, ) (*TaskrouterV1TaskQueueBulkRealTimeStatistics, error) { + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/RealTimeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1TaskQueueBulkRealTimeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + // Optional parameters for the method 'FetchTaskQueueRealTimeStatistics' type FetchTaskQueueRealTimeStatisticsParams struct { - // The TaskChannel for which to fetch statistics. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // The TaskChannel for which to fetch statistics. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchTaskQueueRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchTaskQueueRealTimeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchTaskQueueRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchTaskQueueRealTimeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchTaskQueueRealTimeStatistics(WorkspaceSid string, TaskQueueSid string, params *FetchTaskQueueRealTimeStatisticsParams) (*TaskrouterV1TaskQueueRealTimeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/RealTimeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"TaskQueueSid"+"}", TaskQueueSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/RealTimeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"TaskQueueSid"+"}", TaskQueueSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1TaskQueueRealTimeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1TaskQueueRealTimeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_task_queues_statistics.go b/rest/taskrouter/v1/workspaces_task_queues_statistics.go index c5ea20fd7..abe27c7b4 100644 --- a/rest/taskrouter/v1/workspaces_task_queues_statistics.go +++ b/rest/taskrouter/v1/workspaces_task_queues_statistics.go @@ -18,191 +18,191 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchTaskQueueStatistics' type FetchTaskQueueStatisticsParams struct { - // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics since this many minutes in the past. The default is 15 minutes. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate real-time and cumulative statistics for the specified TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics since this many minutes in the past. The default is 15 minutes. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate real-time and cumulative statistics for the specified TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` } -func (params *FetchTaskQueueStatisticsParams) SetEndDate(EndDate time.Time) *FetchTaskQueueStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchTaskQueueStatisticsParams) SetEndDate(EndDate time.Time) (*FetchTaskQueueStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchTaskQueueStatisticsParams) SetMinutes(Minutes int) *FetchTaskQueueStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchTaskQueueStatisticsParams) SetMinutes(Minutes int) (*FetchTaskQueueStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchTaskQueueStatisticsParams) SetStartDate(StartDate time.Time) *FetchTaskQueueStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchTaskQueueStatisticsParams) SetStartDate(StartDate time.Time) (*FetchTaskQueueStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchTaskQueueStatisticsParams) SetTaskChannel(TaskChannel string) *FetchTaskQueueStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchTaskQueueStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchTaskQueueStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *FetchTaskQueueStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *FetchTaskQueueStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *FetchTaskQueueStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*FetchTaskQueueStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -// +// func (c *ApiService) FetchTaskQueueStatistics(WorkspaceSid string, TaskQueueSid string, params *FetchTaskQueueStatisticsParams) (*TaskrouterV1TaskQueueStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/Statistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"TaskQueueSid"+"}", TaskQueueSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TaskrouterV1TaskQueueStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/{TaskQueueSid}/Statistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"TaskQueueSid"+"}", TaskQueueSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1TaskQueueStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTaskQueuesStatistics' type ListTaskQueuesStatisticsParams struct { - // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // The `friendly_name` of the TaskQueue statistics to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Only calculate statistics since this many minutes in the past. The default is 15 minutes. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // The `friendly_name` of the TaskQueue statistics to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Only calculate statistics since this many minutes in the past. The default is 15 minutes. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTaskQueuesStatisticsParams) SetEndDate(EndDate time.Time) *ListTaskQueuesStatisticsParams { - params.EndDate = &EndDate - return params +func (params *ListTaskQueuesStatisticsParams) SetEndDate(EndDate time.Time) (*ListTaskQueuesStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *ListTaskQueuesStatisticsParams) SetFriendlyName(FriendlyName string) *ListTaskQueuesStatisticsParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListTaskQueuesStatisticsParams) SetFriendlyName(FriendlyName string) (*ListTaskQueuesStatisticsParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListTaskQueuesStatisticsParams) SetMinutes(Minutes int) *ListTaskQueuesStatisticsParams { - params.Minutes = &Minutes - return params +func (params *ListTaskQueuesStatisticsParams) SetMinutes(Minutes int) (*ListTaskQueuesStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *ListTaskQueuesStatisticsParams) SetStartDate(StartDate time.Time) *ListTaskQueuesStatisticsParams { - params.StartDate = &StartDate - return params +func (params *ListTaskQueuesStatisticsParams) SetStartDate(StartDate time.Time) (*ListTaskQueuesStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *ListTaskQueuesStatisticsParams) SetTaskChannel(TaskChannel string) *ListTaskQueuesStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *ListTaskQueuesStatisticsParams) SetTaskChannel(TaskChannel string) (*ListTaskQueuesStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *ListTaskQueuesStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *ListTaskQueuesStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *ListTaskQueuesStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*ListTaskQueuesStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -func (params *ListTaskQueuesStatisticsParams) SetPageSize(PageSize int) *ListTaskQueuesStatisticsParams { - params.PageSize = &PageSize - return params +func (params *ListTaskQueuesStatisticsParams) SetPageSize(PageSize int) (*ListTaskQueuesStatisticsParams){ + params.PageSize = &PageSize + return params } -func (params *ListTaskQueuesStatisticsParams) SetLimit(Limit int) *ListTaskQueuesStatisticsParams { - params.Limit = &Limit - return params +func (params *ListTaskQueuesStatisticsParams) SetLimit(Limit int) (*ListTaskQueuesStatisticsParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TaskQueuesStatistics records from the API. Request is executed immediately. func (c *ApiService) PageTaskQueuesStatistics(WorkspaceSid string, params *ListTaskQueuesStatisticsParams, pageToken, pageNumber string) (*ListTaskQueuesStatisticsResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/Statistics" - - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskQueuesStatisticsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/TaskQueues/Statistics" + + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskQueuesStatisticsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists TaskQueuesStatistics records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +243,7 @@ func (c *ApiService) StreamTaskQueuesStatistics(WorkspaceSid string, params *Lis return recordChannel, errorChannel } + func (c *ApiService) streamTaskQueuesStatistics(response *ListTaskQueuesStatisticsResponse, params *ListTaskQueuesStatisticsParams, recordChannel chan TaskrouterV1TaskQueuesStatistics, errorChannel chan error) { curRecord := 1 @@ -274,19 +275,20 @@ func (c *ApiService) streamTaskQueuesStatistics(response *ListTaskQueuesStatisti } func (c *ApiService) getNextListTaskQueuesStatisticsResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskQueuesStatisticsResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskQueuesStatisticsResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/taskrouter/v1/workspaces_tasks.go b/rest/taskrouter/v1/workspaces_tasks.go index 8c74b3b54..fe9cbfa54 100644 --- a/rest/taskrouter/v1/workspaces_tasks.go +++ b/rest/taskrouter/v1/workspaces_tasks.go @@ -18,286 +18,280 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTask' type CreateTaskParams struct { - // The amount of time in seconds the new task can live before being assigned. Can be up to a maximum of 2 weeks (1,209,600 seconds). The default value is 24 hours (86,400 seconds). On timeout, the `task.canceled` event will fire with description `Task TTL Exceeded`. - Timeout *int `json:"Timeout,omitempty"` - // The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647). - Priority *int `json:"Priority,omitempty"` - // When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. - WorkflowSid *string `json:"WorkflowSid,omitempty"` - // A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. - Attributes *string `json:"Attributes,omitempty"` - // The virtual start time to assign the new task and override the default. When supplied, the new task will have this virtual start time. When not supplied, the new task will have the virtual start time equal to `date_created`. Value can't be in the future. - VirtualStartTime *time.Time `json:"VirtualStartTime,omitempty"` -} - -func (params *CreateTaskParams) SetTimeout(Timeout int) *CreateTaskParams { - params.Timeout = &Timeout - return params -} -func (params *CreateTaskParams) SetPriority(Priority int) *CreateTaskParams { - params.Priority = &Priority - return params -} -func (params *CreateTaskParams) SetTaskChannel(TaskChannel string) *CreateTaskParams { - params.TaskChannel = &TaskChannel - return params -} -func (params *CreateTaskParams) SetWorkflowSid(WorkflowSid string) *CreateTaskParams { - params.WorkflowSid = &WorkflowSid - return params -} -func (params *CreateTaskParams) SetAttributes(Attributes string) *CreateTaskParams { - params.Attributes = &Attributes - return params -} -func (params *CreateTaskParams) SetVirtualStartTime(VirtualStartTime time.Time) *CreateTaskParams { - params.VirtualStartTime = &VirtualStartTime - return params -} - -// + // The amount of time in seconds the new task can live before being assigned. Can be up to a maximum of 2 weeks (1,209,600 seconds). The default value is 24 hours (86,400 seconds). On timeout, the `task.canceled` event will fire with description `Task TTL Exceeded`. + Timeout *int `json:"Timeout,omitempty"` + // The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647). + Priority *int `json:"Priority,omitempty"` + // When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. + WorkflowSid *string `json:"WorkflowSid,omitempty"` + // A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ \\\"task_type\\\": \\\"call\\\", \\\"twilio_call_sid\\\": \\\"CAxxx\\\", \\\"customer_ticket_number\\\": \\\"12345\\\" }`. + Attributes *string `json:"Attributes,omitempty"` +} + +func (params *CreateTaskParams) SetTimeout(Timeout int) (*CreateTaskParams){ + params.Timeout = &Timeout + return params +} +func (params *CreateTaskParams) SetPriority(Priority int) (*CreateTaskParams){ + params.Priority = &Priority + return params +} +func (params *CreateTaskParams) SetTaskChannel(TaskChannel string) (*CreateTaskParams){ + params.TaskChannel = &TaskChannel + return params +} +func (params *CreateTaskParams) SetWorkflowSid(WorkflowSid string) (*CreateTaskParams){ + params.WorkflowSid = &WorkflowSid + return params +} +func (params *CreateTaskParams) SetAttributes(Attributes string) (*CreateTaskParams){ + params.Attributes = &Attributes + return params +} + +// func (c *ApiService) CreateTask(WorkspaceSid string, params *CreateTaskParams) (*TaskrouterV1Task, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Tasks" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Timeout != nil { - data.Set("Timeout", fmt.Sprint(*params.Timeout)) - } - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.WorkflowSid != nil { - data.Set("WorkflowSid", *params.WorkflowSid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.VirtualStartTime != nil { - data.Set("VirtualStartTime", fmt.Sprint((*params.VirtualStartTime).Format(time.RFC3339))) - } + if params != nil && params.Timeout != nil { + data.Set("Timeout", fmt.Sprint(*params.Timeout)) + } + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.WorkflowSid != nil { + data.Set("WorkflowSid", *params.WorkflowSid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1Task{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &TaskrouterV1Task{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteTask' type DeleteTaskParams struct { - // If provided, deletes this Task if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). - IfMatch *string `json:"If-Match,omitempty"` + // If provided, deletes this Task if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). + IfMatch *string `json:"If-Match,omitempty"` } -func (params *DeleteTaskParams) SetIfMatch(IfMatch string) *DeleteTaskParams { - params.IfMatch = &IfMatch - return params +func (params *DeleteTaskParams) SetIfMatch(IfMatch string) (*DeleteTaskParams){ + params.IfMatch = &IfMatch + return params } -// -func (c *ApiService) DeleteTask(WorkspaceSid string, Sid string, params *DeleteTaskParams) error { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteTask(WorkspaceSid string, Sid string, params *DeleteTaskParams) (error) { + path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchTask(WorkspaceSid string, Sid string) (*TaskrouterV1Task, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchTask(WorkspaceSid string, Sid string, ) (*TaskrouterV1Task, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TaskrouterV1Task{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1Task{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTask' type ListTaskParams struct { - // The priority value of the Tasks to read. Returns the list of all Tasks in the Workspace with the specified priority. - Priority *int `json:"Priority,omitempty"` - // The `assignment_status` of the Tasks you want to read. Can be: `pending`, `reserved`, `assigned`, `canceled`, `wrapping`, or `completed`. Returns all Tasks in the Workspace with the specified `assignment_status`. - AssignmentStatus *[]string `json:"AssignmentStatus,omitempty"` - // The SID of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this SID. - WorkflowSid *string `json:"WorkflowSid,omitempty"` - // The friendly name of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this friendly name. - WorkflowName *string `json:"WorkflowName,omitempty"` - // The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. - TaskQueueSid *string `json:"TaskQueueSid,omitempty"` - // The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. - TaskQueueName *string `json:"TaskQueueName,omitempty"` - // The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. - EvaluateTaskAttributes *string `json:"EvaluateTaskAttributes,omitempty"` - // How to order the returned Task resources. By default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `DateCreated`, `Priority`, or `VirtualStartTime` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Pairings of sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. The only ordering pairing not allowed is DateCreated and VirtualStartTime. - Ordering *string `json:"Ordering,omitempty"` - // Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. - HasAddons *bool `json:"HasAddons,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListTaskParams) SetPriority(Priority int) *ListTaskParams { - params.Priority = &Priority - return params -} -func (params *ListTaskParams) SetAssignmentStatus(AssignmentStatus []string) *ListTaskParams { - params.AssignmentStatus = &AssignmentStatus - return params -} -func (params *ListTaskParams) SetWorkflowSid(WorkflowSid string) *ListTaskParams { - params.WorkflowSid = &WorkflowSid - return params -} -func (params *ListTaskParams) SetWorkflowName(WorkflowName string) *ListTaskParams { - params.WorkflowName = &WorkflowName - return params -} -func (params *ListTaskParams) SetTaskQueueSid(TaskQueueSid string) *ListTaskParams { - params.TaskQueueSid = &TaskQueueSid - return params -} -func (params *ListTaskParams) SetTaskQueueName(TaskQueueName string) *ListTaskParams { - params.TaskQueueName = &TaskQueueName - return params -} -func (params *ListTaskParams) SetEvaluateTaskAttributes(EvaluateTaskAttributes string) *ListTaskParams { - params.EvaluateTaskAttributes = &EvaluateTaskAttributes - return params -} -func (params *ListTaskParams) SetOrdering(Ordering string) *ListTaskParams { - params.Ordering = &Ordering - return params -} -func (params *ListTaskParams) SetHasAddons(HasAddons bool) *ListTaskParams { - params.HasAddons = &HasAddons - return params -} -func (params *ListTaskParams) SetPageSize(PageSize int) *ListTaskParams { - params.PageSize = &PageSize - return params -} -func (params *ListTaskParams) SetLimit(Limit int) *ListTaskParams { - params.Limit = &Limit - return params + // The priority value of the Tasks to read. Returns the list of all Tasks in the Workspace with the specified priority. + Priority *int `json:"Priority,omitempty"` + // The `assignment_status` of the Tasks you want to read. Can be: `pending`, `reserved`, `assigned`, `canceled`, `wrapping`, or `completed`. Returns all Tasks in the Workspace with the specified `assignment_status`. + AssignmentStatus *[]string `json:"AssignmentStatus,omitempty"` + // The SID of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this SID. + WorkflowSid *string `json:"WorkflowSid,omitempty"` + // The friendly name of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this friendly name. + WorkflowName *string `json:"WorkflowName,omitempty"` + // The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. + TaskQueueSid *string `json:"TaskQueueSid,omitempty"` + // The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. + TaskQueueName *string `json:"TaskQueueName,omitempty"` + // The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. + EvaluateTaskAttributes *string `json:"EvaluateTaskAttributes,omitempty"` + // How to order the returned Task resources. y default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `Priority` or `DateCreated` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Multiple sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. + Ordering *string `json:"Ordering,omitempty"` + // Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. + HasAddons *bool `json:"HasAddons,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListTaskParams) SetPriority(Priority int) (*ListTaskParams){ + params.Priority = &Priority + return params +} +func (params *ListTaskParams) SetAssignmentStatus(AssignmentStatus []string) (*ListTaskParams){ + params.AssignmentStatus = &AssignmentStatus + return params +} +func (params *ListTaskParams) SetWorkflowSid(WorkflowSid string) (*ListTaskParams){ + params.WorkflowSid = &WorkflowSid + return params +} +func (params *ListTaskParams) SetWorkflowName(WorkflowName string) (*ListTaskParams){ + params.WorkflowName = &WorkflowName + return params +} +func (params *ListTaskParams) SetTaskQueueSid(TaskQueueSid string) (*ListTaskParams){ + params.TaskQueueSid = &TaskQueueSid + return params +} +func (params *ListTaskParams) SetTaskQueueName(TaskQueueName string) (*ListTaskParams){ + params.TaskQueueName = &TaskQueueName + return params +} +func (params *ListTaskParams) SetEvaluateTaskAttributes(EvaluateTaskAttributes string) (*ListTaskParams){ + params.EvaluateTaskAttributes = &EvaluateTaskAttributes + return params +} +func (params *ListTaskParams) SetOrdering(Ordering string) (*ListTaskParams){ + params.Ordering = &Ordering + return params +} +func (params *ListTaskParams) SetHasAddons(HasAddons bool) (*ListTaskParams){ + params.HasAddons = &HasAddons + return params +} +func (params *ListTaskParams) SetPageSize(PageSize int) (*ListTaskParams){ + params.PageSize = &PageSize + return params +} +func (params *ListTaskParams) SetLimit(Limit int) (*ListTaskParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Task records from the API. Request is executed immediately. func (c *ApiService) PageTask(WorkspaceSid string, params *ListTaskParams, pageToken, pageNumber string) (*ListTaskResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks" - - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.AssignmentStatus != nil { - for _, item := range *params.AssignmentStatus { - data.Add("AssignmentStatus", item) - } - } - if params != nil && params.WorkflowSid != nil { - data.Set("WorkflowSid", *params.WorkflowSid) - } - if params != nil && params.WorkflowName != nil { - data.Set("WorkflowName", *params.WorkflowName) - } - if params != nil && params.TaskQueueSid != nil { - data.Set("TaskQueueSid", *params.TaskQueueSid) - } - if params != nil && params.TaskQueueName != nil { - data.Set("TaskQueueName", *params.TaskQueueName) - } - if params != nil && params.EvaluateTaskAttributes != nil { - data.Set("EvaluateTaskAttributes", *params.EvaluateTaskAttributes) - } - if params != nil && params.Ordering != nil { - data.Set("Ordering", *params.Ordering) - } - if params != nil && params.HasAddons != nil { - data.Set("HasAddons", fmt.Sprint(*params.HasAddons)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTaskResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Tasks" + + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.AssignmentStatus != nil { + for _, item := range *params.AssignmentStatus { + data.Add("AssignmentStatus", item) + } + } + if params != nil && params.WorkflowSid != nil { + data.Set("WorkflowSid", *params.WorkflowSid) + } + if params != nil && params.WorkflowName != nil { + data.Set("WorkflowName", *params.WorkflowName) + } + if params != nil && params.TaskQueueSid != nil { + data.Set("TaskQueueSid", *params.TaskQueueSid) + } + if params != nil && params.TaskQueueName != nil { + data.Set("TaskQueueName", *params.TaskQueueName) + } + if params != nil && params.EvaluateTaskAttributes != nil { + data.Set("EvaluateTaskAttributes", *params.EvaluateTaskAttributes) + } + if params != nil && params.Ordering != nil { + data.Set("Ordering", *params.Ordering) + } + if params != nil && params.HasAddons != nil { + data.Set("HasAddons", fmt.Sprint(*params.HasAddons)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTaskResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Task records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -338,6 +332,7 @@ func (c *ApiService) StreamTask(WorkspaceSid string, params *ListTaskParams) (ch return recordChannel, errorChannel } + func (c *ApiService) streamTask(response *ListTaskResponse, params *ListTaskParams, recordChannel chan TaskrouterV1Task, errorChannel chan error) { curRecord := 1 @@ -369,113 +364,105 @@ func (c *ApiService) streamTask(response *ListTaskResponse, params *ListTaskPara } func (c *ApiService) getNextListTaskResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTaskResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListTaskResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTask' type UpdateTaskParams struct { - // If provided, applies this mutation if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). - IfMatch *string `json:"If-Match,omitempty"` - // The JSON string that describes the custom attributes of the task. - Attributes *string `json:"Attributes,omitempty"` - // - AssignmentStatus *string `json:"AssignmentStatus,omitempty"` - // The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. - Reason *string `json:"Reason,omitempty"` - // The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). - Priority *int `json:"Priority,omitempty"` - // When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // The task's new virtual start time value. When supplied, the Task takes on the specified virtual start time. Value can't be in the future. - VirtualStartTime *time.Time `json:"VirtualStartTime,omitempty"` -} - -func (params *UpdateTaskParams) SetIfMatch(IfMatch string) *UpdateTaskParams { - params.IfMatch = &IfMatch - return params -} -func (params *UpdateTaskParams) SetAttributes(Attributes string) *UpdateTaskParams { - params.Attributes = &Attributes - return params -} -func (params *UpdateTaskParams) SetAssignmentStatus(AssignmentStatus string) *UpdateTaskParams { - params.AssignmentStatus = &AssignmentStatus - return params -} -func (params *UpdateTaskParams) SetReason(Reason string) *UpdateTaskParams { - params.Reason = &Reason - return params -} -func (params *UpdateTaskParams) SetPriority(Priority int) *UpdateTaskParams { - params.Priority = &Priority - return params -} -func (params *UpdateTaskParams) SetTaskChannel(TaskChannel string) *UpdateTaskParams { - params.TaskChannel = &TaskChannel - return params -} -func (params *UpdateTaskParams) SetVirtualStartTime(VirtualStartTime time.Time) *UpdateTaskParams { - params.VirtualStartTime = &VirtualStartTime - return params -} - -// + // If provided, applies this mutation if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). + IfMatch *string `json:"If-Match,omitempty"` + // The JSON string that describes the custom attributes of the task. + Attributes *string `json:"Attributes,omitempty"` + // + AssignmentStatus *string `json:"AssignmentStatus,omitempty"` + // The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. + Reason *string `json:"Reason,omitempty"` + // The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). + Priority *int `json:"Priority,omitempty"` + // When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` +} + +func (params *UpdateTaskParams) SetIfMatch(IfMatch string) (*UpdateTaskParams){ + params.IfMatch = &IfMatch + return params +} +func (params *UpdateTaskParams) SetAttributes(Attributes string) (*UpdateTaskParams){ + params.Attributes = &Attributes + return params +} +func (params *UpdateTaskParams) SetAssignmentStatus(AssignmentStatus string) (*UpdateTaskParams){ + params.AssignmentStatus = &AssignmentStatus + return params +} +func (params *UpdateTaskParams) SetReason(Reason string) (*UpdateTaskParams){ + params.Reason = &Reason + return params +} +func (params *UpdateTaskParams) SetPriority(Priority int) (*UpdateTaskParams){ + params.Priority = &Priority + return params +} +func (params *UpdateTaskParams) SetTaskChannel(TaskChannel string) (*UpdateTaskParams){ + params.TaskChannel = &TaskChannel + return params +} + +// func (c *ApiService) UpdateTask(WorkspaceSid string, Sid string, params *UpdateTaskParams) (*TaskrouterV1Task, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.AssignmentStatus != nil { + data.Set("AssignmentStatus", *params.AssignmentStatus) + } + if params != nil && params.Reason != nil { + data.Set("Reason", *params.Reason) + } + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.AssignmentStatus != nil { - data.Set("AssignmentStatus", *params.AssignmentStatus) - } - if params != nil && params.Reason != nil { - data.Set("Reason", *params.Reason) - } - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.VirtualStartTime != nil { - data.Set("VirtualStartTime", fmt.Sprint((*params.VirtualStartTime).Format(time.RFC3339))) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1Task{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1Task{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_tasks_reservations.go b/rest/taskrouter/v1/workspaces_tasks_reservations.go index 894549bbc..53d120c73 100644 --- a/rest/taskrouter/v1/workspaces_tasks_reservations.go +++ b/rest/taskrouter/v1/workspaces_tasks_reservations.go @@ -18,105 +18,107 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchTaskReservation(WorkspaceSid string, TaskSid string, Sid string) (*TaskrouterV1TaskReservation, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchTaskReservation(WorkspaceSid string, TaskSid string, Sid string, ) (*TaskrouterV1TaskReservation, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &TaskrouterV1TaskReservation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1TaskReservation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTaskReservation' type ListTaskReservationParams struct { - // Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. - ReservationStatus *string `json:"ReservationStatus,omitempty"` - // The SID of the reserved Worker resource to read. - WorkerSid *string `json:"WorkerSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. + ReservationStatus *string `json:"ReservationStatus,omitempty"` + // The SID of the reserved Worker resource to read. + WorkerSid *string `json:"WorkerSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTaskReservationParams) SetReservationStatus(ReservationStatus string) *ListTaskReservationParams { - params.ReservationStatus = &ReservationStatus - return params +func (params *ListTaskReservationParams) SetReservationStatus(ReservationStatus string) (*ListTaskReservationParams){ + params.ReservationStatus = &ReservationStatus + return params } -func (params *ListTaskReservationParams) SetWorkerSid(WorkerSid string) *ListTaskReservationParams { - params.WorkerSid = &WorkerSid - return params +func (params *ListTaskReservationParams) SetWorkerSid(WorkerSid string) (*ListTaskReservationParams){ + params.WorkerSid = &WorkerSid + return params } -func (params *ListTaskReservationParams) SetPageSize(PageSize int) *ListTaskReservationParams { - params.PageSize = &PageSize - return params +func (params *ListTaskReservationParams) SetPageSize(PageSize int) (*ListTaskReservationParams){ + params.PageSize = &PageSize + return params } -func (params *ListTaskReservationParams) SetLimit(Limit int) *ListTaskReservationParams { - params.Limit = &Limit - return params +func (params *ListTaskReservationParams) SetLimit(Limit int) (*ListTaskReservationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TaskReservation records from the API. Request is executed immediately. func (c *ApiService) PageTaskReservation(WorkspaceSid string, TaskSid string, params *ListTaskReservationParams, pageToken, pageNumber string) (*ListTaskReservationResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations" + path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ReservationStatus != nil { - data.Set("ReservationStatus", *params.ReservationStatus) - } - if params != nil && params.WorkerSid != nil { - data.Set("WorkerSid", *params.WorkerSid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.ReservationStatus != nil { + data.Set("ReservationStatus", *params.ReservationStatus) + } + if params != nil && params.WorkerSid != nil { + data.Set("WorkerSid", *params.WorkerSid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTaskReservationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTaskReservationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists TaskReservation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -157,6 +159,7 @@ func (c *ApiService) StreamTaskReservation(WorkspaceSid string, TaskSid string, return recordChannel, errorChannel } + func (c *ApiService) streamTaskReservation(response *ListTaskReservationResponse, params *ListTaskReservationParams, recordChannel chan TaskrouterV1TaskReservation, errorChannel chan error) { curRecord := 1 @@ -188,543 +191,544 @@ func (c *ApiService) streamTaskReservation(response *ListTaskReservationResponse } func (c *ApiService) getNextListTaskReservationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTaskReservationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListTaskReservationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTaskReservation' type UpdateTaskReservationParams struct { - // The If-Match HTTP request header - IfMatch *string `json:"If-Match,omitempty"` - // - ReservationStatus *string `json:"ReservationStatus,omitempty"` - // The new worker activity SID if rejecting a reservation. - WorkerActivitySid *string `json:"WorkerActivitySid,omitempty"` - // The assignment instruction for reservation. - Instruction *string `json:"Instruction,omitempty"` - // The SID of the Activity resource to start after executing a Dequeue instruction. - DequeuePostWorkActivitySid *string `json:"DequeuePostWorkActivitySid,omitempty"` - // The Caller ID of the call to the worker when executing a Dequeue instruction. - DequeueFrom *string `json:"DequeueFrom,omitempty"` - // Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. - DequeueRecord *string `json:"DequeueRecord,omitempty"` - // Timeout for call when executing a Dequeue instruction. - DequeueTimeout *int `json:"DequeueTimeout,omitempty"` - // The Contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. - DequeueTo *string `json:"DequeueTo,omitempty"` - // The Callback URL for completed call event when executing a Dequeue instruction. - DequeueStatusCallbackUrl *string `json:"DequeueStatusCallbackUrl,omitempty"` - // The Caller ID of the outbound call when executing a Call instruction. - CallFrom *string `json:"CallFrom,omitempty"` - // Whether to record both legs of a call when executing a Call instruction or which leg to record. - CallRecord *string `json:"CallRecord,omitempty"` - // Timeout for call when executing a Call instruction. - CallTimeout *int `json:"CallTimeout,omitempty"` - // The Contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. - CallTo *string `json:"CallTo,omitempty"` - // TwiML URI executed on answering the worker's leg as a result of the Call instruction. - CallUrl *string `json:"CallUrl,omitempty"` - // The URL to call for the completed call event when executing a Call instruction. - CallStatusCallbackUrl *string `json:"CallStatusCallbackUrl,omitempty"` - // Whether to accept a reservation when executing a Call instruction. - CallAccept *bool `json:"CallAccept,omitempty"` - // The Call SID of the call parked in the queue when executing a Redirect instruction. - RedirectCallSid *string `json:"RedirectCallSid,omitempty"` - // Whether the reservation should be accepted when executing a Redirect instruction. - RedirectAccept *bool `json:"RedirectAccept,omitempty"` - // TwiML URI to redirect the call to when executing the Redirect instruction. - RedirectUrl *string `json:"RedirectUrl,omitempty"` - // The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. - To *string `json:"To,omitempty"` - // The Caller ID of the call to the worker when executing a Conference instruction. - From *string `json:"From,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. - StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` - // Timeout for call when executing a Conference instruction. - Timeout *int `json:"Timeout,omitempty"` - // Whether to record the participant and their conferences, including the time between conferences. The default is `false`. - Record *bool `json:"Record,omitempty"` - // Whether the agent is muted in the conference. The default is `false`. - Muted *bool `json:"Muted,omitempty"` - // Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. - Beep *string `json:"Beep,omitempty"` - // Whether to start the conference when the participant joins, if it has not already started. The default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. - StartConferenceOnEnter *bool `json:"StartConferenceOnEnter,omitempty"` - // Whether to end the conference when the agent leaves. - EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` - // The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). - WaitUrl *string `json:"WaitUrl,omitempty"` - // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. - WaitMethod *string `json:"WaitMethod,omitempty"` - // Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. - EarlyMedia *bool `json:"EarlyMedia,omitempty"` - // The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. - MaxParticipants *int `json:"MaxParticipants,omitempty"` - // The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. - ConferenceStatusCallback *string `json:"ConferenceStatusCallback,omitempty"` - // The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - ConferenceStatusCallbackMethod *string `json:"ConferenceStatusCallbackMethod,omitempty"` - // The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. - ConferenceStatusCallbackEvent *[]string `json:"ConferenceStatusCallbackEvent,omitempty"` - // Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. - ConferenceRecord *string `json:"ConferenceRecord,omitempty"` - // How to trim the leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. - ConferenceTrim *string `json:"ConferenceTrim,omitempty"` - // The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. - RecordingChannels *string `json:"RecordingChannels,omitempty"` - // The URL that we should call using the `recording_status_callback_method` when the recording status changes. - RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` - // The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` - // The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. - ConferenceRecordingStatusCallback *string `json:"ConferenceRecordingStatusCallback,omitempty"` - // The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - ConferenceRecordingStatusCallbackMethod *string `json:"ConferenceRecordingStatusCallbackMethod,omitempty"` - // The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. - Region *string `json:"Region,omitempty"` - // The SIP username used for authentication. - SipAuthUsername *string `json:"SipAuthUsername,omitempty"` - // The SIP password for authentication. - SipAuthPassword *string `json:"SipAuthPassword,omitempty"` - // The Call progress events sent via webhooks as a result of a Dequeue instruction. - DequeueStatusCallbackEvent *[]string `json:"DequeueStatusCallbackEvent,omitempty"` - // The new worker activity SID after executing a Conference instruction. - PostWorkActivitySid *string `json:"PostWorkActivitySid,omitempty"` - // - SupervisorMode *string `json:"SupervisorMode,omitempty"` - // The Supervisor SID/URI when executing the Supervise instruction. - Supervisor *string `json:"Supervisor,omitempty"` - // Whether to end the conference when the customer leaves. - EndConferenceOnCustomerExit *bool `json:"EndConferenceOnCustomerExit,omitempty"` - // Whether to play a notification beep when the customer joins. - BeepOnCustomerEntrance *bool `json:"BeepOnCustomerEntrance,omitempty"` -} - -func (params *UpdateTaskReservationParams) SetIfMatch(IfMatch string) *UpdateTaskReservationParams { - params.IfMatch = &IfMatch - return params -} -func (params *UpdateTaskReservationParams) SetReservationStatus(ReservationStatus string) *UpdateTaskReservationParams { - params.ReservationStatus = &ReservationStatus - return params -} -func (params *UpdateTaskReservationParams) SetWorkerActivitySid(WorkerActivitySid string) *UpdateTaskReservationParams { - params.WorkerActivitySid = &WorkerActivitySid - return params -} -func (params *UpdateTaskReservationParams) SetInstruction(Instruction string) *UpdateTaskReservationParams { - params.Instruction = &Instruction - return params -} -func (params *UpdateTaskReservationParams) SetDequeuePostWorkActivitySid(DequeuePostWorkActivitySid string) *UpdateTaskReservationParams { - params.DequeuePostWorkActivitySid = &DequeuePostWorkActivitySid - return params -} -func (params *UpdateTaskReservationParams) SetDequeueFrom(DequeueFrom string) *UpdateTaskReservationParams { - params.DequeueFrom = &DequeueFrom - return params -} -func (params *UpdateTaskReservationParams) SetDequeueRecord(DequeueRecord string) *UpdateTaskReservationParams { - params.DequeueRecord = &DequeueRecord - return params -} -func (params *UpdateTaskReservationParams) SetDequeueTimeout(DequeueTimeout int) *UpdateTaskReservationParams { - params.DequeueTimeout = &DequeueTimeout - return params -} -func (params *UpdateTaskReservationParams) SetDequeueTo(DequeueTo string) *UpdateTaskReservationParams { - params.DequeueTo = &DequeueTo - return params -} -func (params *UpdateTaskReservationParams) SetDequeueStatusCallbackUrl(DequeueStatusCallbackUrl string) *UpdateTaskReservationParams { - params.DequeueStatusCallbackUrl = &DequeueStatusCallbackUrl - return params -} -func (params *UpdateTaskReservationParams) SetCallFrom(CallFrom string) *UpdateTaskReservationParams { - params.CallFrom = &CallFrom - return params -} -func (params *UpdateTaskReservationParams) SetCallRecord(CallRecord string) *UpdateTaskReservationParams { - params.CallRecord = &CallRecord - return params -} -func (params *UpdateTaskReservationParams) SetCallTimeout(CallTimeout int) *UpdateTaskReservationParams { - params.CallTimeout = &CallTimeout - return params -} -func (params *UpdateTaskReservationParams) SetCallTo(CallTo string) *UpdateTaskReservationParams { - params.CallTo = &CallTo - return params -} -func (params *UpdateTaskReservationParams) SetCallUrl(CallUrl string) *UpdateTaskReservationParams { - params.CallUrl = &CallUrl - return params -} -func (params *UpdateTaskReservationParams) SetCallStatusCallbackUrl(CallStatusCallbackUrl string) *UpdateTaskReservationParams { - params.CallStatusCallbackUrl = &CallStatusCallbackUrl - return params -} -func (params *UpdateTaskReservationParams) SetCallAccept(CallAccept bool) *UpdateTaskReservationParams { - params.CallAccept = &CallAccept - return params -} -func (params *UpdateTaskReservationParams) SetRedirectCallSid(RedirectCallSid string) *UpdateTaskReservationParams { - params.RedirectCallSid = &RedirectCallSid - return params -} -func (params *UpdateTaskReservationParams) SetRedirectAccept(RedirectAccept bool) *UpdateTaskReservationParams { - params.RedirectAccept = &RedirectAccept - return params -} -func (params *UpdateTaskReservationParams) SetRedirectUrl(RedirectUrl string) *UpdateTaskReservationParams { - params.RedirectUrl = &RedirectUrl - return params -} -func (params *UpdateTaskReservationParams) SetTo(To string) *UpdateTaskReservationParams { - params.To = &To - return params -} -func (params *UpdateTaskReservationParams) SetFrom(From string) *UpdateTaskReservationParams { - params.From = &From - return params -} -func (params *UpdateTaskReservationParams) SetStatusCallback(StatusCallback string) *UpdateTaskReservationParams { - params.StatusCallback = &StatusCallback - return params + // The If-Match HTTP request header + IfMatch *string `json:"If-Match,omitempty"` + // + ReservationStatus *string `json:"ReservationStatus,omitempty"` + // The new worker activity SID if rejecting a reservation. + WorkerActivitySid *string `json:"WorkerActivitySid,omitempty"` + // The assignment instruction for reservation. + Instruction *string `json:"Instruction,omitempty"` + // The SID of the Activity resource to start after executing a Dequeue instruction. + DequeuePostWorkActivitySid *string `json:"DequeuePostWorkActivitySid,omitempty"` + // The Caller ID of the call to the worker when executing a Dequeue instruction. + DequeueFrom *string `json:"DequeueFrom,omitempty"` + // Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. + DequeueRecord *string `json:"DequeueRecord,omitempty"` + // Timeout for call when executing a Dequeue instruction. + DequeueTimeout *int `json:"DequeueTimeout,omitempty"` + // The Contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + DequeueTo *string `json:"DequeueTo,omitempty"` + // The Callback URL for completed call event when executing a Dequeue instruction. + DequeueStatusCallbackUrl *string `json:"DequeueStatusCallbackUrl,omitempty"` + // The Caller ID of the outbound call when executing a Call instruction. + CallFrom *string `json:"CallFrom,omitempty"` + // Whether to record both legs of a call when executing a Call instruction or which leg to record. + CallRecord *string `json:"CallRecord,omitempty"` + // Timeout for call when executing a Call instruction. + CallTimeout *int `json:"CallTimeout,omitempty"` + // The Contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + CallTo *string `json:"CallTo,omitempty"` + // TwiML URI executed on answering the worker's leg as a result of the Call instruction. + CallUrl *string `json:"CallUrl,omitempty"` + // The URL to call for the completed call event when executing a Call instruction. + CallStatusCallbackUrl *string `json:"CallStatusCallbackUrl,omitempty"` + // Whether to accept a reservation when executing a Call instruction. + CallAccept *bool `json:"CallAccept,omitempty"` + // The Call SID of the call parked in the queue when executing a Redirect instruction. + RedirectCallSid *string `json:"RedirectCallSid,omitempty"` + // Whether the reservation should be accepted when executing a Redirect instruction. + RedirectAccept *bool `json:"RedirectAccept,omitempty"` + // TwiML URI to redirect the call to when executing the Redirect instruction. + RedirectUrl *string `json:"RedirectUrl,omitempty"` + // The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + To *string `json:"To,omitempty"` + // The Caller ID of the call to the worker when executing a Conference instruction. + From *string `json:"From,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. + StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` + // Timeout for call when executing a Conference instruction. + Timeout *int `json:"Timeout,omitempty"` + // Whether to record the participant and their conferences, including the time between conferences. The default is `false`. + Record *bool `json:"Record,omitempty"` + // Whether the agent is muted in the conference. The default is `false`. + Muted *bool `json:"Muted,omitempty"` + // Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. + Beep *string `json:"Beep,omitempty"` + // Whether to start the conference when the participant joins, if it has not already started. The default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + StartConferenceOnEnter *bool `json:"StartConferenceOnEnter,omitempty"` + // Whether to end the conference when the agent leaves. + EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` + // The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + WaitUrl *string `json:"WaitUrl,omitempty"` + // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. + WaitMethod *string `json:"WaitMethod,omitempty"` + // Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. + EarlyMedia *bool `json:"EarlyMedia,omitempty"` + // The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. + MaxParticipants *int `json:"MaxParticipants,omitempty"` + // The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. + ConferenceStatusCallback *string `json:"ConferenceStatusCallback,omitempty"` + // The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + ConferenceStatusCallbackMethod *string `json:"ConferenceStatusCallbackMethod,omitempty"` + // The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. + ConferenceStatusCallbackEvent *[]string `json:"ConferenceStatusCallbackEvent,omitempty"` + // Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. + ConferenceRecord *string `json:"ConferenceRecord,omitempty"` + // How to trim the leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. + ConferenceTrim *string `json:"ConferenceTrim,omitempty"` + // The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. + RecordingChannels *string `json:"RecordingChannels,omitempty"` + // The URL that we should call using the `recording_status_callback_method` when the recording status changes. + RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` + // The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` + // The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. + ConferenceRecordingStatusCallback *string `json:"ConferenceRecordingStatusCallback,omitempty"` + // The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + ConferenceRecordingStatusCallbackMethod *string `json:"ConferenceRecordingStatusCallbackMethod,omitempty"` + // The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + Region *string `json:"Region,omitempty"` + // The SIP username used for authentication. + SipAuthUsername *string `json:"SipAuthUsername,omitempty"` + // The SIP password for authentication. + SipAuthPassword *string `json:"SipAuthPassword,omitempty"` + // The Call progress events sent via webhooks as a result of a Dequeue instruction. + DequeueStatusCallbackEvent *[]string `json:"DequeueStatusCallbackEvent,omitempty"` + // The new worker activity SID after executing a Conference instruction. + PostWorkActivitySid *string `json:"PostWorkActivitySid,omitempty"` + // + SupervisorMode *string `json:"SupervisorMode,omitempty"` + // The Supervisor SID/URI when executing the Supervise instruction. + Supervisor *string `json:"Supervisor,omitempty"` + // Whether to end the conference when the customer leaves. + EndConferenceOnCustomerExit *bool `json:"EndConferenceOnCustomerExit,omitempty"` + // Whether to play a notification beep when the customer joins. + BeepOnCustomerEntrance *bool `json:"BeepOnCustomerEntrance,omitempty"` +} + +func (params *UpdateTaskReservationParams) SetIfMatch(IfMatch string) (*UpdateTaskReservationParams){ + params.IfMatch = &IfMatch + return params +} +func (params *UpdateTaskReservationParams) SetReservationStatus(ReservationStatus string) (*UpdateTaskReservationParams){ + params.ReservationStatus = &ReservationStatus + return params +} +func (params *UpdateTaskReservationParams) SetWorkerActivitySid(WorkerActivitySid string) (*UpdateTaskReservationParams){ + params.WorkerActivitySid = &WorkerActivitySid + return params +} +func (params *UpdateTaskReservationParams) SetInstruction(Instruction string) (*UpdateTaskReservationParams){ + params.Instruction = &Instruction + return params +} +func (params *UpdateTaskReservationParams) SetDequeuePostWorkActivitySid(DequeuePostWorkActivitySid string) (*UpdateTaskReservationParams){ + params.DequeuePostWorkActivitySid = &DequeuePostWorkActivitySid + return params +} +func (params *UpdateTaskReservationParams) SetDequeueFrom(DequeueFrom string) (*UpdateTaskReservationParams){ + params.DequeueFrom = &DequeueFrom + return params +} +func (params *UpdateTaskReservationParams) SetDequeueRecord(DequeueRecord string) (*UpdateTaskReservationParams){ + params.DequeueRecord = &DequeueRecord + return params +} +func (params *UpdateTaskReservationParams) SetDequeueTimeout(DequeueTimeout int) (*UpdateTaskReservationParams){ + params.DequeueTimeout = &DequeueTimeout + return params +} +func (params *UpdateTaskReservationParams) SetDequeueTo(DequeueTo string) (*UpdateTaskReservationParams){ + params.DequeueTo = &DequeueTo + return params +} +func (params *UpdateTaskReservationParams) SetDequeueStatusCallbackUrl(DequeueStatusCallbackUrl string) (*UpdateTaskReservationParams){ + params.DequeueStatusCallbackUrl = &DequeueStatusCallbackUrl + return params +} +func (params *UpdateTaskReservationParams) SetCallFrom(CallFrom string) (*UpdateTaskReservationParams){ + params.CallFrom = &CallFrom + return params +} +func (params *UpdateTaskReservationParams) SetCallRecord(CallRecord string) (*UpdateTaskReservationParams){ + params.CallRecord = &CallRecord + return params +} +func (params *UpdateTaskReservationParams) SetCallTimeout(CallTimeout int) (*UpdateTaskReservationParams){ + params.CallTimeout = &CallTimeout + return params +} +func (params *UpdateTaskReservationParams) SetCallTo(CallTo string) (*UpdateTaskReservationParams){ + params.CallTo = &CallTo + return params +} +func (params *UpdateTaskReservationParams) SetCallUrl(CallUrl string) (*UpdateTaskReservationParams){ + params.CallUrl = &CallUrl + return params +} +func (params *UpdateTaskReservationParams) SetCallStatusCallbackUrl(CallStatusCallbackUrl string) (*UpdateTaskReservationParams){ + params.CallStatusCallbackUrl = &CallStatusCallbackUrl + return params +} +func (params *UpdateTaskReservationParams) SetCallAccept(CallAccept bool) (*UpdateTaskReservationParams){ + params.CallAccept = &CallAccept + return params +} +func (params *UpdateTaskReservationParams) SetRedirectCallSid(RedirectCallSid string) (*UpdateTaskReservationParams){ + params.RedirectCallSid = &RedirectCallSid + return params +} +func (params *UpdateTaskReservationParams) SetRedirectAccept(RedirectAccept bool) (*UpdateTaskReservationParams){ + params.RedirectAccept = &RedirectAccept + return params +} +func (params *UpdateTaskReservationParams) SetRedirectUrl(RedirectUrl string) (*UpdateTaskReservationParams){ + params.RedirectUrl = &RedirectUrl + return params +} +func (params *UpdateTaskReservationParams) SetTo(To string) (*UpdateTaskReservationParams){ + params.To = &To + return params +} +func (params *UpdateTaskReservationParams) SetFrom(From string) (*UpdateTaskReservationParams){ + params.From = &From + return params +} +func (params *UpdateTaskReservationParams) SetStatusCallback(StatusCallback string) (*UpdateTaskReservationParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *UpdateTaskReservationParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateTaskReservationParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *UpdateTaskReservationParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateTaskReservationParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *UpdateTaskReservationParams) SetStatusCallbackEvent(StatusCallbackEvent []string) *UpdateTaskReservationParams { - params.StatusCallbackEvent = &StatusCallbackEvent - return params +func (params *UpdateTaskReservationParams) SetStatusCallbackEvent(StatusCallbackEvent []string) (*UpdateTaskReservationParams){ + params.StatusCallbackEvent = &StatusCallbackEvent + return params } -func (params *UpdateTaskReservationParams) SetTimeout(Timeout int) *UpdateTaskReservationParams { - params.Timeout = &Timeout - return params +func (params *UpdateTaskReservationParams) SetTimeout(Timeout int) (*UpdateTaskReservationParams){ + params.Timeout = &Timeout + return params } -func (params *UpdateTaskReservationParams) SetRecord(Record bool) *UpdateTaskReservationParams { - params.Record = &Record - return params +func (params *UpdateTaskReservationParams) SetRecord(Record bool) (*UpdateTaskReservationParams){ + params.Record = &Record + return params } -func (params *UpdateTaskReservationParams) SetMuted(Muted bool) *UpdateTaskReservationParams { - params.Muted = &Muted - return params +func (params *UpdateTaskReservationParams) SetMuted(Muted bool) (*UpdateTaskReservationParams){ + params.Muted = &Muted + return params } -func (params *UpdateTaskReservationParams) SetBeep(Beep string) *UpdateTaskReservationParams { - params.Beep = &Beep - return params +func (params *UpdateTaskReservationParams) SetBeep(Beep string) (*UpdateTaskReservationParams){ + params.Beep = &Beep + return params } -func (params *UpdateTaskReservationParams) SetStartConferenceOnEnter(StartConferenceOnEnter bool) *UpdateTaskReservationParams { - params.StartConferenceOnEnter = &StartConferenceOnEnter - return params +func (params *UpdateTaskReservationParams) SetStartConferenceOnEnter(StartConferenceOnEnter bool) (*UpdateTaskReservationParams){ + params.StartConferenceOnEnter = &StartConferenceOnEnter + return params } -func (params *UpdateTaskReservationParams) SetEndConferenceOnExit(EndConferenceOnExit bool) *UpdateTaskReservationParams { - params.EndConferenceOnExit = &EndConferenceOnExit - return params +func (params *UpdateTaskReservationParams) SetEndConferenceOnExit(EndConferenceOnExit bool) (*UpdateTaskReservationParams){ + params.EndConferenceOnExit = &EndConferenceOnExit + return params } -func (params *UpdateTaskReservationParams) SetWaitUrl(WaitUrl string) *UpdateTaskReservationParams { - params.WaitUrl = &WaitUrl - return params +func (params *UpdateTaskReservationParams) SetWaitUrl(WaitUrl string) (*UpdateTaskReservationParams){ + params.WaitUrl = &WaitUrl + return params } -func (params *UpdateTaskReservationParams) SetWaitMethod(WaitMethod string) *UpdateTaskReservationParams { - params.WaitMethod = &WaitMethod - return params +func (params *UpdateTaskReservationParams) SetWaitMethod(WaitMethod string) (*UpdateTaskReservationParams){ + params.WaitMethod = &WaitMethod + return params } -func (params *UpdateTaskReservationParams) SetEarlyMedia(EarlyMedia bool) *UpdateTaskReservationParams { - params.EarlyMedia = &EarlyMedia - return params +func (params *UpdateTaskReservationParams) SetEarlyMedia(EarlyMedia bool) (*UpdateTaskReservationParams){ + params.EarlyMedia = &EarlyMedia + return params } -func (params *UpdateTaskReservationParams) SetMaxParticipants(MaxParticipants int) *UpdateTaskReservationParams { - params.MaxParticipants = &MaxParticipants - return params +func (params *UpdateTaskReservationParams) SetMaxParticipants(MaxParticipants int) (*UpdateTaskReservationParams){ + params.MaxParticipants = &MaxParticipants + return params } -func (params *UpdateTaskReservationParams) SetConferenceStatusCallback(ConferenceStatusCallback string) *UpdateTaskReservationParams { - params.ConferenceStatusCallback = &ConferenceStatusCallback - return params +func (params *UpdateTaskReservationParams) SetConferenceStatusCallback(ConferenceStatusCallback string) (*UpdateTaskReservationParams){ + params.ConferenceStatusCallback = &ConferenceStatusCallback + return params } -func (params *UpdateTaskReservationParams) SetConferenceStatusCallbackMethod(ConferenceStatusCallbackMethod string) *UpdateTaskReservationParams { - params.ConferenceStatusCallbackMethod = &ConferenceStatusCallbackMethod - return params +func (params *UpdateTaskReservationParams) SetConferenceStatusCallbackMethod(ConferenceStatusCallbackMethod string) (*UpdateTaskReservationParams){ + params.ConferenceStatusCallbackMethod = &ConferenceStatusCallbackMethod + return params } -func (params *UpdateTaskReservationParams) SetConferenceStatusCallbackEvent(ConferenceStatusCallbackEvent []string) *UpdateTaskReservationParams { - params.ConferenceStatusCallbackEvent = &ConferenceStatusCallbackEvent - return params +func (params *UpdateTaskReservationParams) SetConferenceStatusCallbackEvent(ConferenceStatusCallbackEvent []string) (*UpdateTaskReservationParams){ + params.ConferenceStatusCallbackEvent = &ConferenceStatusCallbackEvent + return params } -func (params *UpdateTaskReservationParams) SetConferenceRecord(ConferenceRecord string) *UpdateTaskReservationParams { - params.ConferenceRecord = &ConferenceRecord - return params +func (params *UpdateTaskReservationParams) SetConferenceRecord(ConferenceRecord string) (*UpdateTaskReservationParams){ + params.ConferenceRecord = &ConferenceRecord + return params } -func (params *UpdateTaskReservationParams) SetConferenceTrim(ConferenceTrim string) *UpdateTaskReservationParams { - params.ConferenceTrim = &ConferenceTrim - return params +func (params *UpdateTaskReservationParams) SetConferenceTrim(ConferenceTrim string) (*UpdateTaskReservationParams){ + params.ConferenceTrim = &ConferenceTrim + return params } -func (params *UpdateTaskReservationParams) SetRecordingChannels(RecordingChannels string) *UpdateTaskReservationParams { - params.RecordingChannels = &RecordingChannels - return params +func (params *UpdateTaskReservationParams) SetRecordingChannels(RecordingChannels string) (*UpdateTaskReservationParams){ + params.RecordingChannels = &RecordingChannels + return params } -func (params *UpdateTaskReservationParams) SetRecordingStatusCallback(RecordingStatusCallback string) *UpdateTaskReservationParams { - params.RecordingStatusCallback = &RecordingStatusCallback - return params +func (params *UpdateTaskReservationParams) SetRecordingStatusCallback(RecordingStatusCallback string) (*UpdateTaskReservationParams){ + params.RecordingStatusCallback = &RecordingStatusCallback + return params } -func (params *UpdateTaskReservationParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) *UpdateTaskReservationParams { - params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod - return params +func (params *UpdateTaskReservationParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) (*UpdateTaskReservationParams){ + params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod + return params } -func (params *UpdateTaskReservationParams) SetConferenceRecordingStatusCallback(ConferenceRecordingStatusCallback string) *UpdateTaskReservationParams { - params.ConferenceRecordingStatusCallback = &ConferenceRecordingStatusCallback - return params +func (params *UpdateTaskReservationParams) SetConferenceRecordingStatusCallback(ConferenceRecordingStatusCallback string) (*UpdateTaskReservationParams){ + params.ConferenceRecordingStatusCallback = &ConferenceRecordingStatusCallback + return params } -func (params *UpdateTaskReservationParams) SetConferenceRecordingStatusCallbackMethod(ConferenceRecordingStatusCallbackMethod string) *UpdateTaskReservationParams { - params.ConferenceRecordingStatusCallbackMethod = &ConferenceRecordingStatusCallbackMethod - return params +func (params *UpdateTaskReservationParams) SetConferenceRecordingStatusCallbackMethod(ConferenceRecordingStatusCallbackMethod string) (*UpdateTaskReservationParams){ + params.ConferenceRecordingStatusCallbackMethod = &ConferenceRecordingStatusCallbackMethod + return params } -func (params *UpdateTaskReservationParams) SetRegion(Region string) *UpdateTaskReservationParams { - params.Region = &Region - return params +func (params *UpdateTaskReservationParams) SetRegion(Region string) (*UpdateTaskReservationParams){ + params.Region = &Region + return params } -func (params *UpdateTaskReservationParams) SetSipAuthUsername(SipAuthUsername string) *UpdateTaskReservationParams { - params.SipAuthUsername = &SipAuthUsername - return params +func (params *UpdateTaskReservationParams) SetSipAuthUsername(SipAuthUsername string) (*UpdateTaskReservationParams){ + params.SipAuthUsername = &SipAuthUsername + return params } -func (params *UpdateTaskReservationParams) SetSipAuthPassword(SipAuthPassword string) *UpdateTaskReservationParams { - params.SipAuthPassword = &SipAuthPassword - return params +func (params *UpdateTaskReservationParams) SetSipAuthPassword(SipAuthPassword string) (*UpdateTaskReservationParams){ + params.SipAuthPassword = &SipAuthPassword + return params } -func (params *UpdateTaskReservationParams) SetDequeueStatusCallbackEvent(DequeueStatusCallbackEvent []string) *UpdateTaskReservationParams { - params.DequeueStatusCallbackEvent = &DequeueStatusCallbackEvent - return params +func (params *UpdateTaskReservationParams) SetDequeueStatusCallbackEvent(DequeueStatusCallbackEvent []string) (*UpdateTaskReservationParams){ + params.DequeueStatusCallbackEvent = &DequeueStatusCallbackEvent + return params } -func (params *UpdateTaskReservationParams) SetPostWorkActivitySid(PostWorkActivitySid string) *UpdateTaskReservationParams { - params.PostWorkActivitySid = &PostWorkActivitySid - return params +func (params *UpdateTaskReservationParams) SetPostWorkActivitySid(PostWorkActivitySid string) (*UpdateTaskReservationParams){ + params.PostWorkActivitySid = &PostWorkActivitySid + return params } -func (params *UpdateTaskReservationParams) SetSupervisorMode(SupervisorMode string) *UpdateTaskReservationParams { - params.SupervisorMode = &SupervisorMode - return params +func (params *UpdateTaskReservationParams) SetSupervisorMode(SupervisorMode string) (*UpdateTaskReservationParams){ + params.SupervisorMode = &SupervisorMode + return params } -func (params *UpdateTaskReservationParams) SetSupervisor(Supervisor string) *UpdateTaskReservationParams { - params.Supervisor = &Supervisor - return params +func (params *UpdateTaskReservationParams) SetSupervisor(Supervisor string) (*UpdateTaskReservationParams){ + params.Supervisor = &Supervisor + return params } -func (params *UpdateTaskReservationParams) SetEndConferenceOnCustomerExit(EndConferenceOnCustomerExit bool) *UpdateTaskReservationParams { - params.EndConferenceOnCustomerExit = &EndConferenceOnCustomerExit - return params +func (params *UpdateTaskReservationParams) SetEndConferenceOnCustomerExit(EndConferenceOnCustomerExit bool) (*UpdateTaskReservationParams){ + params.EndConferenceOnCustomerExit = &EndConferenceOnCustomerExit + return params } -func (params *UpdateTaskReservationParams) SetBeepOnCustomerEntrance(BeepOnCustomerEntrance bool) *UpdateTaskReservationParams { - params.BeepOnCustomerEntrance = &BeepOnCustomerEntrance - return params +func (params *UpdateTaskReservationParams) SetBeepOnCustomerEntrance(BeepOnCustomerEntrance bool) (*UpdateTaskReservationParams){ + params.BeepOnCustomerEntrance = &BeepOnCustomerEntrance + return params } -// +// func (c *ApiService) UpdateTaskReservation(WorkspaceSid string, TaskSid string, Sid string, params *UpdateTaskReservationParams) (*TaskrouterV1TaskReservation, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Tasks/{TaskSid}/Reservations/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"TaskSid"+"}", TaskSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ReservationStatus != nil { + data.Set("ReservationStatus", *params.ReservationStatus) + } + if params != nil && params.WorkerActivitySid != nil { + data.Set("WorkerActivitySid", *params.WorkerActivitySid) + } + if params != nil && params.Instruction != nil { + data.Set("Instruction", *params.Instruction) + } + if params != nil && params.DequeuePostWorkActivitySid != nil { + data.Set("DequeuePostWorkActivitySid", *params.DequeuePostWorkActivitySid) + } + if params != nil && params.DequeueFrom != nil { + data.Set("DequeueFrom", *params.DequeueFrom) + } + if params != nil && params.DequeueRecord != nil { + data.Set("DequeueRecord", *params.DequeueRecord) + } + if params != nil && params.DequeueTimeout != nil { + data.Set("DequeueTimeout", fmt.Sprint(*params.DequeueTimeout)) + } + if params != nil && params.DequeueTo != nil { + data.Set("DequeueTo", *params.DequeueTo) + } + if params != nil && params.DequeueStatusCallbackUrl != nil { + data.Set("DequeueStatusCallbackUrl", *params.DequeueStatusCallbackUrl) + } + if params != nil && params.CallFrom != nil { + data.Set("CallFrom", *params.CallFrom) + } + if params != nil && params.CallRecord != nil { + data.Set("CallRecord", *params.CallRecord) + } + if params != nil && params.CallTimeout != nil { + data.Set("CallTimeout", fmt.Sprint(*params.CallTimeout)) + } + if params != nil && params.CallTo != nil { + data.Set("CallTo", *params.CallTo) + } + if params != nil && params.CallUrl != nil { + data.Set("CallUrl", *params.CallUrl) + } + if params != nil && params.CallStatusCallbackUrl != nil { + data.Set("CallStatusCallbackUrl", *params.CallStatusCallbackUrl) + } + if params != nil && params.CallAccept != nil { + data.Set("CallAccept", fmt.Sprint(*params.CallAccept)) + } + if params != nil && params.RedirectCallSid != nil { + data.Set("RedirectCallSid", *params.RedirectCallSid) + } + if params != nil && params.RedirectAccept != nil { + data.Set("RedirectAccept", fmt.Sprint(*params.RedirectAccept)) + } + if params != nil && params.RedirectUrl != nil { + data.Set("RedirectUrl", *params.RedirectUrl) + } + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.StatusCallbackEvent != nil { + for _, item := range *params.StatusCallbackEvent { + data.Add("StatusCallbackEvent", item) + } + } + if params != nil && params.Timeout != nil { + data.Set("Timeout", fmt.Sprint(*params.Timeout)) + } + if params != nil && params.Record != nil { + data.Set("Record", fmt.Sprint(*params.Record)) + } + if params != nil && params.Muted != nil { + data.Set("Muted", fmt.Sprint(*params.Muted)) + } + if params != nil && params.Beep != nil { + data.Set("Beep", *params.Beep) + } + if params != nil && params.StartConferenceOnEnter != nil { + data.Set("StartConferenceOnEnter", fmt.Sprint(*params.StartConferenceOnEnter)) + } + if params != nil && params.EndConferenceOnExit != nil { + data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) + } + if params != nil && params.WaitUrl != nil { + data.Set("WaitUrl", *params.WaitUrl) + } + if params != nil && params.WaitMethod != nil { + data.Set("WaitMethod", *params.WaitMethod) + } + if params != nil && params.EarlyMedia != nil { + data.Set("EarlyMedia", fmt.Sprint(*params.EarlyMedia)) + } + if params != nil && params.MaxParticipants != nil { + data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) + } + if params != nil && params.ConferenceStatusCallback != nil { + data.Set("ConferenceStatusCallback", *params.ConferenceStatusCallback) + } + if params != nil && params.ConferenceStatusCallbackMethod != nil { + data.Set("ConferenceStatusCallbackMethod", *params.ConferenceStatusCallbackMethod) + } + if params != nil && params.ConferenceStatusCallbackEvent != nil { + for _, item := range *params.ConferenceStatusCallbackEvent { + data.Add("ConferenceStatusCallbackEvent", item) + } + } + if params != nil && params.ConferenceRecord != nil { + data.Set("ConferenceRecord", *params.ConferenceRecord) + } + if params != nil && params.ConferenceTrim != nil { + data.Set("ConferenceTrim", *params.ConferenceTrim) + } + if params != nil && params.RecordingChannels != nil { + data.Set("RecordingChannels", *params.RecordingChannels) + } + if params != nil && params.RecordingStatusCallback != nil { + data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) + } + if params != nil && params.RecordingStatusCallbackMethod != nil { + data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) + } + if params != nil && params.ConferenceRecordingStatusCallback != nil { + data.Set("ConferenceRecordingStatusCallback", *params.ConferenceRecordingStatusCallback) + } + if params != nil && params.ConferenceRecordingStatusCallbackMethod != nil { + data.Set("ConferenceRecordingStatusCallbackMethod", *params.ConferenceRecordingStatusCallbackMethod) + } + if params != nil && params.Region != nil { + data.Set("Region", *params.Region) + } + if params != nil && params.SipAuthUsername != nil { + data.Set("SipAuthUsername", *params.SipAuthUsername) + } + if params != nil && params.SipAuthPassword != nil { + data.Set("SipAuthPassword", *params.SipAuthPassword) + } + if params != nil && params.DequeueStatusCallbackEvent != nil { + for _, item := range *params.DequeueStatusCallbackEvent { + data.Add("DequeueStatusCallbackEvent", item) + } + } + if params != nil && params.PostWorkActivitySid != nil { + data.Set("PostWorkActivitySid", *params.PostWorkActivitySid) + } + if params != nil && params.SupervisorMode != nil { + data.Set("SupervisorMode", *params.SupervisorMode) + } + if params != nil && params.Supervisor != nil { + data.Set("Supervisor", *params.Supervisor) + } + if params != nil && params.EndConferenceOnCustomerExit != nil { + data.Set("EndConferenceOnCustomerExit", fmt.Sprint(*params.EndConferenceOnCustomerExit)) + } + if params != nil && params.BeepOnCustomerEntrance != nil { + data.Set("BeepOnCustomerEntrance", fmt.Sprint(*params.BeepOnCustomerEntrance)) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ReservationStatus != nil { - data.Set("ReservationStatus", *params.ReservationStatus) - } - if params != nil && params.WorkerActivitySid != nil { - data.Set("WorkerActivitySid", *params.WorkerActivitySid) - } - if params != nil && params.Instruction != nil { - data.Set("Instruction", *params.Instruction) - } - if params != nil && params.DequeuePostWorkActivitySid != nil { - data.Set("DequeuePostWorkActivitySid", *params.DequeuePostWorkActivitySid) - } - if params != nil && params.DequeueFrom != nil { - data.Set("DequeueFrom", *params.DequeueFrom) - } - if params != nil && params.DequeueRecord != nil { - data.Set("DequeueRecord", *params.DequeueRecord) - } - if params != nil && params.DequeueTimeout != nil { - data.Set("DequeueTimeout", fmt.Sprint(*params.DequeueTimeout)) - } - if params != nil && params.DequeueTo != nil { - data.Set("DequeueTo", *params.DequeueTo) - } - if params != nil && params.DequeueStatusCallbackUrl != nil { - data.Set("DequeueStatusCallbackUrl", *params.DequeueStatusCallbackUrl) - } - if params != nil && params.CallFrom != nil { - data.Set("CallFrom", *params.CallFrom) - } - if params != nil && params.CallRecord != nil { - data.Set("CallRecord", *params.CallRecord) - } - if params != nil && params.CallTimeout != nil { - data.Set("CallTimeout", fmt.Sprint(*params.CallTimeout)) - } - if params != nil && params.CallTo != nil { - data.Set("CallTo", *params.CallTo) - } - if params != nil && params.CallUrl != nil { - data.Set("CallUrl", *params.CallUrl) - } - if params != nil && params.CallStatusCallbackUrl != nil { - data.Set("CallStatusCallbackUrl", *params.CallStatusCallbackUrl) - } - if params != nil && params.CallAccept != nil { - data.Set("CallAccept", fmt.Sprint(*params.CallAccept)) - } - if params != nil && params.RedirectCallSid != nil { - data.Set("RedirectCallSid", *params.RedirectCallSid) - } - if params != nil && params.RedirectAccept != nil { - data.Set("RedirectAccept", fmt.Sprint(*params.RedirectAccept)) - } - if params != nil && params.RedirectUrl != nil { - data.Set("RedirectUrl", *params.RedirectUrl) - } - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.StatusCallbackEvent != nil { - for _, item := range *params.StatusCallbackEvent { - data.Add("StatusCallbackEvent", item) - } - } - if params != nil && params.Timeout != nil { - data.Set("Timeout", fmt.Sprint(*params.Timeout)) - } - if params != nil && params.Record != nil { - data.Set("Record", fmt.Sprint(*params.Record)) - } - if params != nil && params.Muted != nil { - data.Set("Muted", fmt.Sprint(*params.Muted)) - } - if params != nil && params.Beep != nil { - data.Set("Beep", *params.Beep) - } - if params != nil && params.StartConferenceOnEnter != nil { - data.Set("StartConferenceOnEnter", fmt.Sprint(*params.StartConferenceOnEnter)) - } - if params != nil && params.EndConferenceOnExit != nil { - data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) - } - if params != nil && params.WaitUrl != nil { - data.Set("WaitUrl", *params.WaitUrl) - } - if params != nil && params.WaitMethod != nil { - data.Set("WaitMethod", *params.WaitMethod) - } - if params != nil && params.EarlyMedia != nil { - data.Set("EarlyMedia", fmt.Sprint(*params.EarlyMedia)) - } - if params != nil && params.MaxParticipants != nil { - data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) - } - if params != nil && params.ConferenceStatusCallback != nil { - data.Set("ConferenceStatusCallback", *params.ConferenceStatusCallback) - } - if params != nil && params.ConferenceStatusCallbackMethod != nil { - data.Set("ConferenceStatusCallbackMethod", *params.ConferenceStatusCallbackMethod) - } - if params != nil && params.ConferenceStatusCallbackEvent != nil { - for _, item := range *params.ConferenceStatusCallbackEvent { - data.Add("ConferenceStatusCallbackEvent", item) - } - } - if params != nil && params.ConferenceRecord != nil { - data.Set("ConferenceRecord", *params.ConferenceRecord) - } - if params != nil && params.ConferenceTrim != nil { - data.Set("ConferenceTrim", *params.ConferenceTrim) - } - if params != nil && params.RecordingChannels != nil { - data.Set("RecordingChannels", *params.RecordingChannels) - } - if params != nil && params.RecordingStatusCallback != nil { - data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) - } - if params != nil && params.RecordingStatusCallbackMethod != nil { - data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) - } - if params != nil && params.ConferenceRecordingStatusCallback != nil { - data.Set("ConferenceRecordingStatusCallback", *params.ConferenceRecordingStatusCallback) - } - if params != nil && params.ConferenceRecordingStatusCallbackMethod != nil { - data.Set("ConferenceRecordingStatusCallbackMethod", *params.ConferenceRecordingStatusCallbackMethod) - } - if params != nil && params.Region != nil { - data.Set("Region", *params.Region) - } - if params != nil && params.SipAuthUsername != nil { - data.Set("SipAuthUsername", *params.SipAuthUsername) - } - if params != nil && params.SipAuthPassword != nil { - data.Set("SipAuthPassword", *params.SipAuthPassword) - } - if params != nil && params.DequeueStatusCallbackEvent != nil { - for _, item := range *params.DequeueStatusCallbackEvent { - data.Add("DequeueStatusCallbackEvent", item) - } - } - if params != nil && params.PostWorkActivitySid != nil { - data.Set("PostWorkActivitySid", *params.PostWorkActivitySid) - } - if params != nil && params.SupervisorMode != nil { - data.Set("SupervisorMode", *params.SupervisorMode) - } - if params != nil && params.Supervisor != nil { - data.Set("Supervisor", *params.Supervisor) - } - if params != nil && params.EndConferenceOnCustomerExit != nil { - data.Set("EndConferenceOnCustomerExit", fmt.Sprint(*params.EndConferenceOnCustomerExit)) - } - if params != nil && params.BeepOnCustomerEntrance != nil { - data.Set("BeepOnCustomerEntrance", fmt.Sprint(*params.BeepOnCustomerEntrance)) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1TaskReservation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1TaskReservation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workers.go b/rest/taskrouter/v1/workspaces_workers.go index 5fcf6d949..42d11237a 100644 --- a/rest/taskrouter/v1/workspaces_workers.go +++ b/rest/taskrouter/v1/workspaces_workers.go @@ -18,247 +18,251 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWorker' type CreateWorkerParams struct { - // A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. - ActivitySid *string `json:"ActivitySid,omitempty"` - // A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. - Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the new Worker. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. + ActivitySid *string `json:"ActivitySid,omitempty"` + // A valid JSON string that describes the new Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. + Attributes *string `json:"Attributes,omitempty"` } -func (params *CreateWorkerParams) SetFriendlyName(FriendlyName string) *CreateWorkerParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateWorkerParams) SetFriendlyName(FriendlyName string) (*CreateWorkerParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateWorkerParams) SetActivitySid(ActivitySid string) *CreateWorkerParams { - params.ActivitySid = &ActivitySid - return params +func (params *CreateWorkerParams) SetActivitySid(ActivitySid string) (*CreateWorkerParams){ + params.ActivitySid = &ActivitySid + return params } -func (params *CreateWorkerParams) SetAttributes(Attributes string) *CreateWorkerParams { - params.Attributes = &Attributes - return params +func (params *CreateWorkerParams) SetAttributes(Attributes string) (*CreateWorkerParams){ + params.Attributes = &Attributes + return params } -// +// func (c *ApiService) CreateWorker(WorkspaceSid string, params *CreateWorkerParams) (*TaskrouterV1Worker, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workers" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ActivitySid != nil { - data.Set("ActivitySid", *params.ActivitySid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ActivitySid != nil { + data.Set("ActivitySid", *params.ActivitySid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1Worker{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &TaskrouterV1Worker{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'DeleteWorker' type DeleteWorkerParams struct { - // The If-Match HTTP request header - IfMatch *string `json:"If-Match,omitempty"` + // The If-Match HTTP request header + IfMatch *string `json:"If-Match,omitempty"` } -func (params *DeleteWorkerParams) SetIfMatch(IfMatch string) *DeleteWorkerParams { - params.IfMatch = &IfMatch - return params +func (params *DeleteWorkerParams) SetIfMatch(IfMatch string) (*DeleteWorkerParams){ + params.IfMatch = &IfMatch + return params } -// -func (c *ApiService) DeleteWorker(WorkspaceSid string, Sid string, params *DeleteWorkerParams) error { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteWorker(WorkspaceSid string, Sid string, params *DeleteWorkerParams) (error) { + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } -// -func (c *ApiService) FetchWorker(WorkspaceSid string, Sid string) (*TaskrouterV1Worker, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchWorker(WorkspaceSid string, Sid string, ) (*TaskrouterV1Worker, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TaskrouterV1Worker{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &TaskrouterV1Worker{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListWorker' type ListWorkerParams struct { - // The `activity_name` of the Worker resources to read. - ActivityName *string `json:"ActivityName,omitempty"` - // The `activity_sid` of the Worker resources to read. - ActivitySid *string `json:"ActivitySid,omitempty"` - // Whether to return only Worker resources that are available or unavailable. Can be `true`, `1`, or `yes` to return Worker resources that are available, and `false`, or any value returns the Worker resources that are not available. - Available *string `json:"Available,omitempty"` - // The `friendly_name` of the Worker resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Filter by Workers that would match an expression. In addition to fields in the workers' attributes, the expression can include the following worker fields: `sid`, `friendly_name`, `activity_sid`, or `activity_name` - TargetWorkersExpression *string `json:"TargetWorkersExpression,omitempty"` - // The `friendly_name` of the TaskQueue that the Workers to read are eligible for. - TaskQueueName *string `json:"TaskQueueName,omitempty"` - // The SID of the TaskQueue that the Workers to read are eligible for. - TaskQueueSid *string `json:"TaskQueueSid,omitempty"` - // Sorting parameter for Workers - Ordering *string `json:"Ordering,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListWorkerParams) SetActivityName(ActivityName string) *ListWorkerParams { - params.ActivityName = &ActivityName - return params -} -func (params *ListWorkerParams) SetActivitySid(ActivitySid string) *ListWorkerParams { - params.ActivitySid = &ActivitySid - return params -} -func (params *ListWorkerParams) SetAvailable(Available string) *ListWorkerParams { - params.Available = &Available - return params -} -func (params *ListWorkerParams) SetFriendlyName(FriendlyName string) *ListWorkerParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *ListWorkerParams) SetTargetWorkersExpression(TargetWorkersExpression string) *ListWorkerParams { - params.TargetWorkersExpression = &TargetWorkersExpression - return params -} -func (params *ListWorkerParams) SetTaskQueueName(TaskQueueName string) *ListWorkerParams { - params.TaskQueueName = &TaskQueueName - return params -} -func (params *ListWorkerParams) SetTaskQueueSid(TaskQueueSid string) *ListWorkerParams { - params.TaskQueueSid = &TaskQueueSid - return params -} -func (params *ListWorkerParams) SetOrdering(Ordering string) *ListWorkerParams { - params.Ordering = &Ordering - return params -} -func (params *ListWorkerParams) SetPageSize(PageSize int) *ListWorkerParams { - params.PageSize = &PageSize - return params -} -func (params *ListWorkerParams) SetLimit(Limit int) *ListWorkerParams { - params.Limit = &Limit - return params + // The `activity_name` of the Worker resources to read. + ActivityName *string `json:"ActivityName,omitempty"` + // The `activity_sid` of the Worker resources to read. + ActivitySid *string `json:"ActivitySid,omitempty"` + // Whether to return only Worker resources that are available or unavailable. Can be `true`, `1`, or `yes` to return Worker resources that are available, and `false`, or any value returns the Worker resources that are not available. + Available *string `json:"Available,omitempty"` + // The `friendly_name` of the Worker resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Filter by Workers that would match an expression. In addition to fields in the workers' attributes, the expression can include the following worker fields: `sid`, `friendly_name`, `activity_sid`, or `activity_name` + TargetWorkersExpression *string `json:"TargetWorkersExpression,omitempty"` + // The `friendly_name` of the TaskQueue that the Workers to read are eligible for. + TaskQueueName *string `json:"TaskQueueName,omitempty"` + // The SID of the TaskQueue that the Workers to read are eligible for. + TaskQueueSid *string `json:"TaskQueueSid,omitempty"` + // Sorting parameter for Workers + Ordering *string `json:"Ordering,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListWorkerParams) SetActivityName(ActivityName string) (*ListWorkerParams){ + params.ActivityName = &ActivityName + return params +} +func (params *ListWorkerParams) SetActivitySid(ActivitySid string) (*ListWorkerParams){ + params.ActivitySid = &ActivitySid + return params +} +func (params *ListWorkerParams) SetAvailable(Available string) (*ListWorkerParams){ + params.Available = &Available + return params +} +func (params *ListWorkerParams) SetFriendlyName(FriendlyName string) (*ListWorkerParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *ListWorkerParams) SetTargetWorkersExpression(TargetWorkersExpression string) (*ListWorkerParams){ + params.TargetWorkersExpression = &TargetWorkersExpression + return params +} +func (params *ListWorkerParams) SetTaskQueueName(TaskQueueName string) (*ListWorkerParams){ + params.TaskQueueName = &TaskQueueName + return params +} +func (params *ListWorkerParams) SetTaskQueueSid(TaskQueueSid string) (*ListWorkerParams){ + params.TaskQueueSid = &TaskQueueSid + return params +} +func (params *ListWorkerParams) SetOrdering(Ordering string) (*ListWorkerParams){ + params.Ordering = &Ordering + return params +} +func (params *ListWorkerParams) SetPageSize(PageSize int) (*ListWorkerParams){ + params.PageSize = &PageSize + return params +} +func (params *ListWorkerParams) SetLimit(Limit int) (*ListWorkerParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Worker records from the API. Request is executed immediately. func (c *ApiService) PageWorker(WorkspaceSid string, params *ListWorkerParams, pageToken, pageNumber string) (*ListWorkerResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers" - - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ActivityName != nil { - data.Set("ActivityName", *params.ActivityName) - } - if params != nil && params.ActivitySid != nil { - data.Set("ActivitySid", *params.ActivitySid) - } - if params != nil && params.Available != nil { - data.Set("Available", *params.Available) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.TargetWorkersExpression != nil { - data.Set("TargetWorkersExpression", *params.TargetWorkersExpression) - } - if params != nil && params.TaskQueueName != nil { - data.Set("TaskQueueName", *params.TaskQueueName) - } - if params != nil && params.TaskQueueSid != nil { - data.Set("TaskQueueSid", *params.TaskQueueSid) - } - if params != nil && params.Ordering != nil { - data.Set("Ordering", *params.Ordering) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWorkerResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Workers" + + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ActivityName != nil { + data.Set("ActivityName", *params.ActivityName) + } + if params != nil && params.ActivitySid != nil { + data.Set("ActivitySid", *params.ActivitySid) + } + if params != nil && params.Available != nil { + data.Set("Available", *params.Available) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.TargetWorkersExpression != nil { + data.Set("TargetWorkersExpression", *params.TargetWorkersExpression) + } + if params != nil && params.TaskQueueName != nil { + data.Set("TaskQueueName", *params.TaskQueueName) + } + if params != nil && params.TaskQueueSid != nil { + data.Set("TaskQueueSid", *params.TaskQueueSid) + } + if params != nil && params.Ordering != nil { + data.Set("Ordering", *params.Ordering) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWorkerResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Worker records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -299,6 +303,7 @@ func (c *ApiService) StreamWorker(WorkspaceSid string, params *ListWorkerParams) return recordChannel, errorChannel } + func (c *ApiService) streamWorker(response *ListWorkerResponse, params *ListWorkerParams, recordChannel chan TaskrouterV1Worker, errorChannel chan error) { curRecord := 1 @@ -330,95 +335,96 @@ func (c *ApiService) streamWorker(response *ListWorkerResponse, params *ListWork } func (c *ApiService) getNextListWorkerResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWorkerResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListWorkerResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWorker' type UpdateWorkerParams struct { - // The If-Match HTTP request header - IfMatch *string `json:"If-Match,omitempty"` - // The SID of a valid Activity that will describe the Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. - ActivitySid *string `json:"ActivitySid,omitempty"` - // The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. - Attributes *string `json:"Attributes,omitempty"` - // A descriptive string that you create to describe the Worker. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. - RejectPendingReservations *bool `json:"RejectPendingReservations,omitempty"` + // The If-Match HTTP request header + IfMatch *string `json:"If-Match,omitempty"` + // The SID of a valid Activity that will describe the Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. + ActivitySid *string `json:"ActivitySid,omitempty"` + // The JSON string that describes the Worker. For example: `{ \\\"email\\\": \\\"Bob@example.com\\\", \\\"phone\\\": \\\"+5095551234\\\" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. + Attributes *string `json:"Attributes,omitempty"` + // A descriptive string that you create to describe the Worker. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. + RejectPendingReservations *bool `json:"RejectPendingReservations,omitempty"` } -func (params *UpdateWorkerParams) SetIfMatch(IfMatch string) *UpdateWorkerParams { - params.IfMatch = &IfMatch - return params +func (params *UpdateWorkerParams) SetIfMatch(IfMatch string) (*UpdateWorkerParams){ + params.IfMatch = &IfMatch + return params } -func (params *UpdateWorkerParams) SetActivitySid(ActivitySid string) *UpdateWorkerParams { - params.ActivitySid = &ActivitySid - return params +func (params *UpdateWorkerParams) SetActivitySid(ActivitySid string) (*UpdateWorkerParams){ + params.ActivitySid = &ActivitySid + return params } -func (params *UpdateWorkerParams) SetAttributes(Attributes string) *UpdateWorkerParams { - params.Attributes = &Attributes - return params +func (params *UpdateWorkerParams) SetAttributes(Attributes string) (*UpdateWorkerParams){ + params.Attributes = &Attributes + return params } -func (params *UpdateWorkerParams) SetFriendlyName(FriendlyName string) *UpdateWorkerParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateWorkerParams) SetFriendlyName(FriendlyName string) (*UpdateWorkerParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateWorkerParams) SetRejectPendingReservations(RejectPendingReservations bool) *UpdateWorkerParams { - params.RejectPendingReservations = &RejectPendingReservations - return params +func (params *UpdateWorkerParams) SetRejectPendingReservations(RejectPendingReservations bool) (*UpdateWorkerParams){ + params.RejectPendingReservations = &RejectPendingReservations + return params } -// +// func (c *ApiService) UpdateWorker(WorkspaceSid string, Sid string, params *UpdateWorkerParams) (*TaskrouterV1Worker, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ActivitySid != nil { + data.Set("ActivitySid", *params.ActivitySid) + } + if params != nil && params.Attributes != nil { + data.Set("Attributes", *params.Attributes) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.RejectPendingReservations != nil { + data.Set("RejectPendingReservations", fmt.Sprint(*params.RejectPendingReservations)) + } - if params != nil && params.ActivitySid != nil { - data.Set("ActivitySid", *params.ActivitySid) - } - if params != nil && params.Attributes != nil { - data.Set("Attributes", *params.Attributes) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.RejectPendingReservations != nil { - data.Set("RejectPendingReservations", fmt.Sprint(*params.RejectPendingReservations)) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1Worker{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1Worker{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workers_channels.go b/rest/taskrouter/v1/workspaces_workers_channels.go index d6e72fafb..079e21b61 100644 --- a/rest/taskrouter/v1/workspaces_workers_channels.go +++ b/rest/taskrouter/v1/workspaces_workers_channels.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchWorkerChannel(WorkspaceSid string, WorkerSid string, Sid string) (*TaskrouterV1WorkerChannel, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchWorkerChannel(WorkspaceSid string, WorkerSid string, Sid string, ) (*TaskrouterV1WorkerChannel, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &TaskrouterV1WorkerChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1WorkerChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListWorkerChannel' type ListWorkerChannelParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWorkerChannelParams) SetPageSize(PageSize int) *ListWorkerChannelParams { - params.PageSize = &PageSize - return params +func (params *ListWorkerChannelParams) SetPageSize(PageSize int) (*ListWorkerChannelParams){ + params.PageSize = &PageSize + return params } -func (params *ListWorkerChannelParams) SetLimit(Limit int) *ListWorkerChannelParams { - params.Limit = &Limit - return params +func (params *ListWorkerChannelParams) SetLimit(Limit int) (*ListWorkerChannelParams){ + params.Limit = &Limit + return params } // Retrieve a single page of WorkerChannel records from the API. Request is executed immediately. func (c *ApiService) PageWorkerChannel(WorkspaceSid string, WorkerSid string, params *ListWorkerChannelParams, pageToken, pageNumber string) (*ListWorkerChannelResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels" + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWorkerChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListWorkerChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists WorkerChannel records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamWorkerChannel(WorkspaceSid string, WorkerSid string, return recordChannel, errorChannel } + func (c *ApiService) streamWorkerChannel(response *ListWorkerChannelResponse, params *ListWorkerChannelParams, recordChannel chan TaskrouterV1WorkerChannel, errorChannel chan error) { curRecord := 1 @@ -170,68 +173,70 @@ func (c *ApiService) streamWorkerChannel(response *ListWorkerChannelResponse, pa } func (c *ApiService) getNextListWorkerChannelResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWorkerChannelResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWorkerChannelResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWorkerChannel' type UpdateWorkerChannelParams struct { - // The total number of Tasks that the Worker should handle for the TaskChannel type. TaskRouter creates reservations for Tasks of this TaskChannel type up to the specified capacity. If the capacity is 0, no new reservations will be created. - Capacity *int `json:"Capacity,omitempty"` - // Whether the WorkerChannel is available. Set to `false` to prevent the Worker from receiving any new Tasks of this TaskChannel type. - Available *bool `json:"Available,omitempty"` + // The total number of Tasks that the Worker should handle for the TaskChannel type. TaskRouter creates reservations for Tasks of this TaskChannel type up to the specified capacity. If the capacity is 0, no new reservations will be created. + Capacity *int `json:"Capacity,omitempty"` + // Whether the WorkerChannel is available. Set to `false` to prevent the Worker from receiving any new Tasks of this TaskChannel type. + Available *bool `json:"Available,omitempty"` } -func (params *UpdateWorkerChannelParams) SetCapacity(Capacity int) *UpdateWorkerChannelParams { - params.Capacity = &Capacity - return params +func (params *UpdateWorkerChannelParams) SetCapacity(Capacity int) (*UpdateWorkerChannelParams){ + params.Capacity = &Capacity + return params } -func (params *UpdateWorkerChannelParams) SetAvailable(Available bool) *UpdateWorkerChannelParams { - params.Available = &Available - return params +func (params *UpdateWorkerChannelParams) SetAvailable(Available bool) (*UpdateWorkerChannelParams){ + params.Available = &Available + return params } -// +// func (c *ApiService) UpdateWorkerChannel(WorkspaceSid string, WorkerSid string, Sid string, params *UpdateWorkerChannelParams) (*TaskrouterV1WorkerChannel, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Channels/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Capacity != nil { - data.Set("Capacity", fmt.Sprint(*params.Capacity)) - } - if params != nil && params.Available != nil { - data.Set("Available", fmt.Sprint(*params.Available)) - } + if params != nil && params.Capacity != nil { + data.Set("Capacity", fmt.Sprint(*params.Capacity)) + } + if params != nil && params.Available != nil { + data.Set("Available", fmt.Sprint(*params.Available)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TaskrouterV1WorkerChannel{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TaskrouterV1WorkerChannel{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workers_cumulative_statistics.go b/rest/taskrouter/v1/workspaces_workers_cumulative_statistics.go index a6bdc0626..eb7b5edab 100644 --- a/rest/taskrouter/v1/workspaces_workers_cumulative_statistics.go +++ b/rest/taskrouter/v1/workspaces_workers_cumulative_statistics.go @@ -18,71 +18,73 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkersCumulativeStatistics' type FetchWorkersCumulativeStatisticsParams struct { - // Only calculate statistics from this date and time and earlier, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchWorkersCumulativeStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkersCumulativeStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkersCumulativeStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkersCumulativeStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkersCumulativeStatisticsParams) SetMinutes(Minutes int) *FetchWorkersCumulativeStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkersCumulativeStatisticsParams) SetMinutes(Minutes int) (*FetchWorkersCumulativeStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkersCumulativeStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkersCumulativeStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkersCumulativeStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkersCumulativeStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkersCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkersCumulativeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkersCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkersCumulativeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchWorkersCumulativeStatistics(WorkspaceSid string, params *FetchWorkersCumulativeStatisticsParams) (*TaskrouterV1WorkersCumulativeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/CumulativeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workers/CumulativeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkersCumulativeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkersCumulativeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workers_real_time_statistics.go b/rest/taskrouter/v1/workspaces_workers_real_time_statistics.go index 7fa3f4fe4..0facafff5 100644 --- a/rest/taskrouter/v1/workspaces_workers_real_time_statistics.go +++ b/rest/taskrouter/v1/workspaces_workers_real_time_statistics.go @@ -16,44 +16,48 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkersRealTimeStatistics' type FetchWorkersRealTimeStatisticsParams struct { - // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchWorkersRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkersRealTimeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkersRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkersRealTimeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchWorkersRealTimeStatistics(WorkspaceSid string, params *FetchWorkersRealTimeStatisticsParams) (*TaskrouterV1WorkersRealTimeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkersRealTimeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkersRealTimeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workers_reservations.go b/rest/taskrouter/v1/workspaces_workers_reservations.go index b4da3e341..c7f5fb309 100644 --- a/rest/taskrouter/v1/workspaces_workers_reservations.go +++ b/rest/taskrouter/v1/workspaces_workers_reservations.go @@ -18,96 +18,98 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchWorkerReservation(WorkspaceSid string, WorkerSid string, Sid string) (*TaskrouterV1WorkerReservation, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchWorkerReservation(WorkspaceSid string, WorkerSid string, Sid string, ) (*TaskrouterV1WorkerReservation, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &TaskrouterV1WorkerReservation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1WorkerReservation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListWorkerReservation' type ListWorkerReservationParams struct { - // Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. - ReservationStatus *string `json:"ReservationStatus,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. + ReservationStatus *string `json:"ReservationStatus,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWorkerReservationParams) SetReservationStatus(ReservationStatus string) *ListWorkerReservationParams { - params.ReservationStatus = &ReservationStatus - return params +func (params *ListWorkerReservationParams) SetReservationStatus(ReservationStatus string) (*ListWorkerReservationParams){ + params.ReservationStatus = &ReservationStatus + return params } -func (params *ListWorkerReservationParams) SetPageSize(PageSize int) *ListWorkerReservationParams { - params.PageSize = &PageSize - return params +func (params *ListWorkerReservationParams) SetPageSize(PageSize int) (*ListWorkerReservationParams){ + params.PageSize = &PageSize + return params } -func (params *ListWorkerReservationParams) SetLimit(Limit int) *ListWorkerReservationParams { - params.Limit = &Limit - return params +func (params *ListWorkerReservationParams) SetLimit(Limit int) (*ListWorkerReservationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of WorkerReservation records from the API. Request is executed immediately. func (c *ApiService) PageWorkerReservation(WorkspaceSid string, WorkerSid string, params *ListWorkerReservationParams, pageToken, pageNumber string) (*ListWorkerReservationResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations" + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ReservationStatus != nil { - data.Set("ReservationStatus", *params.ReservationStatus) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.ReservationStatus != nil { + data.Set("ReservationStatus", *params.ReservationStatus) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWorkerReservationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListWorkerReservationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists WorkerReservation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -148,6 +150,7 @@ func (c *ApiService) StreamWorkerReservation(WorkspaceSid string, WorkerSid stri return recordChannel, errorChannel } + func (c *ApiService) streamWorkerReservation(response *ListWorkerReservationResponse, params *ListWorkerReservationParams, recordChannel chan TaskrouterV1WorkerReservation, errorChannel chan error) { curRecord := 1 @@ -179,525 +182,526 @@ func (c *ApiService) streamWorkerReservation(response *ListWorkerReservationResp } func (c *ApiService) getNextListWorkerReservationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWorkerReservationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListWorkerReservationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWorkerReservation' type UpdateWorkerReservationParams struct { - // The If-Match HTTP request header - IfMatch *string `json:"If-Match,omitempty"` - // - ReservationStatus *string `json:"ReservationStatus,omitempty"` - // The new worker activity SID if rejecting a reservation. - WorkerActivitySid *string `json:"WorkerActivitySid,omitempty"` - // The assignment instruction for the reservation. - Instruction *string `json:"Instruction,omitempty"` - // The SID of the Activity resource to start after executing a Dequeue instruction. - DequeuePostWorkActivitySid *string `json:"DequeuePostWorkActivitySid,omitempty"` - // The caller ID of the call to the worker when executing a Dequeue instruction. - DequeueFrom *string `json:"DequeueFrom,omitempty"` - // Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. - DequeueRecord *string `json:"DequeueRecord,omitempty"` - // The timeout for call when executing a Dequeue instruction. - DequeueTimeout *int `json:"DequeueTimeout,omitempty"` - // The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. - DequeueTo *string `json:"DequeueTo,omitempty"` - // The callback URL for completed call event when executing a Dequeue instruction. - DequeueStatusCallbackUrl *string `json:"DequeueStatusCallbackUrl,omitempty"` - // The Caller ID of the outbound call when executing a Call instruction. - CallFrom *string `json:"CallFrom,omitempty"` - // Whether to record both legs of a call when executing a Call instruction. - CallRecord *string `json:"CallRecord,omitempty"` - // The timeout for a call when executing a Call instruction. - CallTimeout *int `json:"CallTimeout,omitempty"` - // The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. - CallTo *string `json:"CallTo,omitempty"` - // TwiML URI executed on answering the worker's leg as a result of the Call instruction. - CallUrl *string `json:"CallUrl,omitempty"` - // The URL to call for the completed call event when executing a Call instruction. - CallStatusCallbackUrl *string `json:"CallStatusCallbackUrl,omitempty"` - // Whether to accept a reservation when executing a Call instruction. - CallAccept *bool `json:"CallAccept,omitempty"` - // The Call SID of the call parked in the queue when executing a Redirect instruction. - RedirectCallSid *string `json:"RedirectCallSid,omitempty"` - // Whether the reservation should be accepted when executing a Redirect instruction. - RedirectAccept *bool `json:"RedirectAccept,omitempty"` - // TwiML URI to redirect the call to when executing the Redirect instruction. - RedirectUrl *string `json:"RedirectUrl,omitempty"` - // The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. - To *string `json:"To,omitempty"` - // The caller ID of the call to the worker when executing a Conference instruction. - From *string `json:"From,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. - StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` - // The timeout for a call when executing a Conference instruction. - Timeout *int `json:"Timeout,omitempty"` - // Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. - Record *bool `json:"Record,omitempty"` - // Whether the agent is muted in the conference. Defaults to `false`. - Muted *bool `json:"Muted,omitempty"` - // Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. - Beep *string `json:"Beep,omitempty"` - // Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. - StartConferenceOnEnter *bool `json:"StartConferenceOnEnter,omitempty"` - // Whether to end the conference when the agent leaves. - EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` - // The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). - WaitUrl *string `json:"WaitUrl,omitempty"` - // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. - WaitMethod *string `json:"WaitMethod,omitempty"` - // Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. - EarlyMedia *bool `json:"EarlyMedia,omitempty"` - // The maximum number of participants allowed in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. - MaxParticipants *int `json:"MaxParticipants,omitempty"` - // The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. - ConferenceStatusCallback *string `json:"ConferenceStatusCallback,omitempty"` - // The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - ConferenceStatusCallbackMethod *string `json:"ConferenceStatusCallbackMethod,omitempty"` - // The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. - ConferenceStatusCallbackEvent *[]string `json:"ConferenceStatusCallbackEvent,omitempty"` - // Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. - ConferenceRecord *string `json:"ConferenceRecord,omitempty"` - // Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. - ConferenceTrim *string `json:"ConferenceTrim,omitempty"` - // The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. - RecordingChannels *string `json:"RecordingChannels,omitempty"` - // The URL that we should call using the `recording_status_callback_method` when the recording status changes. - RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` - // The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` - // The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. - ConferenceRecordingStatusCallback *string `json:"ConferenceRecordingStatusCallback,omitempty"` - // The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. - ConferenceRecordingStatusCallbackMethod *string `json:"ConferenceRecordingStatusCallbackMethod,omitempty"` - // The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. - Region *string `json:"Region,omitempty"` - // The SIP username used for authentication. - SipAuthUsername *string `json:"SipAuthUsername,omitempty"` - // The SIP password for authentication. - SipAuthPassword *string `json:"SipAuthPassword,omitempty"` - // The call progress events sent via webhooks as a result of a Dequeue instruction. - DequeueStatusCallbackEvent *[]string `json:"DequeueStatusCallbackEvent,omitempty"` - // The new worker activity SID after executing a Conference instruction. - PostWorkActivitySid *string `json:"PostWorkActivitySid,omitempty"` - // Whether to end the conference when the customer leaves. - EndConferenceOnCustomerExit *bool `json:"EndConferenceOnCustomerExit,omitempty"` - // Whether to play a notification beep when the customer joins. - BeepOnCustomerEntrance *bool `json:"BeepOnCustomerEntrance,omitempty"` -} - -func (params *UpdateWorkerReservationParams) SetIfMatch(IfMatch string) *UpdateWorkerReservationParams { - params.IfMatch = &IfMatch - return params -} -func (params *UpdateWorkerReservationParams) SetReservationStatus(ReservationStatus string) *UpdateWorkerReservationParams { - params.ReservationStatus = &ReservationStatus - return params -} -func (params *UpdateWorkerReservationParams) SetWorkerActivitySid(WorkerActivitySid string) *UpdateWorkerReservationParams { - params.WorkerActivitySid = &WorkerActivitySid - return params -} -func (params *UpdateWorkerReservationParams) SetInstruction(Instruction string) *UpdateWorkerReservationParams { - params.Instruction = &Instruction - return params -} -func (params *UpdateWorkerReservationParams) SetDequeuePostWorkActivitySid(DequeuePostWorkActivitySid string) *UpdateWorkerReservationParams { - params.DequeuePostWorkActivitySid = &DequeuePostWorkActivitySid - return params -} -func (params *UpdateWorkerReservationParams) SetDequeueFrom(DequeueFrom string) *UpdateWorkerReservationParams { - params.DequeueFrom = &DequeueFrom - return params -} -func (params *UpdateWorkerReservationParams) SetDequeueRecord(DequeueRecord string) *UpdateWorkerReservationParams { - params.DequeueRecord = &DequeueRecord - return params -} -func (params *UpdateWorkerReservationParams) SetDequeueTimeout(DequeueTimeout int) *UpdateWorkerReservationParams { - params.DequeueTimeout = &DequeueTimeout - return params -} -func (params *UpdateWorkerReservationParams) SetDequeueTo(DequeueTo string) *UpdateWorkerReservationParams { - params.DequeueTo = &DequeueTo - return params -} -func (params *UpdateWorkerReservationParams) SetDequeueStatusCallbackUrl(DequeueStatusCallbackUrl string) *UpdateWorkerReservationParams { - params.DequeueStatusCallbackUrl = &DequeueStatusCallbackUrl - return params -} -func (params *UpdateWorkerReservationParams) SetCallFrom(CallFrom string) *UpdateWorkerReservationParams { - params.CallFrom = &CallFrom - return params -} -func (params *UpdateWorkerReservationParams) SetCallRecord(CallRecord string) *UpdateWorkerReservationParams { - params.CallRecord = &CallRecord - return params -} -func (params *UpdateWorkerReservationParams) SetCallTimeout(CallTimeout int) *UpdateWorkerReservationParams { - params.CallTimeout = &CallTimeout - return params -} -func (params *UpdateWorkerReservationParams) SetCallTo(CallTo string) *UpdateWorkerReservationParams { - params.CallTo = &CallTo - return params -} -func (params *UpdateWorkerReservationParams) SetCallUrl(CallUrl string) *UpdateWorkerReservationParams { - params.CallUrl = &CallUrl - return params -} -func (params *UpdateWorkerReservationParams) SetCallStatusCallbackUrl(CallStatusCallbackUrl string) *UpdateWorkerReservationParams { - params.CallStatusCallbackUrl = &CallStatusCallbackUrl - return params -} -func (params *UpdateWorkerReservationParams) SetCallAccept(CallAccept bool) *UpdateWorkerReservationParams { - params.CallAccept = &CallAccept - return params -} -func (params *UpdateWorkerReservationParams) SetRedirectCallSid(RedirectCallSid string) *UpdateWorkerReservationParams { - params.RedirectCallSid = &RedirectCallSid - return params -} -func (params *UpdateWorkerReservationParams) SetRedirectAccept(RedirectAccept bool) *UpdateWorkerReservationParams { - params.RedirectAccept = &RedirectAccept - return params -} -func (params *UpdateWorkerReservationParams) SetRedirectUrl(RedirectUrl string) *UpdateWorkerReservationParams { - params.RedirectUrl = &RedirectUrl - return params -} -func (params *UpdateWorkerReservationParams) SetTo(To string) *UpdateWorkerReservationParams { - params.To = &To - return params -} -func (params *UpdateWorkerReservationParams) SetFrom(From string) *UpdateWorkerReservationParams { - params.From = &From - return params -} -func (params *UpdateWorkerReservationParams) SetStatusCallback(StatusCallback string) *UpdateWorkerReservationParams { - params.StatusCallback = &StatusCallback - return params + // The If-Match HTTP request header + IfMatch *string `json:"If-Match,omitempty"` + // + ReservationStatus *string `json:"ReservationStatus,omitempty"` + // The new worker activity SID if rejecting a reservation. + WorkerActivitySid *string `json:"WorkerActivitySid,omitempty"` + // The assignment instruction for the reservation. + Instruction *string `json:"Instruction,omitempty"` + // The SID of the Activity resource to start after executing a Dequeue instruction. + DequeuePostWorkActivitySid *string `json:"DequeuePostWorkActivitySid,omitempty"` + // The caller ID of the call to the worker when executing a Dequeue instruction. + DequeueFrom *string `json:"DequeueFrom,omitempty"` + // Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. + DequeueRecord *string `json:"DequeueRecord,omitempty"` + // The timeout for call when executing a Dequeue instruction. + DequeueTimeout *int `json:"DequeueTimeout,omitempty"` + // The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + DequeueTo *string `json:"DequeueTo,omitempty"` + // The callback URL for completed call event when executing a Dequeue instruction. + DequeueStatusCallbackUrl *string `json:"DequeueStatusCallbackUrl,omitempty"` + // The Caller ID of the outbound call when executing a Call instruction. + CallFrom *string `json:"CallFrom,omitempty"` + // Whether to record both legs of a call when executing a Call instruction. + CallRecord *string `json:"CallRecord,omitempty"` + // The timeout for a call when executing a Call instruction. + CallTimeout *int `json:"CallTimeout,omitempty"` + // The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + CallTo *string `json:"CallTo,omitempty"` + // TwiML URI executed on answering the worker's leg as a result of the Call instruction. + CallUrl *string `json:"CallUrl,omitempty"` + // The URL to call for the completed call event when executing a Call instruction. + CallStatusCallbackUrl *string `json:"CallStatusCallbackUrl,omitempty"` + // Whether to accept a reservation when executing a Call instruction. + CallAccept *bool `json:"CallAccept,omitempty"` + // The Call SID of the call parked in the queue when executing a Redirect instruction. + RedirectCallSid *string `json:"RedirectCallSid,omitempty"` + // Whether the reservation should be accepted when executing a Redirect instruction. + RedirectAccept *bool `json:"RedirectAccept,omitempty"` + // TwiML URI to redirect the call to when executing the Redirect instruction. + RedirectUrl *string `json:"RedirectUrl,omitempty"` + // The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + To *string `json:"To,omitempty"` + // The caller ID of the call to the worker when executing a Conference instruction. + From *string `json:"From,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. + StatusCallbackEvent *[]string `json:"StatusCallbackEvent,omitempty"` + // The timeout for a call when executing a Conference instruction. + Timeout *int `json:"Timeout,omitempty"` + // Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. + Record *bool `json:"Record,omitempty"` + // Whether the agent is muted in the conference. Defaults to `false`. + Muted *bool `json:"Muted,omitempty"` + // Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. + Beep *string `json:"Beep,omitempty"` + // Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + StartConferenceOnEnter *bool `json:"StartConferenceOnEnter,omitempty"` + // Whether to end the conference when the agent leaves. + EndConferenceOnExit *bool `json:"EndConferenceOnExit,omitempty"` + // The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + WaitUrl *string `json:"WaitUrl,omitempty"` + // The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. + WaitMethod *string `json:"WaitMethod,omitempty"` + // Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. + EarlyMedia *bool `json:"EarlyMedia,omitempty"` + // The maximum number of participants allowed in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. + MaxParticipants *int `json:"MaxParticipants,omitempty"` + // The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. + ConferenceStatusCallback *string `json:"ConferenceStatusCallback,omitempty"` + // The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + ConferenceStatusCallbackMethod *string `json:"ConferenceStatusCallbackMethod,omitempty"` + // The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. + ConferenceStatusCallbackEvent *[]string `json:"ConferenceStatusCallbackEvent,omitempty"` + // Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. + ConferenceRecord *string `json:"ConferenceRecord,omitempty"` + // Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. + ConferenceTrim *string `json:"ConferenceTrim,omitempty"` + // The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. + RecordingChannels *string `json:"RecordingChannels,omitempty"` + // The URL that we should call using the `recording_status_callback_method` when the recording status changes. + RecordingStatusCallback *string `json:"RecordingStatusCallback,omitempty"` + // The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + RecordingStatusCallbackMethod *string `json:"RecordingStatusCallbackMethod,omitempty"` + // The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. + ConferenceRecordingStatusCallback *string `json:"ConferenceRecordingStatusCallback,omitempty"` + // The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + ConferenceRecordingStatusCallbackMethod *string `json:"ConferenceRecordingStatusCallbackMethod,omitempty"` + // The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + Region *string `json:"Region,omitempty"` + // The SIP username used for authentication. + SipAuthUsername *string `json:"SipAuthUsername,omitempty"` + // The SIP password for authentication. + SipAuthPassword *string `json:"SipAuthPassword,omitempty"` + // The call progress events sent via webhooks as a result of a Dequeue instruction. + DequeueStatusCallbackEvent *[]string `json:"DequeueStatusCallbackEvent,omitempty"` + // The new worker activity SID after executing a Conference instruction. + PostWorkActivitySid *string `json:"PostWorkActivitySid,omitempty"` + // Whether to end the conference when the customer leaves. + EndConferenceOnCustomerExit *bool `json:"EndConferenceOnCustomerExit,omitempty"` + // Whether to play a notification beep when the customer joins. + BeepOnCustomerEntrance *bool `json:"BeepOnCustomerEntrance,omitempty"` +} + +func (params *UpdateWorkerReservationParams) SetIfMatch(IfMatch string) (*UpdateWorkerReservationParams){ + params.IfMatch = &IfMatch + return params +} +func (params *UpdateWorkerReservationParams) SetReservationStatus(ReservationStatus string) (*UpdateWorkerReservationParams){ + params.ReservationStatus = &ReservationStatus + return params +} +func (params *UpdateWorkerReservationParams) SetWorkerActivitySid(WorkerActivitySid string) (*UpdateWorkerReservationParams){ + params.WorkerActivitySid = &WorkerActivitySid + return params +} +func (params *UpdateWorkerReservationParams) SetInstruction(Instruction string) (*UpdateWorkerReservationParams){ + params.Instruction = &Instruction + return params +} +func (params *UpdateWorkerReservationParams) SetDequeuePostWorkActivitySid(DequeuePostWorkActivitySid string) (*UpdateWorkerReservationParams){ + params.DequeuePostWorkActivitySid = &DequeuePostWorkActivitySid + return params +} +func (params *UpdateWorkerReservationParams) SetDequeueFrom(DequeueFrom string) (*UpdateWorkerReservationParams){ + params.DequeueFrom = &DequeueFrom + return params +} +func (params *UpdateWorkerReservationParams) SetDequeueRecord(DequeueRecord string) (*UpdateWorkerReservationParams){ + params.DequeueRecord = &DequeueRecord + return params +} +func (params *UpdateWorkerReservationParams) SetDequeueTimeout(DequeueTimeout int) (*UpdateWorkerReservationParams){ + params.DequeueTimeout = &DequeueTimeout + return params +} +func (params *UpdateWorkerReservationParams) SetDequeueTo(DequeueTo string) (*UpdateWorkerReservationParams){ + params.DequeueTo = &DequeueTo + return params +} +func (params *UpdateWorkerReservationParams) SetDequeueStatusCallbackUrl(DequeueStatusCallbackUrl string) (*UpdateWorkerReservationParams){ + params.DequeueStatusCallbackUrl = &DequeueStatusCallbackUrl + return params +} +func (params *UpdateWorkerReservationParams) SetCallFrom(CallFrom string) (*UpdateWorkerReservationParams){ + params.CallFrom = &CallFrom + return params +} +func (params *UpdateWorkerReservationParams) SetCallRecord(CallRecord string) (*UpdateWorkerReservationParams){ + params.CallRecord = &CallRecord + return params +} +func (params *UpdateWorkerReservationParams) SetCallTimeout(CallTimeout int) (*UpdateWorkerReservationParams){ + params.CallTimeout = &CallTimeout + return params +} +func (params *UpdateWorkerReservationParams) SetCallTo(CallTo string) (*UpdateWorkerReservationParams){ + params.CallTo = &CallTo + return params +} +func (params *UpdateWorkerReservationParams) SetCallUrl(CallUrl string) (*UpdateWorkerReservationParams){ + params.CallUrl = &CallUrl + return params +} +func (params *UpdateWorkerReservationParams) SetCallStatusCallbackUrl(CallStatusCallbackUrl string) (*UpdateWorkerReservationParams){ + params.CallStatusCallbackUrl = &CallStatusCallbackUrl + return params +} +func (params *UpdateWorkerReservationParams) SetCallAccept(CallAccept bool) (*UpdateWorkerReservationParams){ + params.CallAccept = &CallAccept + return params +} +func (params *UpdateWorkerReservationParams) SetRedirectCallSid(RedirectCallSid string) (*UpdateWorkerReservationParams){ + params.RedirectCallSid = &RedirectCallSid + return params +} +func (params *UpdateWorkerReservationParams) SetRedirectAccept(RedirectAccept bool) (*UpdateWorkerReservationParams){ + params.RedirectAccept = &RedirectAccept + return params +} +func (params *UpdateWorkerReservationParams) SetRedirectUrl(RedirectUrl string) (*UpdateWorkerReservationParams){ + params.RedirectUrl = &RedirectUrl + return params +} +func (params *UpdateWorkerReservationParams) SetTo(To string) (*UpdateWorkerReservationParams){ + params.To = &To + return params +} +func (params *UpdateWorkerReservationParams) SetFrom(From string) (*UpdateWorkerReservationParams){ + params.From = &From + return params +} +func (params *UpdateWorkerReservationParams) SetStatusCallback(StatusCallback string) (*UpdateWorkerReservationParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *UpdateWorkerReservationParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateWorkerReservationParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *UpdateWorkerReservationParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateWorkerReservationParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *UpdateWorkerReservationParams) SetStatusCallbackEvent(StatusCallbackEvent []string) *UpdateWorkerReservationParams { - params.StatusCallbackEvent = &StatusCallbackEvent - return params +func (params *UpdateWorkerReservationParams) SetStatusCallbackEvent(StatusCallbackEvent []string) (*UpdateWorkerReservationParams){ + params.StatusCallbackEvent = &StatusCallbackEvent + return params } -func (params *UpdateWorkerReservationParams) SetTimeout(Timeout int) *UpdateWorkerReservationParams { - params.Timeout = &Timeout - return params +func (params *UpdateWorkerReservationParams) SetTimeout(Timeout int) (*UpdateWorkerReservationParams){ + params.Timeout = &Timeout + return params } -func (params *UpdateWorkerReservationParams) SetRecord(Record bool) *UpdateWorkerReservationParams { - params.Record = &Record - return params +func (params *UpdateWorkerReservationParams) SetRecord(Record bool) (*UpdateWorkerReservationParams){ + params.Record = &Record + return params } -func (params *UpdateWorkerReservationParams) SetMuted(Muted bool) *UpdateWorkerReservationParams { - params.Muted = &Muted - return params +func (params *UpdateWorkerReservationParams) SetMuted(Muted bool) (*UpdateWorkerReservationParams){ + params.Muted = &Muted + return params } -func (params *UpdateWorkerReservationParams) SetBeep(Beep string) *UpdateWorkerReservationParams { - params.Beep = &Beep - return params +func (params *UpdateWorkerReservationParams) SetBeep(Beep string) (*UpdateWorkerReservationParams){ + params.Beep = &Beep + return params } -func (params *UpdateWorkerReservationParams) SetStartConferenceOnEnter(StartConferenceOnEnter bool) *UpdateWorkerReservationParams { - params.StartConferenceOnEnter = &StartConferenceOnEnter - return params +func (params *UpdateWorkerReservationParams) SetStartConferenceOnEnter(StartConferenceOnEnter bool) (*UpdateWorkerReservationParams){ + params.StartConferenceOnEnter = &StartConferenceOnEnter + return params } -func (params *UpdateWorkerReservationParams) SetEndConferenceOnExit(EndConferenceOnExit bool) *UpdateWorkerReservationParams { - params.EndConferenceOnExit = &EndConferenceOnExit - return params +func (params *UpdateWorkerReservationParams) SetEndConferenceOnExit(EndConferenceOnExit bool) (*UpdateWorkerReservationParams){ + params.EndConferenceOnExit = &EndConferenceOnExit + return params } -func (params *UpdateWorkerReservationParams) SetWaitUrl(WaitUrl string) *UpdateWorkerReservationParams { - params.WaitUrl = &WaitUrl - return params +func (params *UpdateWorkerReservationParams) SetWaitUrl(WaitUrl string) (*UpdateWorkerReservationParams){ + params.WaitUrl = &WaitUrl + return params } -func (params *UpdateWorkerReservationParams) SetWaitMethod(WaitMethod string) *UpdateWorkerReservationParams { - params.WaitMethod = &WaitMethod - return params +func (params *UpdateWorkerReservationParams) SetWaitMethod(WaitMethod string) (*UpdateWorkerReservationParams){ + params.WaitMethod = &WaitMethod + return params } -func (params *UpdateWorkerReservationParams) SetEarlyMedia(EarlyMedia bool) *UpdateWorkerReservationParams { - params.EarlyMedia = &EarlyMedia - return params +func (params *UpdateWorkerReservationParams) SetEarlyMedia(EarlyMedia bool) (*UpdateWorkerReservationParams){ + params.EarlyMedia = &EarlyMedia + return params } -func (params *UpdateWorkerReservationParams) SetMaxParticipants(MaxParticipants int) *UpdateWorkerReservationParams { - params.MaxParticipants = &MaxParticipants - return params +func (params *UpdateWorkerReservationParams) SetMaxParticipants(MaxParticipants int) (*UpdateWorkerReservationParams){ + params.MaxParticipants = &MaxParticipants + return params } -func (params *UpdateWorkerReservationParams) SetConferenceStatusCallback(ConferenceStatusCallback string) *UpdateWorkerReservationParams { - params.ConferenceStatusCallback = &ConferenceStatusCallback - return params +func (params *UpdateWorkerReservationParams) SetConferenceStatusCallback(ConferenceStatusCallback string) (*UpdateWorkerReservationParams){ + params.ConferenceStatusCallback = &ConferenceStatusCallback + return params } -func (params *UpdateWorkerReservationParams) SetConferenceStatusCallbackMethod(ConferenceStatusCallbackMethod string) *UpdateWorkerReservationParams { - params.ConferenceStatusCallbackMethod = &ConferenceStatusCallbackMethod - return params +func (params *UpdateWorkerReservationParams) SetConferenceStatusCallbackMethod(ConferenceStatusCallbackMethod string) (*UpdateWorkerReservationParams){ + params.ConferenceStatusCallbackMethod = &ConferenceStatusCallbackMethod + return params } -func (params *UpdateWorkerReservationParams) SetConferenceStatusCallbackEvent(ConferenceStatusCallbackEvent []string) *UpdateWorkerReservationParams { - params.ConferenceStatusCallbackEvent = &ConferenceStatusCallbackEvent - return params +func (params *UpdateWorkerReservationParams) SetConferenceStatusCallbackEvent(ConferenceStatusCallbackEvent []string) (*UpdateWorkerReservationParams){ + params.ConferenceStatusCallbackEvent = &ConferenceStatusCallbackEvent + return params } -func (params *UpdateWorkerReservationParams) SetConferenceRecord(ConferenceRecord string) *UpdateWorkerReservationParams { - params.ConferenceRecord = &ConferenceRecord - return params +func (params *UpdateWorkerReservationParams) SetConferenceRecord(ConferenceRecord string) (*UpdateWorkerReservationParams){ + params.ConferenceRecord = &ConferenceRecord + return params } -func (params *UpdateWorkerReservationParams) SetConferenceTrim(ConferenceTrim string) *UpdateWorkerReservationParams { - params.ConferenceTrim = &ConferenceTrim - return params +func (params *UpdateWorkerReservationParams) SetConferenceTrim(ConferenceTrim string) (*UpdateWorkerReservationParams){ + params.ConferenceTrim = &ConferenceTrim + return params } -func (params *UpdateWorkerReservationParams) SetRecordingChannels(RecordingChannels string) *UpdateWorkerReservationParams { - params.RecordingChannels = &RecordingChannels - return params +func (params *UpdateWorkerReservationParams) SetRecordingChannels(RecordingChannels string) (*UpdateWorkerReservationParams){ + params.RecordingChannels = &RecordingChannels + return params } -func (params *UpdateWorkerReservationParams) SetRecordingStatusCallback(RecordingStatusCallback string) *UpdateWorkerReservationParams { - params.RecordingStatusCallback = &RecordingStatusCallback - return params +func (params *UpdateWorkerReservationParams) SetRecordingStatusCallback(RecordingStatusCallback string) (*UpdateWorkerReservationParams){ + params.RecordingStatusCallback = &RecordingStatusCallback + return params } -func (params *UpdateWorkerReservationParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) *UpdateWorkerReservationParams { - params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod - return params +func (params *UpdateWorkerReservationParams) SetRecordingStatusCallbackMethod(RecordingStatusCallbackMethod string) (*UpdateWorkerReservationParams){ + params.RecordingStatusCallbackMethod = &RecordingStatusCallbackMethod + return params } -func (params *UpdateWorkerReservationParams) SetConferenceRecordingStatusCallback(ConferenceRecordingStatusCallback string) *UpdateWorkerReservationParams { - params.ConferenceRecordingStatusCallback = &ConferenceRecordingStatusCallback - return params +func (params *UpdateWorkerReservationParams) SetConferenceRecordingStatusCallback(ConferenceRecordingStatusCallback string) (*UpdateWorkerReservationParams){ + params.ConferenceRecordingStatusCallback = &ConferenceRecordingStatusCallback + return params } -func (params *UpdateWorkerReservationParams) SetConferenceRecordingStatusCallbackMethod(ConferenceRecordingStatusCallbackMethod string) *UpdateWorkerReservationParams { - params.ConferenceRecordingStatusCallbackMethod = &ConferenceRecordingStatusCallbackMethod - return params +func (params *UpdateWorkerReservationParams) SetConferenceRecordingStatusCallbackMethod(ConferenceRecordingStatusCallbackMethod string) (*UpdateWorkerReservationParams){ + params.ConferenceRecordingStatusCallbackMethod = &ConferenceRecordingStatusCallbackMethod + return params } -func (params *UpdateWorkerReservationParams) SetRegion(Region string) *UpdateWorkerReservationParams { - params.Region = &Region - return params +func (params *UpdateWorkerReservationParams) SetRegion(Region string) (*UpdateWorkerReservationParams){ + params.Region = &Region + return params } -func (params *UpdateWorkerReservationParams) SetSipAuthUsername(SipAuthUsername string) *UpdateWorkerReservationParams { - params.SipAuthUsername = &SipAuthUsername - return params +func (params *UpdateWorkerReservationParams) SetSipAuthUsername(SipAuthUsername string) (*UpdateWorkerReservationParams){ + params.SipAuthUsername = &SipAuthUsername + return params } -func (params *UpdateWorkerReservationParams) SetSipAuthPassword(SipAuthPassword string) *UpdateWorkerReservationParams { - params.SipAuthPassword = &SipAuthPassword - return params +func (params *UpdateWorkerReservationParams) SetSipAuthPassword(SipAuthPassword string) (*UpdateWorkerReservationParams){ + params.SipAuthPassword = &SipAuthPassword + return params } -func (params *UpdateWorkerReservationParams) SetDequeueStatusCallbackEvent(DequeueStatusCallbackEvent []string) *UpdateWorkerReservationParams { - params.DequeueStatusCallbackEvent = &DequeueStatusCallbackEvent - return params +func (params *UpdateWorkerReservationParams) SetDequeueStatusCallbackEvent(DequeueStatusCallbackEvent []string) (*UpdateWorkerReservationParams){ + params.DequeueStatusCallbackEvent = &DequeueStatusCallbackEvent + return params } -func (params *UpdateWorkerReservationParams) SetPostWorkActivitySid(PostWorkActivitySid string) *UpdateWorkerReservationParams { - params.PostWorkActivitySid = &PostWorkActivitySid - return params +func (params *UpdateWorkerReservationParams) SetPostWorkActivitySid(PostWorkActivitySid string) (*UpdateWorkerReservationParams){ + params.PostWorkActivitySid = &PostWorkActivitySid + return params } -func (params *UpdateWorkerReservationParams) SetEndConferenceOnCustomerExit(EndConferenceOnCustomerExit bool) *UpdateWorkerReservationParams { - params.EndConferenceOnCustomerExit = &EndConferenceOnCustomerExit - return params +func (params *UpdateWorkerReservationParams) SetEndConferenceOnCustomerExit(EndConferenceOnCustomerExit bool) (*UpdateWorkerReservationParams){ + params.EndConferenceOnCustomerExit = &EndConferenceOnCustomerExit + return params } -func (params *UpdateWorkerReservationParams) SetBeepOnCustomerEntrance(BeepOnCustomerEntrance bool) *UpdateWorkerReservationParams { - params.BeepOnCustomerEntrance = &BeepOnCustomerEntrance - return params +func (params *UpdateWorkerReservationParams) SetBeepOnCustomerEntrance(BeepOnCustomerEntrance bool) (*UpdateWorkerReservationParams){ + params.BeepOnCustomerEntrance = &BeepOnCustomerEntrance + return params } -// +// func (c *ApiService) UpdateWorkerReservation(WorkspaceSid string, WorkerSid string, Sid string, params *UpdateWorkerReservationParams) (*TaskrouterV1WorkerReservation, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Reservations/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ReservationStatus != nil { + data.Set("ReservationStatus", *params.ReservationStatus) + } + if params != nil && params.WorkerActivitySid != nil { + data.Set("WorkerActivitySid", *params.WorkerActivitySid) + } + if params != nil && params.Instruction != nil { + data.Set("Instruction", *params.Instruction) + } + if params != nil && params.DequeuePostWorkActivitySid != nil { + data.Set("DequeuePostWorkActivitySid", *params.DequeuePostWorkActivitySid) + } + if params != nil && params.DequeueFrom != nil { + data.Set("DequeueFrom", *params.DequeueFrom) + } + if params != nil && params.DequeueRecord != nil { + data.Set("DequeueRecord", *params.DequeueRecord) + } + if params != nil && params.DequeueTimeout != nil { + data.Set("DequeueTimeout", fmt.Sprint(*params.DequeueTimeout)) + } + if params != nil && params.DequeueTo != nil { + data.Set("DequeueTo", *params.DequeueTo) + } + if params != nil && params.DequeueStatusCallbackUrl != nil { + data.Set("DequeueStatusCallbackUrl", *params.DequeueStatusCallbackUrl) + } + if params != nil && params.CallFrom != nil { + data.Set("CallFrom", *params.CallFrom) + } + if params != nil && params.CallRecord != nil { + data.Set("CallRecord", *params.CallRecord) + } + if params != nil && params.CallTimeout != nil { + data.Set("CallTimeout", fmt.Sprint(*params.CallTimeout)) + } + if params != nil && params.CallTo != nil { + data.Set("CallTo", *params.CallTo) + } + if params != nil && params.CallUrl != nil { + data.Set("CallUrl", *params.CallUrl) + } + if params != nil && params.CallStatusCallbackUrl != nil { + data.Set("CallStatusCallbackUrl", *params.CallStatusCallbackUrl) + } + if params != nil && params.CallAccept != nil { + data.Set("CallAccept", fmt.Sprint(*params.CallAccept)) + } + if params != nil && params.RedirectCallSid != nil { + data.Set("RedirectCallSid", *params.RedirectCallSid) + } + if params != nil && params.RedirectAccept != nil { + data.Set("RedirectAccept", fmt.Sprint(*params.RedirectAccept)) + } + if params != nil && params.RedirectUrl != nil { + data.Set("RedirectUrl", *params.RedirectUrl) + } + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.From != nil { + data.Set("From", *params.From) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.StatusCallbackEvent != nil { + for _, item := range *params.StatusCallbackEvent { + data.Add("StatusCallbackEvent", item) + } + } + if params != nil && params.Timeout != nil { + data.Set("Timeout", fmt.Sprint(*params.Timeout)) + } + if params != nil && params.Record != nil { + data.Set("Record", fmt.Sprint(*params.Record)) + } + if params != nil && params.Muted != nil { + data.Set("Muted", fmt.Sprint(*params.Muted)) + } + if params != nil && params.Beep != nil { + data.Set("Beep", *params.Beep) + } + if params != nil && params.StartConferenceOnEnter != nil { + data.Set("StartConferenceOnEnter", fmt.Sprint(*params.StartConferenceOnEnter)) + } + if params != nil && params.EndConferenceOnExit != nil { + data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) + } + if params != nil && params.WaitUrl != nil { + data.Set("WaitUrl", *params.WaitUrl) + } + if params != nil && params.WaitMethod != nil { + data.Set("WaitMethod", *params.WaitMethod) + } + if params != nil && params.EarlyMedia != nil { + data.Set("EarlyMedia", fmt.Sprint(*params.EarlyMedia)) + } + if params != nil && params.MaxParticipants != nil { + data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) + } + if params != nil && params.ConferenceStatusCallback != nil { + data.Set("ConferenceStatusCallback", *params.ConferenceStatusCallback) + } + if params != nil && params.ConferenceStatusCallbackMethod != nil { + data.Set("ConferenceStatusCallbackMethod", *params.ConferenceStatusCallbackMethod) + } + if params != nil && params.ConferenceStatusCallbackEvent != nil { + for _, item := range *params.ConferenceStatusCallbackEvent { + data.Add("ConferenceStatusCallbackEvent", item) + } + } + if params != nil && params.ConferenceRecord != nil { + data.Set("ConferenceRecord", *params.ConferenceRecord) + } + if params != nil && params.ConferenceTrim != nil { + data.Set("ConferenceTrim", *params.ConferenceTrim) + } + if params != nil && params.RecordingChannels != nil { + data.Set("RecordingChannels", *params.RecordingChannels) + } + if params != nil && params.RecordingStatusCallback != nil { + data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) + } + if params != nil && params.RecordingStatusCallbackMethod != nil { + data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) + } + if params != nil && params.ConferenceRecordingStatusCallback != nil { + data.Set("ConferenceRecordingStatusCallback", *params.ConferenceRecordingStatusCallback) + } + if params != nil && params.ConferenceRecordingStatusCallbackMethod != nil { + data.Set("ConferenceRecordingStatusCallbackMethod", *params.ConferenceRecordingStatusCallbackMethod) + } + if params != nil && params.Region != nil { + data.Set("Region", *params.Region) + } + if params != nil && params.SipAuthUsername != nil { + data.Set("SipAuthUsername", *params.SipAuthUsername) + } + if params != nil && params.SipAuthPassword != nil { + data.Set("SipAuthPassword", *params.SipAuthPassword) + } + if params != nil && params.DequeueStatusCallbackEvent != nil { + for _, item := range *params.DequeueStatusCallbackEvent { + data.Add("DequeueStatusCallbackEvent", item) + } + } + if params != nil && params.PostWorkActivitySid != nil { + data.Set("PostWorkActivitySid", *params.PostWorkActivitySid) + } + if params != nil && params.EndConferenceOnCustomerExit != nil { + data.Set("EndConferenceOnCustomerExit", fmt.Sprint(*params.EndConferenceOnCustomerExit)) + } + if params != nil && params.BeepOnCustomerEntrance != nil { + data.Set("BeepOnCustomerEntrance", fmt.Sprint(*params.BeepOnCustomerEntrance)) + } - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ReservationStatus != nil { - data.Set("ReservationStatus", *params.ReservationStatus) - } - if params != nil && params.WorkerActivitySid != nil { - data.Set("WorkerActivitySid", *params.WorkerActivitySid) - } - if params != nil && params.Instruction != nil { - data.Set("Instruction", *params.Instruction) - } - if params != nil && params.DequeuePostWorkActivitySid != nil { - data.Set("DequeuePostWorkActivitySid", *params.DequeuePostWorkActivitySid) - } - if params != nil && params.DequeueFrom != nil { - data.Set("DequeueFrom", *params.DequeueFrom) - } - if params != nil && params.DequeueRecord != nil { - data.Set("DequeueRecord", *params.DequeueRecord) - } - if params != nil && params.DequeueTimeout != nil { - data.Set("DequeueTimeout", fmt.Sprint(*params.DequeueTimeout)) - } - if params != nil && params.DequeueTo != nil { - data.Set("DequeueTo", *params.DequeueTo) - } - if params != nil && params.DequeueStatusCallbackUrl != nil { - data.Set("DequeueStatusCallbackUrl", *params.DequeueStatusCallbackUrl) - } - if params != nil && params.CallFrom != nil { - data.Set("CallFrom", *params.CallFrom) - } - if params != nil && params.CallRecord != nil { - data.Set("CallRecord", *params.CallRecord) - } - if params != nil && params.CallTimeout != nil { - data.Set("CallTimeout", fmt.Sprint(*params.CallTimeout)) - } - if params != nil && params.CallTo != nil { - data.Set("CallTo", *params.CallTo) - } - if params != nil && params.CallUrl != nil { - data.Set("CallUrl", *params.CallUrl) - } - if params != nil && params.CallStatusCallbackUrl != nil { - data.Set("CallStatusCallbackUrl", *params.CallStatusCallbackUrl) - } - if params != nil && params.CallAccept != nil { - data.Set("CallAccept", fmt.Sprint(*params.CallAccept)) - } - if params != nil && params.RedirectCallSid != nil { - data.Set("RedirectCallSid", *params.RedirectCallSid) - } - if params != nil && params.RedirectAccept != nil { - data.Set("RedirectAccept", fmt.Sprint(*params.RedirectAccept)) - } - if params != nil && params.RedirectUrl != nil { - data.Set("RedirectUrl", *params.RedirectUrl) - } - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.From != nil { - data.Set("From", *params.From) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.StatusCallbackEvent != nil { - for _, item := range *params.StatusCallbackEvent { - data.Add("StatusCallbackEvent", item) - } - } - if params != nil && params.Timeout != nil { - data.Set("Timeout", fmt.Sprint(*params.Timeout)) - } - if params != nil && params.Record != nil { - data.Set("Record", fmt.Sprint(*params.Record)) - } - if params != nil && params.Muted != nil { - data.Set("Muted", fmt.Sprint(*params.Muted)) - } - if params != nil && params.Beep != nil { - data.Set("Beep", *params.Beep) - } - if params != nil && params.StartConferenceOnEnter != nil { - data.Set("StartConferenceOnEnter", fmt.Sprint(*params.StartConferenceOnEnter)) - } - if params != nil && params.EndConferenceOnExit != nil { - data.Set("EndConferenceOnExit", fmt.Sprint(*params.EndConferenceOnExit)) - } - if params != nil && params.WaitUrl != nil { - data.Set("WaitUrl", *params.WaitUrl) - } - if params != nil && params.WaitMethod != nil { - data.Set("WaitMethod", *params.WaitMethod) - } - if params != nil && params.EarlyMedia != nil { - data.Set("EarlyMedia", fmt.Sprint(*params.EarlyMedia)) - } - if params != nil && params.MaxParticipants != nil { - data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) - } - if params != nil && params.ConferenceStatusCallback != nil { - data.Set("ConferenceStatusCallback", *params.ConferenceStatusCallback) - } - if params != nil && params.ConferenceStatusCallbackMethod != nil { - data.Set("ConferenceStatusCallbackMethod", *params.ConferenceStatusCallbackMethod) - } - if params != nil && params.ConferenceStatusCallbackEvent != nil { - for _, item := range *params.ConferenceStatusCallbackEvent { - data.Add("ConferenceStatusCallbackEvent", item) - } - } - if params != nil && params.ConferenceRecord != nil { - data.Set("ConferenceRecord", *params.ConferenceRecord) - } - if params != nil && params.ConferenceTrim != nil { - data.Set("ConferenceTrim", *params.ConferenceTrim) - } - if params != nil && params.RecordingChannels != nil { - data.Set("RecordingChannels", *params.RecordingChannels) - } - if params != nil && params.RecordingStatusCallback != nil { - data.Set("RecordingStatusCallback", *params.RecordingStatusCallback) - } - if params != nil && params.RecordingStatusCallbackMethod != nil { - data.Set("RecordingStatusCallbackMethod", *params.RecordingStatusCallbackMethod) - } - if params != nil && params.ConferenceRecordingStatusCallback != nil { - data.Set("ConferenceRecordingStatusCallback", *params.ConferenceRecordingStatusCallback) - } - if params != nil && params.ConferenceRecordingStatusCallbackMethod != nil { - data.Set("ConferenceRecordingStatusCallbackMethod", *params.ConferenceRecordingStatusCallbackMethod) - } - if params != nil && params.Region != nil { - data.Set("Region", *params.Region) - } - if params != nil && params.SipAuthUsername != nil { - data.Set("SipAuthUsername", *params.SipAuthUsername) - } - if params != nil && params.SipAuthPassword != nil { - data.Set("SipAuthPassword", *params.SipAuthPassword) - } - if params != nil && params.DequeueStatusCallbackEvent != nil { - for _, item := range *params.DequeueStatusCallbackEvent { - data.Add("DequeueStatusCallbackEvent", item) - } - } - if params != nil && params.PostWorkActivitySid != nil { - data.Set("PostWorkActivitySid", *params.PostWorkActivitySid) - } - if params != nil && params.EndConferenceOnCustomerExit != nil { - data.Set("EndConferenceOnCustomerExit", fmt.Sprint(*params.EndConferenceOnCustomerExit)) - } - if params != nil && params.BeepOnCustomerEntrance != nil { - data.Set("BeepOnCustomerEntrance", fmt.Sprint(*params.BeepOnCustomerEntrance)) - } if params != nil && params.IfMatch != nil { headers["If-Match"] = *params.IfMatch } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkerReservation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkerReservation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workers_statistics.go b/rest/taskrouter/v1/workspaces_workers_statistics.go index 6d2d96495..2d6a56529 100644 --- a/rest/taskrouter/v1/workspaces_workers_statistics.go +++ b/rest/taskrouter/v1/workspaces_workers_statistics.go @@ -18,164 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkerInstanceStatistics' type FetchWorkerInstanceStatisticsParams struct { - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchWorkerInstanceStatisticsParams) SetMinutes(Minutes int) *FetchWorkerInstanceStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkerInstanceStatisticsParams) SetMinutes(Minutes int) (*FetchWorkerInstanceStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkerInstanceStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkerInstanceStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkerInstanceStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkerInstanceStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkerInstanceStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkerInstanceStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkerInstanceStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkerInstanceStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkerInstanceStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkerInstanceStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkerInstanceStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkerInstanceStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchWorkerInstanceStatistics(WorkspaceSid string, WorkerSid string, params *FetchWorkerInstanceStatisticsParams) (*TaskrouterV1WorkerInstanceStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Statistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TaskrouterV1WorkerInstanceStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Workers/{WorkerSid}/Statistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkerSid"+"}", WorkerSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1WorkerInstanceStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'FetchWorkerStatistics' type FetchWorkerStatisticsParams struct { - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // The SID of the TaskQueue for which to fetch Worker statistics. - TaskQueueSid *string `json:"TaskQueueSid,omitempty"` - // The `friendly_name` of the TaskQueue for which to fetch Worker statistics. - TaskQueueName *string `json:"TaskQueueName,omitempty"` - // Only include Workers with `friendly_name` values that match this parameter. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // The SID of the TaskQueue for which to fetch Worker statistics. + TaskQueueSid *string `json:"TaskQueueSid,omitempty"` + // The `friendly_name` of the TaskQueue for which to fetch Worker statistics. + TaskQueueName *string `json:"TaskQueueName,omitempty"` + // Only include Workers with `friendly_name` values that match this parameter. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchWorkerStatisticsParams) SetMinutes(Minutes int) *FetchWorkerStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkerStatisticsParams) SetMinutes(Minutes int) (*FetchWorkerStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkerStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkerStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkerStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkerStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkerStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkerStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkerStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkerStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkerStatisticsParams) SetTaskQueueSid(TaskQueueSid string) *FetchWorkerStatisticsParams { - params.TaskQueueSid = &TaskQueueSid - return params +func (params *FetchWorkerStatisticsParams) SetTaskQueueSid(TaskQueueSid string) (*FetchWorkerStatisticsParams){ + params.TaskQueueSid = &TaskQueueSid + return params } -func (params *FetchWorkerStatisticsParams) SetTaskQueueName(TaskQueueName string) *FetchWorkerStatisticsParams { - params.TaskQueueName = &TaskQueueName - return params +func (params *FetchWorkerStatisticsParams) SetTaskQueueName(TaskQueueName string) (*FetchWorkerStatisticsParams){ + params.TaskQueueName = &TaskQueueName + return params } -func (params *FetchWorkerStatisticsParams) SetFriendlyName(FriendlyName string) *FetchWorkerStatisticsParams { - params.FriendlyName = &FriendlyName - return params +func (params *FetchWorkerStatisticsParams) SetFriendlyName(FriendlyName string) (*FetchWorkerStatisticsParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *FetchWorkerStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkerStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkerStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkerStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchWorkerStatistics(WorkspaceSid string, params *FetchWorkerStatisticsParams) (*TaskrouterV1WorkerStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workers/Statistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.TaskQueueSid != nil { - data.Set("TaskQueueSid", *params.TaskQueueSid) - } - if params != nil && params.TaskQueueName != nil { - data.Set("TaskQueueName", *params.TaskQueueName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TaskrouterV1WorkerStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Workers/Statistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.TaskQueueSid != nil { + data.Set("TaskQueueSid", *params.TaskQueueSid) + } + if params != nil && params.TaskQueueName != nil { + data.Set("TaskQueueName", *params.TaskQueueName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1WorkerStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workflows.go b/rest/taskrouter/v1/workspaces_workflows.go index e7dadffd7..2882dfea2 100644 --- a/rest/taskrouter/v1/workspaces_workflows.go +++ b/rest/taskrouter/v1/workspaces_workflows.go @@ -18,187 +18,192 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWorkflow' type CreateWorkflowParams struct { - // A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. - Configuration *string `json:"Configuration,omitempty"` - // The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. - AssignmentCallbackUrl *string `json:"AssignmentCallbackUrl,omitempty"` - // The URL that we should call when a call to the `assignment_callback_url` fails. - FallbackAssignmentCallbackUrl *string `json:"FallbackAssignmentCallbackUrl,omitempty"` - // How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. - TaskReservationTimeout *int `json:"TaskReservationTimeout,omitempty"` + // A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. + Configuration *string `json:"Configuration,omitempty"` + // The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. + AssignmentCallbackUrl *string `json:"AssignmentCallbackUrl,omitempty"` + // The URL that we should call when a call to the `assignment_callback_url` fails. + FallbackAssignmentCallbackUrl *string `json:"FallbackAssignmentCallbackUrl,omitempty"` + // How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. + TaskReservationTimeout *int `json:"TaskReservationTimeout,omitempty"` } -func (params *CreateWorkflowParams) SetFriendlyName(FriendlyName string) *CreateWorkflowParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateWorkflowParams) SetFriendlyName(FriendlyName string) (*CreateWorkflowParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateWorkflowParams) SetConfiguration(Configuration string) *CreateWorkflowParams { - params.Configuration = &Configuration - return params +func (params *CreateWorkflowParams) SetConfiguration(Configuration string) (*CreateWorkflowParams){ + params.Configuration = &Configuration + return params } -func (params *CreateWorkflowParams) SetAssignmentCallbackUrl(AssignmentCallbackUrl string) *CreateWorkflowParams { - params.AssignmentCallbackUrl = &AssignmentCallbackUrl - return params +func (params *CreateWorkflowParams) SetAssignmentCallbackUrl(AssignmentCallbackUrl string) (*CreateWorkflowParams){ + params.AssignmentCallbackUrl = &AssignmentCallbackUrl + return params } -func (params *CreateWorkflowParams) SetFallbackAssignmentCallbackUrl(FallbackAssignmentCallbackUrl string) *CreateWorkflowParams { - params.FallbackAssignmentCallbackUrl = &FallbackAssignmentCallbackUrl - return params +func (params *CreateWorkflowParams) SetFallbackAssignmentCallbackUrl(FallbackAssignmentCallbackUrl string) (*CreateWorkflowParams){ + params.FallbackAssignmentCallbackUrl = &FallbackAssignmentCallbackUrl + return params } -func (params *CreateWorkflowParams) SetTaskReservationTimeout(TaskReservationTimeout int) *CreateWorkflowParams { - params.TaskReservationTimeout = &TaskReservationTimeout - return params +func (params *CreateWorkflowParams) SetTaskReservationTimeout(TaskReservationTimeout int) (*CreateWorkflowParams){ + params.TaskReservationTimeout = &TaskReservationTimeout + return params } -// +// func (c *ApiService) CreateWorkflow(WorkspaceSid string, params *CreateWorkflowParams) (*TaskrouterV1Workflow, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Configuration != nil { - data.Set("Configuration", *params.Configuration) - } - if params != nil && params.AssignmentCallbackUrl != nil { - data.Set("AssignmentCallbackUrl", *params.AssignmentCallbackUrl) - } - if params != nil && params.FallbackAssignmentCallbackUrl != nil { - data.Set("FallbackAssignmentCallbackUrl", *params.FallbackAssignmentCallbackUrl) - } - if params != nil && params.TaskReservationTimeout != nil { - data.Set("TaskReservationTimeout", fmt.Sprint(*params.TaskReservationTimeout)) - } + path := "/v1/Workspaces/{WorkspaceSid}/Workflows" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Configuration != nil { + data.Set("Configuration", *params.Configuration) + } + if params != nil && params.AssignmentCallbackUrl != nil { + data.Set("AssignmentCallbackUrl", *params.AssignmentCallbackUrl) + } + if params != nil && params.FallbackAssignmentCallbackUrl != nil { + data.Set("FallbackAssignmentCallbackUrl", *params.FallbackAssignmentCallbackUrl) + } + if params != nil && params.TaskReservationTimeout != nil { + data.Set("TaskReservationTimeout", fmt.Sprint(*params.TaskReservationTimeout)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1Workflow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteWorkflow(WorkspaceSid string, Sid string, ) (error) { + path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &TaskrouterV1Workflow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteWorkflow(WorkspaceSid string, Sid string) error { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchWorkflow(WorkspaceSid string, Sid string, ) (*TaskrouterV1Workflow, error) { + path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchWorkflow(WorkspaceSid string, Sid string) (*TaskrouterV1Workflow, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1Workflow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1Workflow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListWorkflow' type ListWorkflowParams struct { - // The `friendly_name` of the Workflow resources to read. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The `friendly_name` of the Workflow resources to read. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWorkflowParams) SetFriendlyName(FriendlyName string) *ListWorkflowParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListWorkflowParams) SetFriendlyName(FriendlyName string) (*ListWorkflowParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListWorkflowParams) SetPageSize(PageSize int) *ListWorkflowParams { - params.PageSize = &PageSize - return params +func (params *ListWorkflowParams) SetPageSize(PageSize int) (*ListWorkflowParams){ + params.PageSize = &PageSize + return params } -func (params *ListWorkflowParams) SetLimit(Limit int) *ListWorkflowParams { - params.Limit = &Limit - return params +func (params *ListWorkflowParams) SetLimit(Limit int) (*ListWorkflowParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Workflow records from the API. Request is executed immediately. func (c *ApiService) PageWorkflow(WorkspaceSid string, params *ListWorkflowParams, pageToken, pageNumber string) (*ListWorkflowResponse, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows" + path := "/v1/Workspaces/{WorkspaceSid}/Workflows" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWorkflowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListWorkflowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Workflow records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -239,6 +244,7 @@ func (c *ApiService) StreamWorkflow(WorkspaceSid string, params *ListWorkflowPar return recordChannel, errorChannel } + func (c *ApiService) streamWorkflow(response *ListWorkflowResponse, params *ListWorkflowParams, recordChannel chan TaskrouterV1Workflow, errorChannel chan error) { curRecord := 1 @@ -270,103 +276,105 @@ func (c *ApiService) streamWorkflow(response *ListWorkflowResponse, params *List } func (c *ApiService) getNextListWorkflowResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWorkflowResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWorkflowResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWorkflow' type UpdateWorkflowParams struct { - // A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. - AssignmentCallbackUrl *string `json:"AssignmentCallbackUrl,omitempty"` - // The URL that we should call when a call to the `assignment_callback_url` fails. - FallbackAssignmentCallbackUrl *string `json:"FallbackAssignmentCallbackUrl,omitempty"` - // A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. - Configuration *string `json:"Configuration,omitempty"` - // How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. - TaskReservationTimeout *int `json:"TaskReservationTimeout,omitempty"` - // Whether or not to re-evaluate Tasks. The default is `false`, which means Tasks in the Workflow will not be processed through the assignment loop again. - ReEvaluateTasks *string `json:"ReEvaluateTasks,omitempty"` + // A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. + AssignmentCallbackUrl *string `json:"AssignmentCallbackUrl,omitempty"` + // The URL that we should call when a call to the `assignment_callback_url` fails. + FallbackAssignmentCallbackUrl *string `json:"FallbackAssignmentCallbackUrl,omitempty"` + // A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. + Configuration *string `json:"Configuration,omitempty"` + // How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. + TaskReservationTimeout *int `json:"TaskReservationTimeout,omitempty"` + // Whether or not to re-evaluate Tasks. The default is `false`, which means Tasks in the Workflow will not be processed through the assignment loop again. + ReEvaluateTasks *string `json:"ReEvaluateTasks,omitempty"` } -func (params *UpdateWorkflowParams) SetFriendlyName(FriendlyName string) *UpdateWorkflowParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateWorkflowParams) SetFriendlyName(FriendlyName string) (*UpdateWorkflowParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateWorkflowParams) SetAssignmentCallbackUrl(AssignmentCallbackUrl string) *UpdateWorkflowParams { - params.AssignmentCallbackUrl = &AssignmentCallbackUrl - return params +func (params *UpdateWorkflowParams) SetAssignmentCallbackUrl(AssignmentCallbackUrl string) (*UpdateWorkflowParams){ + params.AssignmentCallbackUrl = &AssignmentCallbackUrl + return params } -func (params *UpdateWorkflowParams) SetFallbackAssignmentCallbackUrl(FallbackAssignmentCallbackUrl string) *UpdateWorkflowParams { - params.FallbackAssignmentCallbackUrl = &FallbackAssignmentCallbackUrl - return params +func (params *UpdateWorkflowParams) SetFallbackAssignmentCallbackUrl(FallbackAssignmentCallbackUrl string) (*UpdateWorkflowParams){ + params.FallbackAssignmentCallbackUrl = &FallbackAssignmentCallbackUrl + return params } -func (params *UpdateWorkflowParams) SetConfiguration(Configuration string) *UpdateWorkflowParams { - params.Configuration = &Configuration - return params +func (params *UpdateWorkflowParams) SetConfiguration(Configuration string) (*UpdateWorkflowParams){ + params.Configuration = &Configuration + return params } -func (params *UpdateWorkflowParams) SetTaskReservationTimeout(TaskReservationTimeout int) *UpdateWorkflowParams { - params.TaskReservationTimeout = &TaskReservationTimeout - return params +func (params *UpdateWorkflowParams) SetTaskReservationTimeout(TaskReservationTimeout int) (*UpdateWorkflowParams){ + params.TaskReservationTimeout = &TaskReservationTimeout + return params } -func (params *UpdateWorkflowParams) SetReEvaluateTasks(ReEvaluateTasks string) *UpdateWorkflowParams { - params.ReEvaluateTasks = &ReEvaluateTasks - return params +func (params *UpdateWorkflowParams) SetReEvaluateTasks(ReEvaluateTasks string) (*UpdateWorkflowParams){ + params.ReEvaluateTasks = &ReEvaluateTasks + return params } -// +// func (c *ApiService) UpdateWorkflow(WorkspaceSid string, Sid string, params *UpdateWorkflowParams) (*TaskrouterV1Workflow, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{Sid}" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AssignmentCallbackUrl != nil { - data.Set("AssignmentCallbackUrl", *params.AssignmentCallbackUrl) - } - if params != nil && params.FallbackAssignmentCallbackUrl != nil { - data.Set("FallbackAssignmentCallbackUrl", *params.FallbackAssignmentCallbackUrl) - } - if params != nil && params.Configuration != nil { - data.Set("Configuration", *params.Configuration) - } - if params != nil && params.TaskReservationTimeout != nil { - data.Set("TaskReservationTimeout", fmt.Sprint(*params.TaskReservationTimeout)) - } - if params != nil && params.ReEvaluateTasks != nil { - data.Set("ReEvaluateTasks", *params.ReEvaluateTasks) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TaskrouterV1Workflow{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{Sid}" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AssignmentCallbackUrl != nil { + data.Set("AssignmentCallbackUrl", *params.AssignmentCallbackUrl) + } + if params != nil && params.FallbackAssignmentCallbackUrl != nil { + data.Set("FallbackAssignmentCallbackUrl", *params.FallbackAssignmentCallbackUrl) + } + if params != nil && params.Configuration != nil { + data.Set("Configuration", *params.Configuration) + } + if params != nil && params.TaskReservationTimeout != nil { + data.Set("TaskReservationTimeout", fmt.Sprint(*params.TaskReservationTimeout)) + } + if params != nil && params.ReEvaluateTasks != nil { + data.Set("ReEvaluateTasks", *params.ReEvaluateTasks) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TaskrouterV1Workflow{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workflows_cumulative_statistics.go b/rest/taskrouter/v1/workspaces_workflows_cumulative_statistics.go index ee6ebb429..47b06c997 100644 --- a/rest/taskrouter/v1/workspaces_workflows_cumulative_statistics.go +++ b/rest/taskrouter/v1/workspaces_workflows_cumulative_statistics.go @@ -18,81 +18,83 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkflowCumulativeStatistics' type FetchWorkflowCumulativeStatisticsParams struct { - // Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` } -func (params *FetchWorkflowCumulativeStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkflowCumulativeStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkflowCumulativeStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkflowCumulativeStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkflowCumulativeStatisticsParams) SetMinutes(Minutes int) *FetchWorkflowCumulativeStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkflowCumulativeStatisticsParams) SetMinutes(Minutes int) (*FetchWorkflowCumulativeStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkflowCumulativeStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkflowCumulativeStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkflowCumulativeStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkflowCumulativeStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkflowCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkflowCumulativeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkflowCumulativeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkflowCumulativeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *FetchWorkflowCumulativeStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *FetchWorkflowCumulativeStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *FetchWorkflowCumulativeStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*FetchWorkflowCumulativeStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -// +// func (c *ApiService) FetchWorkflowCumulativeStatistics(WorkspaceSid string, WorkflowSid string, params *FetchWorkflowCumulativeStatisticsParams) (*TaskrouterV1WorkflowCumulativeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/CumulativeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkflowSid"+"}", WorkflowSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/CumulativeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkflowSid"+"}", WorkflowSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkflowCumulativeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkflowCumulativeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workflows_real_time_statistics.go b/rest/taskrouter/v1/workspaces_workflows_real_time_statistics.go index 5fb9ab9aa..4fd65d378 100644 --- a/rest/taskrouter/v1/workspaces_workflows_real_time_statistics.go +++ b/rest/taskrouter/v1/workspaces_workflows_real_time_statistics.go @@ -16,45 +16,49 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkflowRealTimeStatistics' type FetchWorkflowRealTimeStatisticsParams struct { - // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` + // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` } -func (params *FetchWorkflowRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkflowRealTimeStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkflowRealTimeStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkflowRealTimeStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -// +// func (c *ApiService) FetchWorkflowRealTimeStatistics(WorkspaceSid string, WorkflowSid string, params *FetchWorkflowRealTimeStatisticsParams) (*TaskrouterV1WorkflowRealTimeStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/RealTimeStatistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkflowSid"+"}", WorkflowSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/RealTimeStatistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkflowSid"+"}", WorkflowSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkflowRealTimeStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkflowRealTimeStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/taskrouter/v1/workspaces_workflows_statistics.go b/rest/taskrouter/v1/workspaces_workflows_statistics.go index 0c20502d5..36ecbf921 100644 --- a/rest/taskrouter/v1/workspaces_workflows_statistics.go +++ b/rest/taskrouter/v1/workspaces_workflows_statistics.go @@ -18,81 +18,83 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchWorkflowStatistics' type FetchWorkflowStatisticsParams struct { - // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. - Minutes *int `json:"Minutes,omitempty"` - // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - StartDate *time.Time `json:"StartDate,omitempty"` - // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. - EndDate *time.Time `json:"EndDate,omitempty"` - // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. - TaskChannel *string `json:"TaskChannel,omitempty"` - // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. - SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` + // Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. + Minutes *int `json:"Minutes,omitempty"` + // Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + StartDate *time.Time `json:"StartDate,omitempty"` + // Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. + EndDate *time.Time `json:"EndDate,omitempty"` + // Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. + TaskChannel *string `json:"TaskChannel,omitempty"` + // A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. + SplitByWaitTime *string `json:"SplitByWaitTime,omitempty"` } -func (params *FetchWorkflowStatisticsParams) SetMinutes(Minutes int) *FetchWorkflowStatisticsParams { - params.Minutes = &Minutes - return params +func (params *FetchWorkflowStatisticsParams) SetMinutes(Minutes int) (*FetchWorkflowStatisticsParams){ + params.Minutes = &Minutes + return params } -func (params *FetchWorkflowStatisticsParams) SetStartDate(StartDate time.Time) *FetchWorkflowStatisticsParams { - params.StartDate = &StartDate - return params +func (params *FetchWorkflowStatisticsParams) SetStartDate(StartDate time.Time) (*FetchWorkflowStatisticsParams){ + params.StartDate = &StartDate + return params } -func (params *FetchWorkflowStatisticsParams) SetEndDate(EndDate time.Time) *FetchWorkflowStatisticsParams { - params.EndDate = &EndDate - return params +func (params *FetchWorkflowStatisticsParams) SetEndDate(EndDate time.Time) (*FetchWorkflowStatisticsParams){ + params.EndDate = &EndDate + return params } -func (params *FetchWorkflowStatisticsParams) SetTaskChannel(TaskChannel string) *FetchWorkflowStatisticsParams { - params.TaskChannel = &TaskChannel - return params +func (params *FetchWorkflowStatisticsParams) SetTaskChannel(TaskChannel string) (*FetchWorkflowStatisticsParams){ + params.TaskChannel = &TaskChannel + return params } -func (params *FetchWorkflowStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) *FetchWorkflowStatisticsParams { - params.SplitByWaitTime = &SplitByWaitTime - return params +func (params *FetchWorkflowStatisticsParams) SetSplitByWaitTime(SplitByWaitTime string) (*FetchWorkflowStatisticsParams){ + params.SplitByWaitTime = &SplitByWaitTime + return params } -// +// func (c *ApiService) FetchWorkflowStatistics(WorkspaceSid string, WorkflowSid string, params *FetchWorkflowStatisticsParams) (*TaskrouterV1WorkflowStatistics, error) { - path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/Statistics" - path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) - path = strings.Replace(path, "{"+"WorkflowSid"+"}", WorkflowSid, -1) + path := "/v1/Workspaces/{WorkspaceSid}/Workflows/{WorkflowSid}/Statistics" + path = strings.Replace(path, "{"+"WorkspaceSid"+"}", WorkspaceSid, -1) + path = strings.Replace(path, "{"+"WorkflowSid"+"}", WorkflowSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Minutes != nil { + data.Set("Minutes", fmt.Sprint(*params.Minutes)) + } + if params != nil && params.StartDate != nil { + data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) + } + if params != nil && params.EndDate != nil { + data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) + } + if params != nil && params.TaskChannel != nil { + data.Set("TaskChannel", *params.TaskChannel) + } + if params != nil && params.SplitByWaitTime != nil { + data.Set("SplitByWaitTime", *params.SplitByWaitTime) + } - if params != nil && params.Minutes != nil { - data.Set("Minutes", fmt.Sprint(*params.Minutes)) - } - if params != nil && params.StartDate != nil { - data.Set("StartDate", fmt.Sprint((*params.StartDate).Format(time.RFC3339))) - } - if params != nil && params.EndDate != nil { - data.Set("EndDate", fmt.Sprint((*params.EndDate).Format(time.RFC3339))) - } - if params != nil && params.TaskChannel != nil { - data.Set("TaskChannel", *params.TaskChannel) - } - if params != nil && params.SplitByWaitTime != nil { - data.Set("SplitByWaitTime", *params.SplitByWaitTime) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TaskrouterV1WorkflowStatistics{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TaskrouterV1WorkflowStatistics{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/trunking/v1/README.md b/rest/trunking/v1/README.md index 351983626..b8a7707a1 100644 --- a/rest/trunking/v1/README.md +++ b/rest/trunking/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/trunking/v1/api_service.go b/rest/trunking/v1/api_service.go index 9fcddb260..3155b176f 100644 --- a/rest/trunking/v1/api_service.go +++ b/rest/trunking/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://trunking.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/trunking/v1/docs/ListCredentialListResponseMeta.md b/rest/trunking/v1/docs/ListCredentialListResponseMeta.md index 02409fba2..940c52bdd 100644 --- a/rest/trunking/v1/docs/ListCredentialListResponseMeta.md +++ b/rest/trunking/v1/docs/ListCredentialListResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/trunking/v1/model_list_credential_list_response.go b/rest/trunking/v1/model_list_credential_list_response.go index 987e7f2b8..2d33dc6cf 100644 --- a/rest/trunking/v1/model_list_credential_list_response.go +++ b/rest/trunking/v1/model_list_credential_list_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialListResponse struct for ListCredentialListResponse type ListCredentialListResponse struct { - CredentialLists []TrunkingV1CredentialList `json:"credential_lists,omitempty"` - Meta ListCredentialListResponseMeta `json:"meta,omitempty"` + CredentialLists []TrunkingV1CredentialList `json:"credential_lists,omitempty"` + Meta ListCredentialListResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trunking/v1/model_list_credential_list_response_meta.go b/rest/trunking/v1/model_list_credential_list_response_meta.go index 570982f7a..ba1aee212 100644 --- a/rest/trunking/v1/model_list_credential_list_response_meta.go +++ b/rest/trunking/v1/model_list_credential_list_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCredentialListResponseMeta struct for ListCredentialListResponseMeta type ListCredentialListResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/trunking/v1/model_list_ip_access_control_list_response.go b/rest/trunking/v1/model_list_ip_access_control_list_response.go index 76bc6dbab..cb8600b21 100644 --- a/rest/trunking/v1/model_list_ip_access_control_list_response.go +++ b/rest/trunking/v1/model_list_ip_access_control_list_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIpAccessControlListResponse struct for ListIpAccessControlListResponse type ListIpAccessControlListResponse struct { IpAccessControlLists []TrunkingV1IpAccessControlList `json:"ip_access_control_lists,omitempty"` - Meta ListCredentialListResponseMeta `json:"meta,omitempty"` + Meta ListCredentialListResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trunking/v1/model_list_origination_url_response.go b/rest/trunking/v1/model_list_origination_url_response.go index c8473b963..737cb3789 100644 --- a/rest/trunking/v1/model_list_origination_url_response.go +++ b/rest/trunking/v1/model_list_origination_url_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListOriginationUrlResponse struct for ListOriginationUrlResponse type ListOriginationUrlResponse struct { - OriginationUrls []TrunkingV1OriginationUrl `json:"origination_urls,omitempty"` - Meta ListCredentialListResponseMeta `json:"meta,omitempty"` + OriginationUrls []TrunkingV1OriginationUrl `json:"origination_urls,omitempty"` + Meta ListCredentialListResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trunking/v1/model_list_phone_number_response.go b/rest/trunking/v1/model_list_phone_number_response.go index fbe60d3c0..673f9b49e 100644 --- a/rest/trunking/v1/model_list_phone_number_response.go +++ b/rest/trunking/v1/model_list_phone_number_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListPhoneNumberResponse struct for ListPhoneNumberResponse type ListPhoneNumberResponse struct { - PhoneNumbers []TrunkingV1PhoneNumber `json:"phone_numbers,omitempty"` - Meta ListCredentialListResponseMeta `json:"meta,omitempty"` + PhoneNumbers []TrunkingV1PhoneNumber `json:"phone_numbers,omitempty"` + Meta ListCredentialListResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trunking/v1/model_list_trunk_response.go b/rest/trunking/v1/model_list_trunk_response.go index 692d5c8b7..ae849b500 100644 --- a/rest/trunking/v1/model_list_trunk_response.go +++ b/rest/trunking/v1/model_list_trunk_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrunkResponse struct for ListTrunkResponse type ListTrunkResponse struct { - Trunks []TrunkingV1Trunk `json:"trunks,omitempty"` - Meta ListCredentialListResponseMeta `json:"meta,omitempty"` + Trunks []TrunkingV1Trunk `json:"trunks,omitempty"` + Meta ListCredentialListResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trunking/v1/model_trunking_v1_credential_list.go b/rest/trunking/v1/model_trunking_v1_credential_list.go index ae389c349..15a4fa52e 100644 --- a/rest/trunking/v1/model_trunking_v1_credential_list.go +++ b/rest/trunking/v1/model_trunking_v1_credential_list.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrunkingV1CredentialList struct for TrunkingV1CredentialList type TrunkingV1CredentialList struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the CredentialList resource. + // The unique string that we created to identify the CredentialList resource. Sid *string `json:"sid,omitempty"` - // The SID of the Trunk the credential list in associated with. + // The SID of the Trunk the credential list in associated with. TrunkSid *string `json:"trunk_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trunking/v1/model_trunking_v1_ip_access_control_list.go b/rest/trunking/v1/model_trunking_v1_ip_access_control_list.go index 8c5f36009..8c7aa4e65 100644 --- a/rest/trunking/v1/model_trunking_v1_ip_access_control_list.go +++ b/rest/trunking/v1/model_trunking_v1_ip_access_control_list.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrunkingV1IpAccessControlList struct for TrunkingV1IpAccessControlList type TrunkingV1IpAccessControlList struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the IpAccessControlList resource. + // The unique string that we created to identify the IpAccessControlList resource. Sid *string `json:"sid,omitempty"` - // The SID of the Trunk the resource is associated with. + // The SID of the Trunk the resource is associated with. TrunkSid *string `json:"trunk_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trunking/v1/model_trunking_v1_origination_url.go b/rest/trunking/v1/model_trunking_v1_origination_url.go index 01e8cd583..5e9958e4e 100644 --- a/rest/trunking/v1/model_trunking_v1_origination_url.go +++ b/rest/trunking/v1/model_trunking_v1_origination_url.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrunkingV1OriginationUrl struct for TrunkingV1OriginationUrl type TrunkingV1OriginationUrl struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the OriginationUrl resource. + // The unique string that we created to identify the OriginationUrl resource. Sid *string `json:"sid,omitempty"` - // The SID of the Trunk that owns the Origination URL. + // The SID of the Trunk that owns the Origination URL. TrunkSid *string `json:"trunk_sid,omitempty"` - // The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. + // The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. Weight *int `json:"weight,omitempty"` - // Whether the URL is enabled. The default is `true`. + // Whether the URL is enabled. The default is `true`. Enabled *bool `json:"enabled,omitempty"` - // The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. + // The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. SipUrl *string `json:"sip_url,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. + // The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. Priority *int `json:"priority,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trunking/v1/model_trunking_v1_phone_number.go b/rest/trunking/v1/model_trunking_v1_phone_number.go index d9928b2fd..ea2ad4f58 100644 --- a/rest/trunking/v1/model_trunking_v1_phone_number.go +++ b/rest/trunking/v1/model_trunking_v1_phone_number.go @@ -13,62 +13,64 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrunkingV1PhoneNumber struct for TrunkingV1PhoneNumber type TrunkingV1PhoneNumber struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. - AccountSid *string `json:"account_sid,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. + AccountSid *string `json:"account_sid,omitempty"` AddressRequirements *string `json:"address_requirements,omitempty"` - // The API version used to start a new TwiML session. + // The API version used to start a new TwiML session. ApiVersion *string `json:"api_version,omitempty"` - // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + // Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. Beta *bool `json:"beta,omitempty"` - // The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. + // The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. Capabilities *map[string]interface{} `json:"capabilities,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` - // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + // The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. PhoneNumber *string `json:"phone_number,omitempty"` - // The unique string that we created to identify the PhoneNumber resource. + // The unique string that we created to identify the PhoneNumber resource. Sid *string `json:"sid,omitempty"` - // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + // The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. SmsApplicationSid *string `json:"sms_application_sid,omitempty"` - // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // The URL that we call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML from `sms_url`. + // The URL that we call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML from `sms_url`. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. SmsMethod *string `json:"sms_method,omitempty"` - // The URL we call using the `sms_method` when the phone number receives an incoming SMS message. + // The URL we call using the `sms_method` when the phone number receives an incoming SMS message. SmsUrl *string `json:"sms_url,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + // The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + // The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. TrunkSid *string `json:"trunk_sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice URLs and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + // The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice URLs and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. VoiceApplicationSid *string `json:"voice_application_sid,omitempty"` - // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + // Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. VoiceCallerIdLookup *bool `json:"voice_caller_id_lookup,omitempty"` - // The HTTP method that we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method that we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call using the `voice_fallback_method` when an error occurs retrieving or executing the TwiML requested by `url`. + // The URL that we call using the `voice_fallback_method` when an error occurs retrieving or executing the TwiML requested by `url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL we call using the `voice_method` when the phone number receives a call. The `voice_url` is not be used if a `voice_application_sid` or a `trunk_sid` is set. + // The URL we call using the `voice_method` when the phone number receives a call. The `voice_url` is not be used if a `voice_application_sid` or a `trunk_sid` is set. VoiceUrl *string `json:"voice_url,omitempty"` } + + diff --git a/rest/trunking/v1/model_trunking_v1_recording.go b/rest/trunking/v1/model_trunking_v1_recording.go index d1bd75662..b2d011bea 100644 --- a/rest/trunking/v1/model_trunking_v1_recording.go +++ b/rest/trunking/v1/model_trunking_v1_recording.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TrunkingV1Recording struct for TrunkingV1Recording type TrunkingV1Recording struct { Mode *string `json:"mode,omitempty"` Trim *string `json:"trim,omitempty"` } + + diff --git a/rest/trunking/v1/model_trunking_v1_trunk.go b/rest/trunking/v1/model_trunking_v1_trunk.go index 4fbf83294..b6fe07bd4 100644 --- a/rest/trunking/v1/model_trunking_v1_trunk.go +++ b/rest/trunking/v1/model_trunking_v1_trunk.go @@ -13,43 +13,45 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrunkingV1Trunk struct for TrunkingV1Trunk type TrunkingV1Trunk struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trunk resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trunk resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. + // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. DomainName *string `json:"domain_name,omitempty"` - // The HTTP method we use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. DisasterRecoveryMethod *string `json:"disaster_recovery_method,omitempty"` - // The URL we call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. + // The URL we call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. DisasterRecoveryUrl *string `json:"disaster_recovery_url,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. + // Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. Secure *bool `json:"secure,omitempty"` - // The recording settings for the trunk. Can be: `do-not-record`, `record-from-ringing`, `record-from-answer`. If set to `record-from-ringing` or `record-from-answer`, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.`/Trunks/[Trunk_SID]/Recording -XPOST -d'Mode=record-from-answer'`. See [Recording](https://www.twilio.com/docs/sip-trunking#recording) for more information. - Recording *interface{} `json:"recording,omitempty"` - TransferMode *string `json:"transfer_mode,omitempty"` - TransferCallerId *string `json:"transfer_caller_id,omitempty"` - // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + // The recording settings for the trunk. Can be: `do-not-record`, `record-from-ringing`, `record-from-answer`. If set to `record-from-ringing` or `record-from-answer`, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.`/Trunks/[Trunk_SID]/Recording -XPOST -d'Mode=record-from-answer'`. See [Recording](https://www.twilio.com/docs/sip-trunking#recording) for more information. + Recording *interface{} `json:"recording,omitempty"` + TransferMode *string `json:"transfer_mode,omitempty"` + TransferCallerId *string `json:"transfer_caller_id,omitempty"` + // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. CnamLookupEnabled *bool `json:"cnam_lookup_enabled,omitempty"` - // The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. + // The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. AuthType *string `json:"auth_type,omitempty"` - // Reserved. + // Reserved. AuthTypeSet *[]string `json:"auth_type_set,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that we created to identify the Trunk resource. + // The unique string that we created to identify the Trunk resource. Sid *string `json:"sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/trunking/v1/trunks.go b/rest/trunking/v1/trunks.go index 45a5e80ac..2ced13afe 100644 --- a/rest/trunking/v1/trunks.go +++ b/rest/trunking/v1/trunks.go @@ -18,200 +18,206 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTrunk' type CreateTrunkParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. - DomainName *string `json:"DomainName,omitempty"` - // The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. - DisasterRecoveryUrl *string `json:"DisasterRecoveryUrl,omitempty"` - // The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. - DisasterRecoveryMethod *string `json:"DisasterRecoveryMethod,omitempty"` - // - TransferMode *string `json:"TransferMode,omitempty"` - // Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. - Secure *bool `json:"Secure,omitempty"` - // Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. - CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` - // - TransferCallerId *string `json:"TransferCallerId,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. + DomainName *string `json:"DomainName,omitempty"` + // The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. + DisasterRecoveryUrl *string `json:"DisasterRecoveryUrl,omitempty"` + // The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. + DisasterRecoveryMethod *string `json:"DisasterRecoveryMethod,omitempty"` + // + TransferMode *string `json:"TransferMode,omitempty"` + // Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. + Secure *bool `json:"Secure,omitempty"` + // Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` + // + TransferCallerId *string `json:"TransferCallerId,omitempty"` } -func (params *CreateTrunkParams) SetFriendlyName(FriendlyName string) *CreateTrunkParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateTrunkParams) SetFriendlyName(FriendlyName string) (*CreateTrunkParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateTrunkParams) SetDomainName(DomainName string) *CreateTrunkParams { - params.DomainName = &DomainName - return params +func (params *CreateTrunkParams) SetDomainName(DomainName string) (*CreateTrunkParams){ + params.DomainName = &DomainName + return params } -func (params *CreateTrunkParams) SetDisasterRecoveryUrl(DisasterRecoveryUrl string) *CreateTrunkParams { - params.DisasterRecoveryUrl = &DisasterRecoveryUrl - return params +func (params *CreateTrunkParams) SetDisasterRecoveryUrl(DisasterRecoveryUrl string) (*CreateTrunkParams){ + params.DisasterRecoveryUrl = &DisasterRecoveryUrl + return params } -func (params *CreateTrunkParams) SetDisasterRecoveryMethod(DisasterRecoveryMethod string) *CreateTrunkParams { - params.DisasterRecoveryMethod = &DisasterRecoveryMethod - return params +func (params *CreateTrunkParams) SetDisasterRecoveryMethod(DisasterRecoveryMethod string) (*CreateTrunkParams){ + params.DisasterRecoveryMethod = &DisasterRecoveryMethod + return params } -func (params *CreateTrunkParams) SetTransferMode(TransferMode string) *CreateTrunkParams { - params.TransferMode = &TransferMode - return params +func (params *CreateTrunkParams) SetTransferMode(TransferMode string) (*CreateTrunkParams){ + params.TransferMode = &TransferMode + return params } -func (params *CreateTrunkParams) SetSecure(Secure bool) *CreateTrunkParams { - params.Secure = &Secure - return params +func (params *CreateTrunkParams) SetSecure(Secure bool) (*CreateTrunkParams){ + params.Secure = &Secure + return params } -func (params *CreateTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) *CreateTrunkParams { - params.CnamLookupEnabled = &CnamLookupEnabled - return params +func (params *CreateTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) (*CreateTrunkParams){ + params.CnamLookupEnabled = &CnamLookupEnabled + return params } -func (params *CreateTrunkParams) SetTransferCallerId(TransferCallerId string) *CreateTrunkParams { - params.TransferCallerId = &TransferCallerId - return params +func (params *CreateTrunkParams) SetTransferCallerId(TransferCallerId string) (*CreateTrunkParams){ + params.TransferCallerId = &TransferCallerId + return params } -// +// func (c *ApiService) CreateTrunk(params *CreateTrunkParams) (*TrunkingV1Trunk, error) { - path := "/v1/Trunks" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DomainName != nil { - data.Set("DomainName", *params.DomainName) - } - if params != nil && params.DisasterRecoveryUrl != nil { - data.Set("DisasterRecoveryUrl", *params.DisasterRecoveryUrl) - } - if params != nil && params.DisasterRecoveryMethod != nil { - data.Set("DisasterRecoveryMethod", *params.DisasterRecoveryMethod) - } - if params != nil && params.TransferMode != nil { - data.Set("TransferMode", *params.TransferMode) - } - if params != nil && params.Secure != nil { - data.Set("Secure", fmt.Sprint(*params.Secure)) - } - if params != nil && params.CnamLookupEnabled != nil { - data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) - } - if params != nil && params.TransferCallerId != nil { - data.Set("TransferCallerId", *params.TransferCallerId) - } + path := "/v1/Trunks" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DomainName != nil { + data.Set("DomainName", *params.DomainName) + } + if params != nil && params.DisasterRecoveryUrl != nil { + data.Set("DisasterRecoveryUrl", *params.DisasterRecoveryUrl) + } + if params != nil && params.DisasterRecoveryMethod != nil { + data.Set("DisasterRecoveryMethod", *params.DisasterRecoveryMethod) + } + if params != nil && params.TransferMode != nil { + data.Set("TransferMode", *params.TransferMode) + } + if params != nil && params.Secure != nil { + data.Set("Secure", fmt.Sprint(*params.Secure)) + } + if params != nil && params.CnamLookupEnabled != nil { + data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) + } + if params != nil && params.TransferCallerId != nil { + data.Set("TransferCallerId", *params.TransferCallerId) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1Trunk{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteTrunk(Sid string, ) (error) { + path := "/v1/Trunks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &TrunkingV1Trunk{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteTrunk(Sid string) error { - path := "/v1/Trunks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchTrunk(Sid string, ) (*TrunkingV1Trunk, error) { + path := "/v1/Trunks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchTrunk(Sid string) (*TrunkingV1Trunk, error) { - path := "/v1/Trunks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrunkingV1Trunk{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrunkingV1Trunk{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTrunk' type ListTrunkParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTrunkParams) SetPageSize(PageSize int) *ListTrunkParams { - params.PageSize = &PageSize - return params +func (params *ListTrunkParams) SetPageSize(PageSize int) (*ListTrunkParams){ + params.PageSize = &PageSize + return params } -func (params *ListTrunkParams) SetLimit(Limit int) *ListTrunkParams { - params.Limit = &Limit - return params +func (params *ListTrunkParams) SetLimit(Limit int) (*ListTrunkParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Trunk records from the API. Request is executed immediately. func (c *ApiService) PageTrunk(params *ListTrunkParams, pageToken, pageNumber string) (*ListTrunkResponse, error) { - path := "/v1/Trunks" + path := "/v1/Trunks" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTrunkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTrunkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Trunk records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -252,6 +258,7 @@ func (c *ApiService) StreamTrunk(params *ListTrunkParams) (chan TrunkingV1Trunk, return recordChannel, errorChannel } + func (c *ApiService) streamTrunk(response *ListTrunkResponse, params *ListTrunkParams, recordChannel chan TrunkingV1Trunk, errorChannel chan error) { curRecord := 1 @@ -283,120 +290,122 @@ func (c *ApiService) streamTrunk(response *ListTrunkResponse, params *ListTrunkP } func (c *ApiService) getNextListTrunkResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrunkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrunkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTrunk' type UpdateTrunkParams struct { - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. - DomainName *string `json:"DomainName,omitempty"` - // The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. - DisasterRecoveryUrl *string `json:"DisasterRecoveryUrl,omitempty"` - // The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. - DisasterRecoveryMethod *string `json:"DisasterRecoveryMethod,omitempty"` - // - TransferMode *string `json:"TransferMode,omitempty"` - // Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. - Secure *bool `json:"Secure,omitempty"` - // Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. - CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` - // - TransferCallerId *string `json:"TransferCallerId,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. + DomainName *string `json:"DomainName,omitempty"` + // The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. + DisasterRecoveryUrl *string `json:"DisasterRecoveryUrl,omitempty"` + // The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. + DisasterRecoveryMethod *string `json:"DisasterRecoveryMethod,omitempty"` + // + TransferMode *string `json:"TransferMode,omitempty"` + // Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. + Secure *bool `json:"Secure,omitempty"` + // Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` + // + TransferCallerId *string `json:"TransferCallerId,omitempty"` } -func (params *UpdateTrunkParams) SetFriendlyName(FriendlyName string) *UpdateTrunkParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateTrunkParams) SetFriendlyName(FriendlyName string) (*UpdateTrunkParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateTrunkParams) SetDomainName(DomainName string) *UpdateTrunkParams { - params.DomainName = &DomainName - return params +func (params *UpdateTrunkParams) SetDomainName(DomainName string) (*UpdateTrunkParams){ + params.DomainName = &DomainName + return params } -func (params *UpdateTrunkParams) SetDisasterRecoveryUrl(DisasterRecoveryUrl string) *UpdateTrunkParams { - params.DisasterRecoveryUrl = &DisasterRecoveryUrl - return params +func (params *UpdateTrunkParams) SetDisasterRecoveryUrl(DisasterRecoveryUrl string) (*UpdateTrunkParams){ + params.DisasterRecoveryUrl = &DisasterRecoveryUrl + return params } -func (params *UpdateTrunkParams) SetDisasterRecoveryMethod(DisasterRecoveryMethod string) *UpdateTrunkParams { - params.DisasterRecoveryMethod = &DisasterRecoveryMethod - return params +func (params *UpdateTrunkParams) SetDisasterRecoveryMethod(DisasterRecoveryMethod string) (*UpdateTrunkParams){ + params.DisasterRecoveryMethod = &DisasterRecoveryMethod + return params } -func (params *UpdateTrunkParams) SetTransferMode(TransferMode string) *UpdateTrunkParams { - params.TransferMode = &TransferMode - return params +func (params *UpdateTrunkParams) SetTransferMode(TransferMode string) (*UpdateTrunkParams){ + params.TransferMode = &TransferMode + return params } -func (params *UpdateTrunkParams) SetSecure(Secure bool) *UpdateTrunkParams { - params.Secure = &Secure - return params +func (params *UpdateTrunkParams) SetSecure(Secure bool) (*UpdateTrunkParams){ + params.Secure = &Secure + return params } -func (params *UpdateTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) *UpdateTrunkParams { - params.CnamLookupEnabled = &CnamLookupEnabled - return params +func (params *UpdateTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) (*UpdateTrunkParams){ + params.CnamLookupEnabled = &CnamLookupEnabled + return params } -func (params *UpdateTrunkParams) SetTransferCallerId(TransferCallerId string) *UpdateTrunkParams { - params.TransferCallerId = &TransferCallerId - return params +func (params *UpdateTrunkParams) SetTransferCallerId(TransferCallerId string) (*UpdateTrunkParams){ + params.TransferCallerId = &TransferCallerId + return params } -// +// func (c *ApiService) UpdateTrunk(Sid string, params *UpdateTrunkParams) (*TrunkingV1Trunk, error) { - path := "/v1/Trunks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DomainName != nil { - data.Set("DomainName", *params.DomainName) - } - if params != nil && params.DisasterRecoveryUrl != nil { - data.Set("DisasterRecoveryUrl", *params.DisasterRecoveryUrl) - } - if params != nil && params.DisasterRecoveryMethod != nil { - data.Set("DisasterRecoveryMethod", *params.DisasterRecoveryMethod) - } - if params != nil && params.TransferMode != nil { - data.Set("TransferMode", *params.TransferMode) - } - if params != nil && params.Secure != nil { - data.Set("Secure", fmt.Sprint(*params.Secure)) - } - if params != nil && params.CnamLookupEnabled != nil { - data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) - } - if params != nil && params.TransferCallerId != nil { - data.Set("TransferCallerId", *params.TransferCallerId) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TrunkingV1Trunk{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Trunks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DomainName != nil { + data.Set("DomainName", *params.DomainName) + } + if params != nil && params.DisasterRecoveryUrl != nil { + data.Set("DisasterRecoveryUrl", *params.DisasterRecoveryUrl) + } + if params != nil && params.DisasterRecoveryMethod != nil { + data.Set("DisasterRecoveryMethod", *params.DisasterRecoveryMethod) + } + if params != nil && params.TransferMode != nil { + data.Set("TransferMode", *params.TransferMode) + } + if params != nil && params.Secure != nil { + data.Set("Secure", fmt.Sprint(*params.Secure)) + } + if params != nil && params.CnamLookupEnabled != nil { + data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) + } + if params != nil && params.TransferCallerId != nil { + data.Set("TransferCallerId", *params.TransferCallerId) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1Trunk{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/trunking/v1/trunks_credential_lists.go b/rest/trunking/v1/trunks_credential_lists.go index 25b8c0f66..54b7ee7e5 100644 --- a/rest/trunking/v1/trunks_credential_lists.go +++ b/rest/trunking/v1/trunks_credential_lists.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCredentialList' type CreateCredentialListParams struct { - // The SID of the [Credential List](https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource) that you want to associate with the trunk. Once associated, we will authenticate access to the trunk against this list. - CredentialListSid *string `json:"CredentialListSid,omitempty"` + // The SID of the [Credential List](https://www.twilio.com/docs/voice/sip/api/sip-credentiallist-resource) that you want to associate with the trunk. Once associated, we will authenticate access to the trunk against this list. + CredentialListSid *string `json:"CredentialListSid,omitempty"` } -func (params *CreateCredentialListParams) SetCredentialListSid(CredentialListSid string) *CreateCredentialListParams { - params.CredentialListSid = &CredentialListSid - return params +func (params *CreateCredentialListParams) SetCredentialListSid(CredentialListSid string) (*CreateCredentialListParams){ + params.CredentialListSid = &CredentialListSid + return params } -// +// func (c *ApiService) CreateCredentialList(TrunkSid string, params *CreateCredentialListParams) (*TrunkingV1CredentialList, error) { - path := "/v1/Trunks/{TrunkSid}/CredentialLists" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path := "/v1/Trunks/{TrunkSid}/CredentialLists" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.CredentialListSid != nil { - data.Set("CredentialListSid", *params.CredentialListSid) - } + if params != nil && params.CredentialListSid != nil { + data.Set("CredentialListSid", *params.CredentialListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrunkingV1CredentialList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrunkingV1CredentialList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteCredentialList(TrunkSid string, Sid string) error { - path := "/v1/Trunks/{TrunkSid}/CredentialLists/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteCredentialList(TrunkSid string, Sid string, ) (error) { + path := "/v1/Trunks/{TrunkSid}/CredentialLists/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchCredentialList(TrunkSid string, Sid string) (*TrunkingV1CredentialList, error) { - path := "/v1/Trunks/{TrunkSid}/CredentialLists/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchCredentialList(TrunkSid string, Sid string, ) (*TrunkingV1CredentialList, error) { + path := "/v1/Trunks/{TrunkSid}/CredentialLists/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrunkingV1CredentialList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1CredentialList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCredentialList' type ListCredentialListParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCredentialListParams) SetPageSize(PageSize int) *ListCredentialListParams { - params.PageSize = &PageSize - return params +func (params *ListCredentialListParams) SetPageSize(PageSize int) (*ListCredentialListParams){ + params.PageSize = &PageSize + return params } -func (params *ListCredentialListParams) SetLimit(Limit int) *ListCredentialListParams { - params.Limit = &Limit - return params +func (params *ListCredentialListParams) SetLimit(Limit int) (*ListCredentialListParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CredentialList records from the API. Request is executed immediately. func (c *ApiService) PageCredentialList(TrunkSid string, params *ListCredentialListParams, pageToken, pageNumber string) (*ListCredentialListResponse, error) { - path := "/v1/Trunks/{TrunkSid}/CredentialLists" + path := "/v1/Trunks/{TrunkSid}/CredentialLists" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCredentialListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCredentialListResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CredentialList records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamCredentialList(TrunkSid string, params *ListCredentia return recordChannel, errorChannel } + func (c *ApiService) streamCredentialList(response *ListCredentialListResponse, params *ListCredentialListParams, recordChannel chan TrunkingV1CredentialList, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamCredentialList(response *ListCredentialListResponse, } func (c *ApiService) getNextListCredentialListResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCredentialListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCredentialListResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trunking/v1/trunks_ip_access_control_lists.go b/rest/trunking/v1/trunks_ip_access_control_lists.go index 3ab9fdf5a..1d4d47af3 100644 --- a/rest/trunking/v1/trunks_ip_access_control_lists.go +++ b/rest/trunking/v1/trunks_ip_access_control_lists.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIpAccessControlList' type CreateIpAccessControlListParams struct { - // The SID of the [IP Access Control List](https://www.twilio.com/docs/voice/sip/api/sip-ipaccesscontrollist-resource) that you want to associate with the trunk. - IpAccessControlListSid *string `json:"IpAccessControlListSid,omitempty"` + // The SID of the [IP Access Control List](https://www.twilio.com/docs/voice/sip/api/sip-ipaccesscontrollist-resource) that you want to associate with the trunk. + IpAccessControlListSid *string `json:"IpAccessControlListSid,omitempty"` } -func (params *CreateIpAccessControlListParams) SetIpAccessControlListSid(IpAccessControlListSid string) *CreateIpAccessControlListParams { - params.IpAccessControlListSid = &IpAccessControlListSid - return params +func (params *CreateIpAccessControlListParams) SetIpAccessControlListSid(IpAccessControlListSid string) (*CreateIpAccessControlListParams){ + params.IpAccessControlListSid = &IpAccessControlListSid + return params } // Associate an IP Access Control List with a Trunk func (c *ApiService) CreateIpAccessControlList(TrunkSid string, params *CreateIpAccessControlListParams) (*TrunkingV1IpAccessControlList, error) { - path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.IpAccessControlListSid != nil { - data.Set("IpAccessControlListSid", *params.IpAccessControlListSid) - } + if params != nil && params.IpAccessControlListSid != nil { + data.Set("IpAccessControlListSid", *params.IpAccessControlListSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrunkingV1IpAccessControlList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrunkingV1IpAccessControlList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an associated IP Access Control List from a Trunk -func (c *ApiService) DeleteIpAccessControlList(TrunkSid string, Sid string) error { - path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteIpAccessControlList(TrunkSid string, Sid string, ) (error) { + path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchIpAccessControlList(TrunkSid string, Sid string) (*TrunkingV1IpAccessControlList, error) { - path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchIpAccessControlList(TrunkSid string, Sid string, ) (*TrunkingV1IpAccessControlList, error) { + path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrunkingV1IpAccessControlList{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1IpAccessControlList{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListIpAccessControlList' type ListIpAccessControlListParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListIpAccessControlListParams) SetPageSize(PageSize int) *ListIpAccessControlListParams { - params.PageSize = &PageSize - return params +func (params *ListIpAccessControlListParams) SetPageSize(PageSize int) (*ListIpAccessControlListParams){ + params.PageSize = &PageSize + return params } -func (params *ListIpAccessControlListParams) SetLimit(Limit int) *ListIpAccessControlListParams { - params.Limit = &Limit - return params +func (params *ListIpAccessControlListParams) SetLimit(Limit int) (*ListIpAccessControlListParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IpAccessControlList records from the API. Request is executed immediately. func (c *ApiService) PageIpAccessControlList(TrunkSid string, params *ListIpAccessControlListParams, pageToken, pageNumber string) (*ListIpAccessControlListResponse, error) { - path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists" + path := "/v1/Trunks/{TrunkSid}/IpAccessControlLists" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIpAccessControlListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListIpAccessControlListResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists IpAccessControlList records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamIpAccessControlList(TrunkSid string, params *ListIpAc return recordChannel, errorChannel } + func (c *ApiService) streamIpAccessControlList(response *ListIpAccessControlListResponse, params *ListIpAccessControlListParams, recordChannel chan TrunkingV1IpAccessControlList, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamIpAccessControlList(response *ListIpAccessControlList } func (c *ApiService) getNextListIpAccessControlListResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIpAccessControlListResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListIpAccessControlListResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trunking/v1/trunks_origination_urls.go b/rest/trunking/v1/trunks_origination_urls.go index 147bdb0e1..399df76c6 100644 --- a/rest/trunking/v1/trunks_origination_urls.go +++ b/rest/trunking/v1/trunks_origination_urls.go @@ -18,178 +18,183 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateOriginationUrl' type CreateOriginationUrlParams struct { - // The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. - Weight *int `json:"Weight,omitempty"` - // The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. - Priority *int `json:"Priority,omitempty"` - // Whether the URL is enabled. The default is `true`. - Enabled *bool `json:"Enabled,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. - SipUrl *string `json:"SipUrl,omitempty"` + // The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. + Weight *int `json:"Weight,omitempty"` + // The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. + Priority *int `json:"Priority,omitempty"` + // Whether the URL is enabled. The default is `true`. + Enabled *bool `json:"Enabled,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. + SipUrl *string `json:"SipUrl,omitempty"` } -func (params *CreateOriginationUrlParams) SetWeight(Weight int) *CreateOriginationUrlParams { - params.Weight = &Weight - return params +func (params *CreateOriginationUrlParams) SetWeight(Weight int) (*CreateOriginationUrlParams){ + params.Weight = &Weight + return params } -func (params *CreateOriginationUrlParams) SetPriority(Priority int) *CreateOriginationUrlParams { - params.Priority = &Priority - return params +func (params *CreateOriginationUrlParams) SetPriority(Priority int) (*CreateOriginationUrlParams){ + params.Priority = &Priority + return params } -func (params *CreateOriginationUrlParams) SetEnabled(Enabled bool) *CreateOriginationUrlParams { - params.Enabled = &Enabled - return params +func (params *CreateOriginationUrlParams) SetEnabled(Enabled bool) (*CreateOriginationUrlParams){ + params.Enabled = &Enabled + return params } -func (params *CreateOriginationUrlParams) SetFriendlyName(FriendlyName string) *CreateOriginationUrlParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateOriginationUrlParams) SetFriendlyName(FriendlyName string) (*CreateOriginationUrlParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateOriginationUrlParams) SetSipUrl(SipUrl string) *CreateOriginationUrlParams { - params.SipUrl = &SipUrl - return params +func (params *CreateOriginationUrlParams) SetSipUrl(SipUrl string) (*CreateOriginationUrlParams){ + params.SipUrl = &SipUrl + return params } -// +// func (c *ApiService) CreateOriginationUrl(TrunkSid string, params *CreateOriginationUrlParams) (*TrunkingV1OriginationUrl, error) { - path := "/v1/Trunks/{TrunkSid}/OriginationUrls" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Weight != nil { - data.Set("Weight", fmt.Sprint(*params.Weight)) - } - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SipUrl != nil { - data.Set("SipUrl", *params.SipUrl) - } + path := "/v1/Trunks/{TrunkSid}/OriginationUrls" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Weight != nil { + data.Set("Weight", fmt.Sprint(*params.Weight)) + } + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SipUrl != nil { + data.Set("SipUrl", *params.SipUrl) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1OriginationUrl{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteOriginationUrl(TrunkSid string, Sid string, ) (error) { + path := "/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &TrunkingV1OriginationUrl{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteOriginationUrl(TrunkSid string, Sid string) error { - path := "/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchOriginationUrl(TrunkSid string, Sid string, ) (*TrunkingV1OriginationUrl, error) { + path := "/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchOriginationUrl(TrunkSid string, Sid string) (*TrunkingV1OriginationUrl, error) { - path := "/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrunkingV1OriginationUrl{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrunkingV1OriginationUrl{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListOriginationUrl' type ListOriginationUrlParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListOriginationUrlParams) SetPageSize(PageSize int) *ListOriginationUrlParams { - params.PageSize = &PageSize - return params +func (params *ListOriginationUrlParams) SetPageSize(PageSize int) (*ListOriginationUrlParams){ + params.PageSize = &PageSize + return params } -func (params *ListOriginationUrlParams) SetLimit(Limit int) *ListOriginationUrlParams { - params.Limit = &Limit - return params +func (params *ListOriginationUrlParams) SetLimit(Limit int) (*ListOriginationUrlParams){ + params.Limit = &Limit + return params } // Retrieve a single page of OriginationUrl records from the API. Request is executed immediately. func (c *ApiService) PageOriginationUrl(TrunkSid string, params *ListOriginationUrlParams, pageToken, pageNumber string) (*ListOriginationUrlResponse, error) { - path := "/v1/Trunks/{TrunkSid}/OriginationUrls" + path := "/v1/Trunks/{TrunkSid}/OriginationUrls" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListOriginationUrlResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListOriginationUrlResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists OriginationUrl records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -230,6 +235,7 @@ func (c *ApiService) StreamOriginationUrl(TrunkSid string, params *ListOriginati return recordChannel, errorChannel } + func (c *ApiService) streamOriginationUrl(response *ListOriginationUrlResponse, params *ListOriginationUrlParams, recordChannel chan TrunkingV1OriginationUrl, errorChannel chan error) { curRecord := 1 @@ -261,94 +267,96 @@ func (c *ApiService) streamOriginationUrl(response *ListOriginationUrlResponse, } func (c *ApiService) getNextListOriginationUrlResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListOriginationUrlResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListOriginationUrlResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateOriginationUrl' type UpdateOriginationUrlParams struct { - // The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. - Weight *int `json:"Weight,omitempty"` - // The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. - Priority *int `json:"Priority,omitempty"` - // Whether the URL is enabled. The default is `true`. - Enabled *bool `json:"Enabled,omitempty"` - // A descriptive string that you create to describe the resource. It can be up to 64 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. `sips` is NOT supported. - SipUrl *string `json:"SipUrl,omitempty"` + // The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. + Weight *int `json:"Weight,omitempty"` + // The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. + Priority *int `json:"Priority,omitempty"` + // Whether the URL is enabled. The default is `true`. + Enabled *bool `json:"Enabled,omitempty"` + // A descriptive string that you create to describe the resource. It can be up to 64 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. `sips` is NOT supported. + SipUrl *string `json:"SipUrl,omitempty"` } -func (params *UpdateOriginationUrlParams) SetWeight(Weight int) *UpdateOriginationUrlParams { - params.Weight = &Weight - return params +func (params *UpdateOriginationUrlParams) SetWeight(Weight int) (*UpdateOriginationUrlParams){ + params.Weight = &Weight + return params } -func (params *UpdateOriginationUrlParams) SetPriority(Priority int) *UpdateOriginationUrlParams { - params.Priority = &Priority - return params +func (params *UpdateOriginationUrlParams) SetPriority(Priority int) (*UpdateOriginationUrlParams){ + params.Priority = &Priority + return params } -func (params *UpdateOriginationUrlParams) SetEnabled(Enabled bool) *UpdateOriginationUrlParams { - params.Enabled = &Enabled - return params +func (params *UpdateOriginationUrlParams) SetEnabled(Enabled bool) (*UpdateOriginationUrlParams){ + params.Enabled = &Enabled + return params } -func (params *UpdateOriginationUrlParams) SetFriendlyName(FriendlyName string) *UpdateOriginationUrlParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateOriginationUrlParams) SetFriendlyName(FriendlyName string) (*UpdateOriginationUrlParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateOriginationUrlParams) SetSipUrl(SipUrl string) *UpdateOriginationUrlParams { - params.SipUrl = &SipUrl - return params +func (params *UpdateOriginationUrlParams) SetSipUrl(SipUrl string) (*UpdateOriginationUrlParams){ + params.SipUrl = &SipUrl + return params } -// +// func (c *ApiService) UpdateOriginationUrl(TrunkSid string, Sid string, params *UpdateOriginationUrlParams) (*TrunkingV1OriginationUrl, error) { - path := "/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Weight != nil { - data.Set("Weight", fmt.Sprint(*params.Weight)) - } - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.SipUrl != nil { - data.Set("SipUrl", *params.SipUrl) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TrunkingV1OriginationUrl{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Trunks/{TrunkSid}/OriginationUrls/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Weight != nil { + data.Set("Weight", fmt.Sprint(*params.Weight)) + } + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.SipUrl != nil { + data.Set("SipUrl", *params.SipUrl) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1OriginationUrl{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/trunking/v1/trunks_phone_numbers.go b/rest/trunking/v1/trunks_phone_numbers.go index 4670e4b37..4f02890f8 100644 --- a/rest/trunking/v1/trunks_phone_numbers.go +++ b/rest/trunking/v1/trunks_phone_numbers.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreatePhoneNumber' type CreatePhoneNumberParams struct { - // The SID of the [Incoming Phone Number](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) that you want to associate with the trunk. - PhoneNumberSid *string `json:"PhoneNumberSid,omitempty"` + // The SID of the [Incoming Phone Number](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) that you want to associate with the trunk. + PhoneNumberSid *string `json:"PhoneNumberSid,omitempty"` } -func (params *CreatePhoneNumberParams) SetPhoneNumberSid(PhoneNumberSid string) *CreatePhoneNumberParams { - params.PhoneNumberSid = &PhoneNumberSid - return params +func (params *CreatePhoneNumberParams) SetPhoneNumberSid(PhoneNumberSid string) (*CreatePhoneNumberParams){ + params.PhoneNumberSid = &PhoneNumberSid + return params } -// +// func (c *ApiService) CreatePhoneNumber(TrunkSid string, params *CreatePhoneNumberParams) (*TrunkingV1PhoneNumber, error) { - path := "/v1/Trunks/{TrunkSid}/PhoneNumbers" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path := "/v1/Trunks/{TrunkSid}/PhoneNumbers" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PhoneNumberSid != nil { - data.Set("PhoneNumberSid", *params.PhoneNumberSid) - } + if params != nil && params.PhoneNumberSid != nil { + data.Set("PhoneNumberSid", *params.PhoneNumberSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrunkingV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrunkingV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeletePhoneNumber(TrunkSid string, Sid string) error { - path := "/v1/Trunks/{TrunkSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeletePhoneNumber(TrunkSid string, Sid string, ) (error) { + path := "/v1/Trunks/{TrunkSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchPhoneNumber(TrunkSid string, Sid string) (*TrunkingV1PhoneNumber, error) { - path := "/v1/Trunks/{TrunkSid}/PhoneNumbers/{Sid}" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchPhoneNumber(TrunkSid string, Sid string, ) (*TrunkingV1PhoneNumber, error) { + path := "/v1/Trunks/{TrunkSid}/PhoneNumbers/{Sid}" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrunkingV1PhoneNumber{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrunkingV1PhoneNumber{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListPhoneNumber' type ListPhoneNumberParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListPhoneNumberParams) SetPageSize(PageSize int) *ListPhoneNumberParams { - params.PageSize = &PageSize - return params +func (params *ListPhoneNumberParams) SetPageSize(PageSize int) (*ListPhoneNumberParams){ + params.PageSize = &PageSize + return params } -func (params *ListPhoneNumberParams) SetLimit(Limit int) *ListPhoneNumberParams { - params.Limit = &Limit - return params +func (params *ListPhoneNumberParams) SetLimit(Limit int) (*ListPhoneNumberParams){ + params.Limit = &Limit + return params } // Retrieve a single page of PhoneNumber records from the API. Request is executed immediately. func (c *ApiService) PagePhoneNumber(TrunkSid string, params *ListPhoneNumberParams, pageToken, pageNumber string) (*ListPhoneNumberResponse, error) { - path := "/v1/Trunks/{TrunkSid}/PhoneNumbers" + path := "/v1/Trunks/{TrunkSid}/PhoneNumbers" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListPhoneNumberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists PhoneNumber records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamPhoneNumber(TrunkSid string, params *ListPhoneNumberP return recordChannel, errorChannel } + func (c *ApiService) streamPhoneNumber(response *ListPhoneNumberResponse, params *ListPhoneNumberParams, recordChannel chan TrunkingV1PhoneNumber, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamPhoneNumber(response *ListPhoneNumberResponse, params } func (c *ApiService) getNextListPhoneNumberResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPhoneNumberResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPhoneNumberResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trunking/v1/trunks_recording.go b/rest/trunking/v1/trunks_recording.go index 615fd2e51..638ff7054 100644 --- a/rest/trunking/v1/trunks_recording.go +++ b/rest/trunking/v1/trunks_recording.go @@ -16,76 +16,82 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchRecording(TrunkSid string) (*TrunkingV1Recording, error) { - path := "/v1/Trunks/{TrunkSid}/Recording" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchRecording(TrunkSid string, ) (*TrunkingV1Recording, error) { + path := "/v1/Trunks/{TrunkSid}/Recording" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrunkingV1Recording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &TrunkingV1Recording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateRecording' type UpdateRecordingParams struct { - // - Mode *string `json:"Mode,omitempty"` - // - Trim *string `json:"Trim,omitempty"` + // + Mode *string `json:"Mode,omitempty"` + // + Trim *string `json:"Trim,omitempty"` } -func (params *UpdateRecordingParams) SetMode(Mode string) *UpdateRecordingParams { - params.Mode = &Mode - return params +func (params *UpdateRecordingParams) SetMode(Mode string) (*UpdateRecordingParams){ + params.Mode = &Mode + return params } -func (params *UpdateRecordingParams) SetTrim(Trim string) *UpdateRecordingParams { - params.Trim = &Trim - return params +func (params *UpdateRecordingParams) SetTrim(Trim string) (*UpdateRecordingParams){ + params.Trim = &Trim + return params } -// +// func (c *ApiService) UpdateRecording(TrunkSid string, params *UpdateRecordingParams) (*TrunkingV1Recording, error) { - path := "/v1/Trunks/{TrunkSid}/Recording" - path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + path := "/v1/Trunks/{TrunkSid}/Recording" + path = strings.Replace(path, "{"+"TrunkSid"+"}", TrunkSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Mode != nil { + data.Set("Mode", *params.Mode) + } + if params != nil && params.Trim != nil { + data.Set("Trim", *params.Trim) + } - if params != nil && params.Mode != nil { - data.Set("Mode", *params.Mode) - } - if params != nil && params.Trim != nil { - data.Set("Trim", *params.Trim) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrunkingV1Recording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrunkingV1Recording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/trusthub/v1/README.md b/rest/trusthub/v1/README.md index 34d27f730..28bb53472 100644 --- a/rest/trusthub/v1/README.md +++ b/rest/trusthub/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) @@ -33,8 +33,6 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *ComplianceInquiriesCustomersInitializeApi* | [**CreateComplianceInquiry**](docs/ComplianceInquiriesCustomersInitializeApi.md#createcomplianceinquiry) | **Post** /v1/ComplianceInquiries/Customers/Initialize | *ComplianceInquiriesCustomersInitializeApi* | [**UpdateComplianceInquiry**](docs/ComplianceInquiriesCustomersInitializeApi.md#updatecomplianceinquiry) | **Post** /v1/ComplianceInquiries/Customers/{CustomerId}/Initialize | -*ComplianceInquiriesTollfreeInitializeApi* | [**CreateComplianceTollfreeInquiry**](docs/ComplianceInquiriesTollfreeInitializeApi.md#createcompliancetollfreeinquiry) | **Post** /v1/ComplianceInquiries/Tollfree/Initialize | -*ComplianceInquiriesTollfreeInitializeApi* | [**UpdateComplianceTollfreeInquiry**](docs/ComplianceInquiriesTollfreeInitializeApi.md#updatecompliancetollfreeinquiry) | **Post** /v1/ComplianceInquiries/Tollfree/{TollfreeId}/Initialize | *CustomerProfilesApi* | [**CreateCustomerProfile**](docs/CustomerProfilesApi.md#createcustomerprofile) | **Post** /v1/CustomerProfiles | *CustomerProfilesApi* | [**DeleteCustomerProfile**](docs/CustomerProfilesApi.md#deletecustomerprofile) | **Delete** /v1/CustomerProfiles/{Sid} | *CustomerProfilesApi* | [**FetchCustomerProfile**](docs/CustomerProfilesApi.md#fetchcustomerprofile) | **Get** /v1/CustomerProfiles/{Sid} | @@ -114,7 +112,6 @@ Class | Method | HTTP request | Description - [ListPoliciesResponse](docs/ListPoliciesResponse.md) - [ListTrustProductResponse](docs/ListTrustProductResponse.md) - [ListCustomerProfileChannelEndpointAssignmentResponse](docs/ListCustomerProfileChannelEndpointAssignmentResponse.md) - - [TrusthubV1ComplianceTollfreeInquiry](docs/TrusthubV1ComplianceTollfreeInquiry.md) - [TrusthubV1CustomerProfileEvaluation](docs/TrusthubV1CustomerProfileEvaluation.md) diff --git a/rest/trusthub/v1/api_service.go b/rest/trusthub/v1/api_service.go index 4811b5e51..4cab37598 100644 --- a/rest/trusthub/v1/api_service.go +++ b/rest/trusthub/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://trusthub.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/trusthub/v1/compliance_inquiries_customers_initialize.go b/rest/trusthub/v1/compliance_inquiries_customers_initialize.go index abe6880a2..aefe1351b 100644 --- a/rest/trusthub/v1/compliance_inquiries_customers_initialize.go +++ b/rest/trusthub/v1/compliance_inquiries_customers_initialize.go @@ -16,81 +16,86 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateComplianceInquiry' type CreateComplianceInquiryParams struct { - // The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. - PrimaryProfileSid *string `json:"PrimaryProfileSid,omitempty"` + // The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + PrimaryProfileSid *string `json:"PrimaryProfileSid,omitempty"` } -func (params *CreateComplianceInquiryParams) SetPrimaryProfileSid(PrimaryProfileSid string) *CreateComplianceInquiryParams { - params.PrimaryProfileSid = &PrimaryProfileSid - return params +func (params *CreateComplianceInquiryParams) SetPrimaryProfileSid(PrimaryProfileSid string) (*CreateComplianceInquiryParams){ + params.PrimaryProfileSid = &PrimaryProfileSid + return params } // Create a new Compliance Inquiry for the authenticated account. This is necessary to start a new embedded session. func (c *ApiService) CreateComplianceInquiry(params *CreateComplianceInquiryParams) (*TrusthubV1ComplianceInquiry, error) { - path := "/v1/ComplianceInquiries/Customers/Initialize" + path := "/v1/ComplianceInquiries/Customers/Initialize" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.PrimaryProfileSid != nil { + data.Set("PrimaryProfileSid", *params.PrimaryProfileSid) + } - if params != nil && params.PrimaryProfileSid != nil { - data.Set("PrimaryProfileSid", *params.PrimaryProfileSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrusthubV1ComplianceInquiry{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrusthubV1ComplianceInquiry{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateComplianceInquiry' type UpdateComplianceInquiryParams struct { - // The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. - PrimaryProfileSid *string `json:"PrimaryProfileSid,omitempty"` + // The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile. + PrimaryProfileSid *string `json:"PrimaryProfileSid,omitempty"` } -func (params *UpdateComplianceInquiryParams) SetPrimaryProfileSid(PrimaryProfileSid string) *UpdateComplianceInquiryParams { - params.PrimaryProfileSid = &PrimaryProfileSid - return params +func (params *UpdateComplianceInquiryParams) SetPrimaryProfileSid(PrimaryProfileSid string) (*UpdateComplianceInquiryParams){ + params.PrimaryProfileSid = &PrimaryProfileSid + return params } // Resume a specific Compliance Inquiry that has expired, or re-open a rejected Compliance Inquiry for editing. func (c *ApiService) UpdateComplianceInquiry(CustomerId string, params *UpdateComplianceInquiryParams) (*TrusthubV1ComplianceInquiry, error) { - path := "/v1/ComplianceInquiries/Customers/{CustomerId}/Initialize" - path = strings.Replace(path, "{"+"CustomerId"+"}", CustomerId, -1) + path := "/v1/ComplianceInquiries/Customers/{CustomerId}/Initialize" + path = strings.Replace(path, "{"+"CustomerId"+"}", CustomerId, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.PrimaryProfileSid != nil { + data.Set("PrimaryProfileSid", *params.PrimaryProfileSid) + } - if params != nil && params.PrimaryProfileSid != nil { - data.Set("PrimaryProfileSid", *params.PrimaryProfileSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrusthubV1ComplianceInquiry{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrusthubV1ComplianceInquiry{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/trusthub/v1/customer_profiles.go b/rest/trusthub/v1/customer_profiles.go index f6cf893ca..c6eff3b79 100644 --- a/rest/trusthub/v1/customer_profiles.go +++ b/rest/trusthub/v1/customer_profiles.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCustomerProfile' type CreateCustomerProfileParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The email address that will receive updates when the Customer-Profile resource changes status. - Email *string `json:"Email,omitempty"` - // The unique string of a policy that is associated to the Customer-Profile resource. - PolicySid *string `json:"PolicySid,omitempty"` - // The URL we call to inform your application of status changes. - StatusCallback *string `json:"StatusCallback,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The email address that will receive updates when the Customer-Profile resource changes status. + Email *string `json:"Email,omitempty"` + // The unique string of a policy that is associated to the Customer-Profile resource. + PolicySid *string `json:"PolicySid,omitempty"` + // The URL we call to inform your application of status changes. + StatusCallback *string `json:"StatusCallback,omitempty"` } -func (params *CreateCustomerProfileParams) SetFriendlyName(FriendlyName string) *CreateCustomerProfileParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCustomerProfileParams) SetFriendlyName(FriendlyName string) (*CreateCustomerProfileParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCustomerProfileParams) SetEmail(Email string) *CreateCustomerProfileParams { - params.Email = &Email - return params +func (params *CreateCustomerProfileParams) SetEmail(Email string) (*CreateCustomerProfileParams){ + params.Email = &Email + return params } -func (params *CreateCustomerProfileParams) SetPolicySid(PolicySid string) *CreateCustomerProfileParams { - params.PolicySid = &PolicySid - return params +func (params *CreateCustomerProfileParams) SetPolicySid(PolicySid string) (*CreateCustomerProfileParams){ + params.PolicySid = &PolicySid + return params } -func (params *CreateCustomerProfileParams) SetStatusCallback(StatusCallback string) *CreateCustomerProfileParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateCustomerProfileParams) SetStatusCallback(StatusCallback string) (*CreateCustomerProfileParams){ + params.StatusCallback = &StatusCallback + return params } // Create a new Customer-Profile. func (c *ApiService) CreateCustomerProfile(params *CreateCustomerProfileParams) (*TrusthubV1CustomerProfile, error) { - path := "/v1/CustomerProfiles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - if params != nil && params.PolicySid != nil { - data.Set("PolicySid", *params.PolicySid) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TrusthubV1CustomerProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CustomerProfiles" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + if params != nil && params.PolicySid != nil { + data.Set("PolicySid", *params.PolicySid) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Customer-Profile. -func (c *ApiService) DeleteCustomerProfile(Sid string) error { - path := "/v1/CustomerProfiles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCustomerProfile(Sid string, ) (error) { + path := "/v1/CustomerProfiles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Customer-Profile instance. -func (c *ApiService) FetchCustomerProfile(Sid string) (*TrusthubV1CustomerProfile, error) { - path := "/v1/CustomerProfiles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCustomerProfile(Sid string, ) (*TrusthubV1CustomerProfile, error) { + path := "/v1/CustomerProfiles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1CustomerProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCustomerProfile' type ListCustomerProfileParams struct { - // The verification status of the Customer-Profile resource. - Status *string `json:"Status,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The unique string of a policy that is associated to the Customer-Profile resource. - PolicySid *string `json:"PolicySid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The verification status of the Customer-Profile resource. + Status *string `json:"Status,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique string of a policy that is associated to the Customer-Profile resource. + PolicySid *string `json:"PolicySid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCustomerProfileParams) SetStatus(Status string) *ListCustomerProfileParams { - params.Status = &Status - return params +func (params *ListCustomerProfileParams) SetStatus(Status string) (*ListCustomerProfileParams){ + params.Status = &Status + return params } -func (params *ListCustomerProfileParams) SetFriendlyName(FriendlyName string) *ListCustomerProfileParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListCustomerProfileParams) SetFriendlyName(FriendlyName string) (*ListCustomerProfileParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListCustomerProfileParams) SetPolicySid(PolicySid string) *ListCustomerProfileParams { - params.PolicySid = &PolicySid - return params +func (params *ListCustomerProfileParams) SetPolicySid(PolicySid string) (*ListCustomerProfileParams){ + params.PolicySid = &PolicySid + return params } -func (params *ListCustomerProfileParams) SetPageSize(PageSize int) *ListCustomerProfileParams { - params.PageSize = &PageSize - return params +func (params *ListCustomerProfileParams) SetPageSize(PageSize int) (*ListCustomerProfileParams){ + params.PageSize = &PageSize + return params } -func (params *ListCustomerProfileParams) SetLimit(Limit int) *ListCustomerProfileParams { - params.Limit = &Limit - return params +func (params *ListCustomerProfileParams) SetLimit(Limit int) (*ListCustomerProfileParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CustomerProfile records from the API. Request is executed immediately. func (c *ApiService) PageCustomerProfile(params *ListCustomerProfileParams, pageToken, pageNumber string) (*ListCustomerProfileResponse, error) { - path := "/v1/CustomerProfiles" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PolicySid != nil { - data.Set("PolicySid", *params.PolicySid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCustomerProfileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CustomerProfiles" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PolicySid != nil { + data.Set("PolicySid", *params.PolicySid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCustomerProfileResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists CustomerProfile records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamCustomerProfile(params *ListCustomerProfileParams) (c return recordChannel, errorChannel } + func (c *ApiService) streamCustomerProfile(response *ListCustomerProfileResponse, params *ListCustomerProfileParams, recordChannel chan TrusthubV1CustomerProfile, errorChannel chan error) { curRecord := 1 @@ -274,84 +281,86 @@ func (c *ApiService) streamCustomerProfile(response *ListCustomerProfileResponse } func (c *ApiService) getNextListCustomerProfileResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCustomerProfileResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCustomerProfileResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCustomerProfile' type UpdateCustomerProfileParams struct { - // - Status *string `json:"Status,omitempty"` - // The URL we call to inform your application of status changes. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The email address that will receive updates when the Customer-Profile resource changes status. - Email *string `json:"Email,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The URL we call to inform your application of status changes. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The email address that will receive updates when the Customer-Profile resource changes status. + Email *string `json:"Email,omitempty"` } -func (params *UpdateCustomerProfileParams) SetStatus(Status string) *UpdateCustomerProfileParams { - params.Status = &Status - return params +func (params *UpdateCustomerProfileParams) SetStatus(Status string) (*UpdateCustomerProfileParams){ + params.Status = &Status + return params } -func (params *UpdateCustomerProfileParams) SetStatusCallback(StatusCallback string) *UpdateCustomerProfileParams { - params.StatusCallback = &StatusCallback - return params +func (params *UpdateCustomerProfileParams) SetStatusCallback(StatusCallback string) (*UpdateCustomerProfileParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *UpdateCustomerProfileParams) SetFriendlyName(FriendlyName string) *UpdateCustomerProfileParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateCustomerProfileParams) SetFriendlyName(FriendlyName string) (*UpdateCustomerProfileParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateCustomerProfileParams) SetEmail(Email string) *UpdateCustomerProfileParams { - params.Email = &Email - return params +func (params *UpdateCustomerProfileParams) SetEmail(Email string) (*UpdateCustomerProfileParams){ + params.Email = &Email + return params } // Updates a Customer-Profile in an account. func (c *ApiService) UpdateCustomerProfile(Sid string, params *UpdateCustomerProfileParams) (*TrusthubV1CustomerProfile, error) { - path := "/v1/CustomerProfiles/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TrusthubV1CustomerProfile{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CustomerProfiles/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfile{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/trusthub/v1/customer_profiles_channel_endpoint_assignments.go b/rest/trusthub/v1/customer_profiles_channel_endpoint_assignments.go index 81f947b6d..2704cc59e 100644 --- a/rest/trusthub/v1/customer_profiles_channel_endpoint_assignments.go +++ b/rest/trusthub/v1/customer_profiles_channel_endpoint_assignments.go @@ -18,169 +18,174 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCustomerProfileChannelEndpointAssignment' type CreateCustomerProfileChannelEndpointAssignmentParams struct { - // The type of channel endpoint. eg: phone-number - ChannelEndpointType *string `json:"ChannelEndpointType,omitempty"` - // The SID of an channel endpoint - ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` + // The type of channel endpoint. eg: phone-number + ChannelEndpointType *string `json:"ChannelEndpointType,omitempty"` + // The SID of an channel endpoint + ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` } -func (params *CreateCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointType(ChannelEndpointType string) *CreateCustomerProfileChannelEndpointAssignmentParams { - params.ChannelEndpointType = &ChannelEndpointType - return params +func (params *CreateCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointType(ChannelEndpointType string) (*CreateCustomerProfileChannelEndpointAssignmentParams){ + params.ChannelEndpointType = &ChannelEndpointType + return params } -func (params *CreateCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) *CreateCustomerProfileChannelEndpointAssignmentParams { - params.ChannelEndpointSid = &ChannelEndpointSid - return params +func (params *CreateCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) (*CreateCustomerProfileChannelEndpointAssignmentParams){ + params.ChannelEndpointSid = &ChannelEndpointSid + return params } // Create a new Assigned Item. func (c *ApiService) CreateCustomerProfileChannelEndpointAssignment(CustomerProfileSid string, params *CreateCustomerProfileChannelEndpointAssignmentParams) (*TrusthubV1CustomerProfileChannelEndpointAssignment, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ChannelEndpointType != nil { - data.Set("ChannelEndpointType", *params.ChannelEndpointType) - } - if params != nil && params.ChannelEndpointSid != nil { - data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) - } + if params != nil && params.ChannelEndpointType != nil { + data.Set("ChannelEndpointType", *params.ChannelEndpointType) + } + if params != nil && params.ChannelEndpointSid != nil { + data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1CustomerProfileChannelEndpointAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfileChannelEndpointAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an Assignment Item Instance. -func (c *ApiService) DeleteCustomerProfileChannelEndpointAssignment(CustomerProfileSid string, Sid string) error { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments/{Sid}" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCustomerProfileChannelEndpointAssignment(CustomerProfileSid string, Sid string, ) (error) { + path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments/{Sid}" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch specific Assigned Item Instance. -func (c *ApiService) FetchCustomerProfileChannelEndpointAssignment(CustomerProfileSid string, Sid string) (*TrusthubV1CustomerProfileChannelEndpointAssignment, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments/{Sid}" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCustomerProfileChannelEndpointAssignment(CustomerProfileSid string, Sid string, ) (*TrusthubV1CustomerProfileChannelEndpointAssignment, error) { + path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments/{Sid}" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1CustomerProfileChannelEndpointAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfileChannelEndpointAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListCustomerProfileChannelEndpointAssignment' type ListCustomerProfileChannelEndpointAssignmentParams struct { - // The SID of an channel endpoint - ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` - // comma separated list of channel endpoint sids - ChannelEndpointSids *string `json:"ChannelEndpointSids,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of an channel endpoint + ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` + // comma separated list of channel endpoint sids + ChannelEndpointSids *string `json:"ChannelEndpointSids,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) *ListCustomerProfileChannelEndpointAssignmentParams { - params.ChannelEndpointSid = &ChannelEndpointSid - return params +func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) (*ListCustomerProfileChannelEndpointAssignmentParams){ + params.ChannelEndpointSid = &ChannelEndpointSid + return params } -func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointSids(ChannelEndpointSids string) *ListCustomerProfileChannelEndpointAssignmentParams { - params.ChannelEndpointSids = &ChannelEndpointSids - return params +func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetChannelEndpointSids(ChannelEndpointSids string) (*ListCustomerProfileChannelEndpointAssignmentParams){ + params.ChannelEndpointSids = &ChannelEndpointSids + return params } -func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetPageSize(PageSize int) *ListCustomerProfileChannelEndpointAssignmentParams { - params.PageSize = &PageSize - return params +func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetPageSize(PageSize int) (*ListCustomerProfileChannelEndpointAssignmentParams){ + params.PageSize = &PageSize + return params } -func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetLimit(Limit int) *ListCustomerProfileChannelEndpointAssignmentParams { - params.Limit = &Limit - return params +func (params *ListCustomerProfileChannelEndpointAssignmentParams) SetLimit(Limit int) (*ListCustomerProfileChannelEndpointAssignmentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CustomerProfileChannelEndpointAssignment records from the API. Request is executed immediately. func (c *ApiService) PageCustomerProfileChannelEndpointAssignment(CustomerProfileSid string, params *ListCustomerProfileChannelEndpointAssignmentParams, pageToken, pageNumber string) (*ListCustomerProfileChannelEndpointAssignmentResponse, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments" - - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ChannelEndpointSid != nil { - data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) - } - if params != nil && params.ChannelEndpointSids != nil { - data.Set("ChannelEndpointSids", *params.ChannelEndpointSids) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCustomerProfileChannelEndpointAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CustomerProfiles/{CustomerProfileSid}/ChannelEndpointAssignments" + + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ChannelEndpointSid != nil { + data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) + } + if params != nil && params.ChannelEndpointSids != nil { + data.Set("ChannelEndpointSids", *params.ChannelEndpointSids) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCustomerProfileChannelEndpointAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists CustomerProfileChannelEndpointAssignment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -221,6 +226,7 @@ func (c *ApiService) StreamCustomerProfileChannelEndpointAssignment(CustomerProf return recordChannel, errorChannel } + func (c *ApiService) streamCustomerProfileChannelEndpointAssignment(response *ListCustomerProfileChannelEndpointAssignmentResponse, params *ListCustomerProfileChannelEndpointAssignmentParams, recordChannel chan TrusthubV1CustomerProfileChannelEndpointAssignment, errorChannel chan error) { curRecord := 1 @@ -252,19 +258,20 @@ func (c *ApiService) streamCustomerProfileChannelEndpointAssignment(response *Li } func (c *ApiService) getNextListCustomerProfileChannelEndpointAssignmentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCustomerProfileChannelEndpointAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCustomerProfileChannelEndpointAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/customer_profiles_entity_assignments.go b/rest/trusthub/v1/customer_profiles_entity_assignments.go index e21cc9441..577fa226f 100644 --- a/rest/trusthub/v1/customer_profiles_entity_assignments.go +++ b/rest/trusthub/v1/customer_profiles_entity_assignments.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCustomerProfileEntityAssignment' type CreateCustomerProfileEntityAssignmentParams struct { - // The SID of an object bag that holds information of the different items. - ObjectSid *string `json:"ObjectSid,omitempty"` + // The SID of an object bag that holds information of the different items. + ObjectSid *string `json:"ObjectSid,omitempty"` } -func (params *CreateCustomerProfileEntityAssignmentParams) SetObjectSid(ObjectSid string) *CreateCustomerProfileEntityAssignmentParams { - params.ObjectSid = &ObjectSid - return params +func (params *CreateCustomerProfileEntityAssignmentParams) SetObjectSid(ObjectSid string) (*CreateCustomerProfileEntityAssignmentParams){ + params.ObjectSid = &ObjectSid + return params } // Create a new Assigned Item. func (c *ApiService) CreateCustomerProfileEntityAssignment(CustomerProfileSid string, params *CreateCustomerProfileEntityAssignmentParams) (*TrusthubV1CustomerProfileEntityAssignment, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ObjectSid != nil { - data.Set("ObjectSid", *params.ObjectSid) - } + if params != nil && params.ObjectSid != nil { + data.Set("ObjectSid", *params.ObjectSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1CustomerProfileEntityAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfileEntityAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an Assignment Item Instance. -func (c *ApiService) DeleteCustomerProfileEntityAssignment(CustomerProfileSid string, Sid string) error { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments/{Sid}" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCustomerProfileEntityAssignment(CustomerProfileSid string, Sid string, ) (error) { + path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments/{Sid}" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific Assigned Item Instance. -func (c *ApiService) FetchCustomerProfileEntityAssignment(CustomerProfileSid string, Sid string) (*TrusthubV1CustomerProfileEntityAssignment, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments/{Sid}" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCustomerProfileEntityAssignment(CustomerProfileSid string, Sid string, ) (*TrusthubV1CustomerProfileEntityAssignment, error) { + path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments/{Sid}" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1CustomerProfileEntityAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfileEntityAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCustomerProfileEntityAssignment' type ListCustomerProfileEntityAssignmentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCustomerProfileEntityAssignmentParams) SetPageSize(PageSize int) *ListCustomerProfileEntityAssignmentParams { - params.PageSize = &PageSize - return params +func (params *ListCustomerProfileEntityAssignmentParams) SetPageSize(PageSize int) (*ListCustomerProfileEntityAssignmentParams){ + params.PageSize = &PageSize + return params } -func (params *ListCustomerProfileEntityAssignmentParams) SetLimit(Limit int) *ListCustomerProfileEntityAssignmentParams { - params.Limit = &Limit - return params +func (params *ListCustomerProfileEntityAssignmentParams) SetLimit(Limit int) (*ListCustomerProfileEntityAssignmentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CustomerProfileEntityAssignment records from the API. Request is executed immediately. func (c *ApiService) PageCustomerProfileEntityAssignment(CustomerProfileSid string, params *ListCustomerProfileEntityAssignmentParams, pageToken, pageNumber string) (*ListCustomerProfileEntityAssignmentResponse, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments" + path := "/v1/CustomerProfiles/{CustomerProfileSid}/EntityAssignments" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCustomerProfileEntityAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCustomerProfileEntityAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CustomerProfileEntityAssignment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamCustomerProfileEntityAssignment(CustomerProfileSid st return recordChannel, errorChannel } + func (c *ApiService) streamCustomerProfileEntityAssignment(response *ListCustomerProfileEntityAssignmentResponse, params *ListCustomerProfileEntityAssignmentParams, recordChannel chan TrusthubV1CustomerProfileEntityAssignment, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamCustomerProfileEntityAssignment(response *ListCustome } func (c *ApiService) getNextListCustomerProfileEntityAssignmentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCustomerProfileEntityAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCustomerProfileEntityAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/customer_profiles_evaluations.go b/rest/trusthub/v1/customer_profiles_evaluations.go index e56546485..848ddd640 100644 --- a/rest/trusthub/v1/customer_profiles_evaluations.go +++ b/rest/trusthub/v1/customer_profiles_evaluations.go @@ -18,123 +18,126 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCustomerProfileEvaluation' type CreateCustomerProfileEvaluationParams struct { - // The unique string of a policy that is associated to the customer_profile resource. - PolicySid *string `json:"PolicySid,omitempty"` + // The unique string of a policy that is associated to the customer_profile resource. + PolicySid *string `json:"PolicySid,omitempty"` } -func (params *CreateCustomerProfileEvaluationParams) SetPolicySid(PolicySid string) *CreateCustomerProfileEvaluationParams { - params.PolicySid = &PolicySid - return params +func (params *CreateCustomerProfileEvaluationParams) SetPolicySid(PolicySid string) (*CreateCustomerProfileEvaluationParams){ + params.PolicySid = &PolicySid + return params } // Create a new Evaluation func (c *ApiService) CreateCustomerProfileEvaluation(CustomerProfileSid string, params *CreateCustomerProfileEvaluationParams) (*TrusthubV1CustomerProfileEvaluation, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/Evaluations" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path := "/v1/CustomerProfiles/{CustomerProfileSid}/Evaluations" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PolicySid != nil { - data.Set("PolicySid", *params.PolicySid) - } + if params != nil && params.PolicySid != nil { + data.Set("PolicySid", *params.PolicySid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1CustomerProfileEvaluation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &TrusthubV1CustomerProfileEvaluation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch specific Evaluation Instance. -func (c *ApiService) FetchCustomerProfileEvaluation(CustomerProfileSid string, Sid string) (*TrusthubV1CustomerProfileEvaluation, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/Evaluations/{Sid}" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCustomerProfileEvaluation(CustomerProfileSid string, Sid string, ) (*TrusthubV1CustomerProfileEvaluation, error) { + path := "/v1/CustomerProfiles/{CustomerProfileSid}/Evaluations/{Sid}" + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1CustomerProfileEvaluation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &TrusthubV1CustomerProfileEvaluation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListCustomerProfileEvaluation' type ListCustomerProfileEvaluationParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCustomerProfileEvaluationParams) SetPageSize(PageSize int) *ListCustomerProfileEvaluationParams { - params.PageSize = &PageSize - return params +func (params *ListCustomerProfileEvaluationParams) SetPageSize(PageSize int) (*ListCustomerProfileEvaluationParams){ + params.PageSize = &PageSize + return params } -func (params *ListCustomerProfileEvaluationParams) SetLimit(Limit int) *ListCustomerProfileEvaluationParams { - params.Limit = &Limit - return params +func (params *ListCustomerProfileEvaluationParams) SetLimit(Limit int) (*ListCustomerProfileEvaluationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CustomerProfileEvaluation records from the API. Request is executed immediately. func (c *ApiService) PageCustomerProfileEvaluation(CustomerProfileSid string, params *ListCustomerProfileEvaluationParams, pageToken, pageNumber string) (*ListCustomerProfileEvaluationResponse, error) { - path := "/v1/CustomerProfiles/{CustomerProfileSid}/Evaluations" + path := "/v1/CustomerProfiles/{CustomerProfileSid}/Evaluations" - path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) + path = strings.Replace(path, "{"+"CustomerProfileSid"+"}", CustomerProfileSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCustomerProfileEvaluationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListCustomerProfileEvaluationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists CustomerProfileEvaluation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -175,6 +178,7 @@ func (c *ApiService) StreamCustomerProfileEvaluation(CustomerProfileSid string, return recordChannel, errorChannel } + func (c *ApiService) streamCustomerProfileEvaluation(response *ListCustomerProfileEvaluationResponse, params *ListCustomerProfileEvaluationParams, recordChannel chan TrusthubV1CustomerProfileEvaluation, errorChannel chan error) { curRecord := 1 @@ -206,19 +210,20 @@ func (c *ApiService) streamCustomerProfileEvaluation(response *ListCustomerProfi } func (c *ApiService) getNextListCustomerProfileEvaluationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCustomerProfileEvaluationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCustomerProfileEvaluationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/docs/ListCustomerProfileResponseMeta.md b/rest/trusthub/v1/docs/ListCustomerProfileResponseMeta.md index 39e75d704..8c80c7490 100644 --- a/rest/trusthub/v1/docs/ListCustomerProfileResponseMeta.md +++ b/rest/trusthub/v1/docs/ListCustomerProfileResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/trusthub/v1/end_user_types.go b/rest/trusthub/v1/end_user_types.go index 4acde972e..7d3a8d6eb 100644 --- a/rest/trusthub/v1/end_user_types.go +++ b/rest/trusthub/v1/end_user_types.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific End-User Type Instance. -func (c *ApiService) FetchEndUserType(Sid string) (*TrusthubV1EndUserType, error) { - path := "/v1/EndUserTypes/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEndUserType(Sid string, ) (*TrusthubV1EndUserType, error) { + path := "/v1/EndUserTypes/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1EndUserType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &TrusthubV1EndUserType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListEndUserType' type ListEndUserTypeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEndUserTypeParams) SetPageSize(PageSize int) *ListEndUserTypeParams { - params.PageSize = &PageSize - return params +func (params *ListEndUserTypeParams) SetPageSize(PageSize int) (*ListEndUserTypeParams){ + params.PageSize = &PageSize + return params } -func (params *ListEndUserTypeParams) SetLimit(Limit int) *ListEndUserTypeParams { - params.Limit = &Limit - return params +func (params *ListEndUserTypeParams) SetLimit(Limit int) (*ListEndUserTypeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of EndUserType records from the API. Request is executed immediately. func (c *ApiService) PageEndUserType(params *ListEndUserTypeParams, pageToken, pageNumber string) (*ListEndUserTypeResponse, error) { - path := "/v1/EndUserTypes" + path := "/v1/EndUserTypes" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEndUserTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEndUserTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists EndUserType records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamEndUserType(params *ListEndUserTypeParams) (chan Trus return recordChannel, errorChannel } + func (c *ApiService) streamEndUserType(response *ListEndUserTypeResponse, params *ListEndUserTypeParams, recordChannel chan TrusthubV1EndUserType, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamEndUserType(response *ListEndUserTypeResponse, params } func (c *ApiService) getNextListEndUserTypeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEndUserTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEndUserTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/end_users.go b/rest/trusthub/v1/end_users.go index 47d0b5525..275e3bd4d 100644 --- a/rest/trusthub/v1/end_users.go +++ b/rest/trusthub/v1/end_users.go @@ -18,161 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateEndUser' type CreateEndUserParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The type of end user of the Bundle resource - can be `individual` or `business`. - Type *string `json:"Type,omitempty"` - // The set of parameters that are the attributes of the End User resource which are derived End User Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The type of end user of the Bundle resource - can be `individual` or `business`. + Type *string `json:"Type,omitempty"` + // The set of parameters that are the attributes of the End User resource which are derived End User Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *CreateEndUserParams) SetFriendlyName(FriendlyName string) *CreateEndUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateEndUserParams) SetFriendlyName(FriendlyName string) (*CreateEndUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateEndUserParams) SetType(Type string) *CreateEndUserParams { - params.Type = &Type - return params +func (params *CreateEndUserParams) SetType(Type string) (*CreateEndUserParams){ + params.Type = &Type + return params } -func (params *CreateEndUserParams) SetAttributes(Attributes interface{}) *CreateEndUserParams { - params.Attributes = &Attributes - return params +func (params *CreateEndUserParams) SetAttributes(Attributes interface{}) (*CreateEndUserParams){ + params.Attributes = &Attributes + return params } // Create a new End User. func (c *ApiService) CreateEndUser(params *CreateEndUserParams) (*TrusthubV1EndUser, error) { - path := "/v1/EndUsers" + path := "/v1/EndUsers" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Attributes", string(v)) + } - data.Set("Attributes", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrusthubV1EndUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrusthubV1EndUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific End User. -func (c *ApiService) DeleteEndUser(Sid string) error { - path := "/v1/EndUsers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteEndUser(Sid string, ) (error) { + path := "/v1/EndUsers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific End User Instance. -func (c *ApiService) FetchEndUser(Sid string) (*TrusthubV1EndUser, error) { - path := "/v1/EndUsers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchEndUser(Sid string, ) (*TrusthubV1EndUser, error) { + path := "/v1/EndUsers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1EndUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1EndUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListEndUser' type ListEndUserParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEndUserParams) SetPageSize(PageSize int) *ListEndUserParams { - params.PageSize = &PageSize - return params +func (params *ListEndUserParams) SetPageSize(PageSize int) (*ListEndUserParams){ + params.PageSize = &PageSize + return params } -func (params *ListEndUserParams) SetLimit(Limit int) *ListEndUserParams { - params.Limit = &Limit - return params +func (params *ListEndUserParams) SetLimit(Limit int) (*ListEndUserParams){ + params.Limit = &Limit + return params } // Retrieve a single page of EndUser records from the API. Request is executed immediately. func (c *ApiService) PageEndUser(params *ListEndUserParams, pageToken, pageNumber string) (*ListEndUserResponse, error) { - path := "/v1/EndUsers" + path := "/v1/EndUsers" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEndUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEndUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists EndUser records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -213,6 +219,7 @@ func (c *ApiService) StreamEndUser(params *ListEndUserParams) (chan TrusthubV1En return recordChannel, errorChannel } + func (c *ApiService) streamEndUser(response *ListEndUserResponse, params *ListEndUserParams, recordChannel chan TrusthubV1EndUser, errorChannel chan error) { curRecord := 1 @@ -244,72 +251,74 @@ func (c *ApiService) streamEndUser(response *ListEndUserResponse, params *ListEn } func (c *ApiService) getNextListEndUserResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEndUserResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEndUserResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateEndUser' type UpdateEndUserParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The set of parameters that are the attributes of the End User resource which are derived End User Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The set of parameters that are the attributes of the End User resource which are derived End User Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *UpdateEndUserParams) SetFriendlyName(FriendlyName string) *UpdateEndUserParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateEndUserParams) SetFriendlyName(FriendlyName string) (*UpdateEndUserParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateEndUserParams) SetAttributes(Attributes interface{}) *UpdateEndUserParams { - params.Attributes = &Attributes - return params +func (params *UpdateEndUserParams) SetAttributes(Attributes interface{}) (*UpdateEndUserParams){ + params.Attributes = &Attributes + return params } // Update an existing End User. func (c *ApiService) UpdateEndUser(Sid string, params *UpdateEndUserParams) (*TrusthubV1EndUser, error) { - path := "/v1/EndUsers/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/EndUsers/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Attributes", string(v)) - } + data.Set("Attributes", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1EndUser{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrusthubV1EndUser{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/trusthub/v1/model_list_customer_profile_channel_endpoint_assignment_response.go b/rest/trusthub/v1/model_list_customer_profile_channel_endpoint_assignment_response.go index 8f43e3a0d..261b343ef 100644 --- a/rest/trusthub/v1/model_list_customer_profile_channel_endpoint_assignment_response.go +++ b/rest/trusthub/v1/model_list_customer_profile_channel_endpoint_assignment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCustomerProfileChannelEndpointAssignmentResponse struct for ListCustomerProfileChannelEndpointAssignmentResponse type ListCustomerProfileChannelEndpointAssignmentResponse struct { Results []TrusthubV1CustomerProfileChannelEndpointAssignment `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_customer_profile_entity_assignment_response.go b/rest/trusthub/v1/model_list_customer_profile_entity_assignment_response.go index 115c85b2c..122783f0e 100644 --- a/rest/trusthub/v1/model_list_customer_profile_entity_assignment_response.go +++ b/rest/trusthub/v1/model_list_customer_profile_entity_assignment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCustomerProfileEntityAssignmentResponse struct for ListCustomerProfileEntityAssignmentResponse type ListCustomerProfileEntityAssignmentResponse struct { Results []TrusthubV1CustomerProfileEntityAssignment `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_customer_profile_evaluation_response.go b/rest/trusthub/v1/model_list_customer_profile_evaluation_response.go index 76b939f43..0557c6784 100644 --- a/rest/trusthub/v1/model_list_customer_profile_evaluation_response.go +++ b/rest/trusthub/v1/model_list_customer_profile_evaluation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCustomerProfileEvaluationResponse struct for ListCustomerProfileEvaluationResponse type ListCustomerProfileEvaluationResponse struct { Results []TrusthubV1CustomerProfileEvaluation `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_customer_profile_response.go b/rest/trusthub/v1/model_list_customer_profile_response.go index 1f975e6d8..5c60e0c51 100644 --- a/rest/trusthub/v1/model_list_customer_profile_response.go +++ b/rest/trusthub/v1/model_list_customer_profile_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCustomerProfileResponse struct for ListCustomerProfileResponse type ListCustomerProfileResponse struct { - Results []TrusthubV1CustomerProfile `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Results []TrusthubV1CustomerProfile `json:"results,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_customer_profile_response_meta.go b/rest/trusthub/v1/model_list_customer_profile_response_meta.go index a3592289a..d60f6699a 100644 --- a/rest/trusthub/v1/model_list_customer_profile_response_meta.go +++ b/rest/trusthub/v1/model_list_customer_profile_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCustomerProfileResponseMeta struct for ListCustomerProfileResponseMeta type ListCustomerProfileResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_end_user_response.go b/rest/trusthub/v1/model_list_end_user_response.go index cdbd23359..4455d3de8 100644 --- a/rest/trusthub/v1/model_list_end_user_response.go +++ b/rest/trusthub/v1/model_list_end_user_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEndUserResponse struct for ListEndUserResponse type ListEndUserResponse struct { - Results []TrusthubV1EndUser `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Results []TrusthubV1EndUser `json:"results,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_end_user_type_response.go b/rest/trusthub/v1/model_list_end_user_type_response.go index 942fe5a7a..3a2ac615d 100644 --- a/rest/trusthub/v1/model_list_end_user_type_response.go +++ b/rest/trusthub/v1/model_list_end_user_type_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEndUserTypeResponse struct for ListEndUserTypeResponse type ListEndUserTypeResponse struct { - EndUserTypes []TrusthubV1EndUserType `json:"end_user_types,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + EndUserTypes []TrusthubV1EndUserType `json:"end_user_types,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_policies_response.go b/rest/trusthub/v1/model_list_policies_response.go index f60c7c250..18765804a 100644 --- a/rest/trusthub/v1/model_list_policies_response.go +++ b/rest/trusthub/v1/model_list_policies_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListPoliciesResponse struct for ListPoliciesResponse type ListPoliciesResponse struct { - Results []TrusthubV1Policies `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Results []TrusthubV1Policies `json:"results,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_supporting_document_response.go b/rest/trusthub/v1/model_list_supporting_document_response.go index 7ddef7353..1805cc148 100644 --- a/rest/trusthub/v1/model_list_supporting_document_response.go +++ b/rest/trusthub/v1/model_list_supporting_document_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSupportingDocumentResponse struct for ListSupportingDocumentResponse type ListSupportingDocumentResponse struct { - Results []TrusthubV1SupportingDocument `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Results []TrusthubV1SupportingDocument `json:"results,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_supporting_document_type_response.go b/rest/trusthub/v1/model_list_supporting_document_type_response.go index bca3315c2..e9990427a 100644 --- a/rest/trusthub/v1/model_list_supporting_document_type_response.go +++ b/rest/trusthub/v1/model_list_supporting_document_type_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSupportingDocumentTypeResponse struct for ListSupportingDocumentTypeResponse type ListSupportingDocumentTypeResponse struct { SupportingDocumentTypes []TrusthubV1SupportingDocumentType `json:"supporting_document_types,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_trust_product_channel_endpoint_assignment_response.go b/rest/trusthub/v1/model_list_trust_product_channel_endpoint_assignment_response.go index f63fd9f75..8edeae5b3 100644 --- a/rest/trusthub/v1/model_list_trust_product_channel_endpoint_assignment_response.go +++ b/rest/trusthub/v1/model_list_trust_product_channel_endpoint_assignment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrustProductChannelEndpointAssignmentResponse struct for ListTrustProductChannelEndpointAssignmentResponse type ListTrustProductChannelEndpointAssignmentResponse struct { Results []TrusthubV1TrustProductChannelEndpointAssignment `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_trust_product_entity_assignment_response.go b/rest/trusthub/v1/model_list_trust_product_entity_assignment_response.go index f51ed0fb3..bf12cc3b8 100644 --- a/rest/trusthub/v1/model_list_trust_product_entity_assignment_response.go +++ b/rest/trusthub/v1/model_list_trust_product_entity_assignment_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrustProductEntityAssignmentResponse struct for ListTrustProductEntityAssignmentResponse type ListTrustProductEntityAssignmentResponse struct { Results []TrusthubV1TrustProductEntityAssignment `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_trust_product_evaluation_response.go b/rest/trusthub/v1/model_list_trust_product_evaluation_response.go index e7230eb85..79aea49ee 100644 --- a/rest/trusthub/v1/model_list_trust_product_evaluation_response.go +++ b/rest/trusthub/v1/model_list_trust_product_evaluation_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrustProductEvaluationResponse struct for ListTrustProductEvaluationResponse type ListTrustProductEvaluationResponse struct { Results []TrusthubV1TrustProductEvaluation `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_list_trust_product_response.go b/rest/trusthub/v1/model_list_trust_product_response.go index b3bac7e62..8ed7b4f46 100644 --- a/rest/trusthub/v1/model_list_trust_product_response.go +++ b/rest/trusthub/v1/model_list_trust_product_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListTrustProductResponse struct for ListTrustProductResponse type ListTrustProductResponse struct { - Results []TrusthubV1TrustProduct `json:"results,omitempty"` - Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` + Results []TrusthubV1TrustProduct `json:"results,omitempty"` + Meta ListCustomerProfileResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_compliance_inquiry.go b/rest/trusthub/v1/model_trusthub_v1_compliance_inquiry.go index 9a85d718e..cad362734 100644 --- a/rest/trusthub/v1/model_trusthub_v1_compliance_inquiry.go +++ b/rest/trusthub/v1/model_trusthub_v1_compliance_inquiry.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TrusthubV1ComplianceInquiry struct for TrusthubV1ComplianceInquiry type TrusthubV1ComplianceInquiry struct { - // The unique ID used to start an embedded compliance registration session. + // The unique ID used to start an embedded compliance registration session. InquiryId *string `json:"inquiry_id,omitempty"` - // The session token used to start an embedded compliance registration session. + // The session token used to start an embedded compliance registration session. InquirySessionToken *string `json:"inquiry_session_token,omitempty"` - // The CustomerID matching the Customer Profile that should be resumed or resubmitted for editing. + // The CustomerID matching the Customer Profile that should be resumed or resubmitted for editing. CustomerId *string `json:"customer_id,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_customer_profile.go b/rest/trusthub/v1/model_trusthub_v1_customer_profile.go index a5fe5b9ef..76f144351 100644 --- a/rest/trusthub/v1/model_trusthub_v1_customer_profile.go +++ b/rest/trusthub/v1/model_trusthub_v1_customer_profile.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1CustomerProfile struct for TrusthubV1CustomerProfile type TrusthubV1CustomerProfile struct { - // The unique string that we created to identify the Customer-Profile resource. + // The unique string that we created to identify the Customer-Profile resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a policy that is associated to the Customer-Profile resource. + // The unique string of a policy that is associated to the Customer-Profile resource. PolicySid *string `json:"policy_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + Status *string `json:"status,omitempty"` + // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. ValidUntil *time.Time `json:"valid_until,omitempty"` - // The email address that will receive updates when the Customer-Profile resource changes status. + // The email address that will receive updates when the Customer-Profile resource changes status. Email *string `json:"email,omitempty"` - // The URL we call to inform your application of status changes. + // The URL we call to inform your application of status changes. StatusCallback *string `json:"status_callback,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Customer-Profile resource. + // The absolute URL of the Customer-Profile resource. Url *string `json:"url,omitempty"` - // The URLs of the Assigned Items of the Customer-Profile resource. + // The URLs of the Assigned Items of the Customer-Profile resource. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_customer_profile_channel_endpoint_assignment.go b/rest/trusthub/v1/model_trusthub_v1_customer_profile_channel_endpoint_assignment.go index 7195c91c7..e237d0f36 100644 --- a/rest/trusthub/v1/model_trusthub_v1_customer_profile_channel_endpoint_assignment.go +++ b/rest/trusthub/v1/model_trusthub_v1_customer_profile_channel_endpoint_assignment.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1CustomerProfileChannelEndpointAssignment struct for TrusthubV1CustomerProfileChannelEndpointAssignment type TrusthubV1CustomerProfileChannelEndpointAssignment struct { - // The unique string that we created to identify the Item Assignment resource. + // The unique string that we created to identify the Item Assignment resource. Sid *string `json:"sid,omitempty"` - // The unique string that we created to identify the CustomerProfile resource. + // The unique string that we created to identify the CustomerProfile resource. CustomerProfileSid *string `json:"customer_profile_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. AccountSid *string `json:"account_sid,omitempty"` - // The type of channel endpoint. eg: phone-number + // The type of channel endpoint. eg: phone-number ChannelEndpointType *string `json:"channel_endpoint_type,omitempty"` - // The SID of an channel endpoint + // The SID of an channel endpoint ChannelEndpointSid *string `json:"channel_endpoint_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Identity resource. + // The absolute URL of the Identity resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_customer_profile_entity_assignment.go b/rest/trusthub/v1/model_trusthub_v1_customer_profile_entity_assignment.go index bf5828993..d5cdfac44 100644 --- a/rest/trusthub/v1/model_trusthub_v1_customer_profile_entity_assignment.go +++ b/rest/trusthub/v1/model_trusthub_v1_customer_profile_entity_assignment.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1CustomerProfileEntityAssignment struct for TrusthubV1CustomerProfileEntityAssignment type TrusthubV1CustomerProfileEntityAssignment struct { - // The unique string that we created to identify the Item Assignment resource. + // The unique string that we created to identify the Item Assignment resource. Sid *string `json:"sid,omitempty"` - // The unique string that we created to identify the CustomerProfile resource. + // The unique string that we created to identify the CustomerProfile resource. CustomerProfileSid *string `json:"customer_profile_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of an object bag that holds information of the different items. + // The SID of an object bag that holds information of the different items. ObjectSid *string `json:"object_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Identity resource. + // The absolute URL of the Identity resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_customer_profile_evaluation.go b/rest/trusthub/v1/model_trusthub_v1_customer_profile_evaluation.go index cbbc09624..1425e0793 100644 --- a/rest/trusthub/v1/model_trusthub_v1_customer_profile_evaluation.go +++ b/rest/trusthub/v1/model_trusthub_v1_customer_profile_evaluation.go @@ -13,24 +13,26 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1CustomerProfileEvaluation struct for TrusthubV1CustomerProfileEvaluation type TrusthubV1CustomerProfileEvaluation struct { - // The unique string that identifies the Evaluation resource. + // The unique string that identifies the Evaluation resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the customer_profile resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the customer_profile resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a policy that is associated to the customer_profile resource. + // The unique string of a policy that is associated to the customer_profile resource. PolicySid *string `json:"policy_sid,omitempty"` - // The unique string that we created to identify the customer_profile resource. + // The unique string that we created to identify the customer_profile resource. CustomerProfileSid *string `json:"customer_profile_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The results of the Evaluation which includes the valid and invalid attributes. - Results *[]interface{} `json:"results,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - Url *string `json:"url,omitempty"` + Status *string `json:"status,omitempty"` + // The results of the Evaluation which includes the valid and invalid attributes. + Results *[]interface{} `json:"results,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_end_user.go b/rest/trusthub/v1/model_trusthub_v1_end_user.go index 0e5098f1f..8239b9704 100644 --- a/rest/trusthub/v1/model_trusthub_v1_end_user.go +++ b/rest/trusthub/v1/model_trusthub_v1_end_user.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1EndUser struct for TrusthubV1EndUser type TrusthubV1EndUser struct { - // The unique string created by Twilio to identify the End User resource. + // The unique string created by Twilio to identify the End User resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The type of end user of the Bundle resource - can be `individual` or `business`. + // The type of end user of the Bundle resource - can be `individual` or `business`. Type *string `json:"type,omitempty"` - // The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. + // The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. Attributes *interface{} `json:"attributes,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the End User resource. + // The absolute URL of the End User resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_end_user_type.go b/rest/trusthub/v1/model_trusthub_v1_end_user_type.go index c48bef639..53e36c1d9 100644 --- a/rest/trusthub/v1/model_trusthub_v1_end_user_type.go +++ b/rest/trusthub/v1/model_trusthub_v1_end_user_type.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TrusthubV1EndUserType struct for TrusthubV1EndUserType type TrusthubV1EndUserType struct { - // The unique string that identifies the End-User Type resource. + // The unique string that identifies the End-User Type resource. Sid *string `json:"sid,omitempty"` - // A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc + // A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc FriendlyName *string `json:"friendly_name,omitempty"` - // A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. + // A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. MachineName *string `json:"machine_name,omitempty"` - // The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. + // The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. Fields *[]interface{} `json:"fields,omitempty"` - // The absolute URL of the End-User Type resource. + // The absolute URL of the End-User Type resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_policies.go b/rest/trusthub/v1/model_trusthub_v1_policies.go index 5bf137c17..4867f876e 100644 --- a/rest/trusthub/v1/model_trusthub_v1_policies.go +++ b/rest/trusthub/v1/model_trusthub_v1_policies.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TrusthubV1Policies struct for TrusthubV1Policies type TrusthubV1Policies struct { - // The unique string that identifies the Policy resource. + // The unique string that identifies the Policy resource. Sid *string `json:"sid,omitempty"` - // A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy + // A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of an object that holds the policy information + // The SID of an object that holds the policy information Requirements *interface{} `json:"requirements,omitempty"` - // The absolute URL of the Policy resource. + // The absolute URL of the Policy resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_supporting_document.go b/rest/trusthub/v1/model_trusthub_v1_supporting_document.go index b4d06c209..ff4bce3d6 100644 --- a/rest/trusthub/v1/model_trusthub_v1_supporting_document.go +++ b/rest/trusthub/v1/model_trusthub_v1_supporting_document.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1SupportingDocument struct for TrusthubV1SupportingDocument type TrusthubV1SupportingDocument struct { - // The unique string created by Twilio to identify the Supporting Document resource. + // The unique string created by Twilio to identify the Supporting Document resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The image type uploaded in the Supporting Document container. + // The image type uploaded in the Supporting Document container. MimeType *string `json:"mime_type,omitempty"` - Status *string `json:"status,omitempty"` - // The type of the Supporting Document. + Status *string `json:"status,omitempty"` + // The type of the Supporting Document. Type *string `json:"type,omitempty"` - // The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. + // The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. Attributes *interface{} `json:"attributes,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Supporting Document resource. + // The absolute URL of the Supporting Document resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_supporting_document_type.go b/rest/trusthub/v1/model_trusthub_v1_supporting_document_type.go index bbcd3be58..c615c2abc 100644 --- a/rest/trusthub/v1/model_trusthub_v1_supporting_document_type.go +++ b/rest/trusthub/v1/model_trusthub_v1_supporting_document_type.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // TrusthubV1SupportingDocumentType struct for TrusthubV1SupportingDocumentType type TrusthubV1SupportingDocumentType struct { - // The unique string that identifies the Supporting Document Type resource. + // The unique string that identifies the Supporting Document Type resource. Sid *string `json:"sid,omitempty"` - // A human-readable description of the Supporting Document Type resource. + // A human-readable description of the Supporting Document Type resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The machine-readable description of the Supporting Document Type resource. + // The machine-readable description of the Supporting Document Type resource. MachineName *string `json:"machine_name,omitempty"` - // The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. + // The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. Fields *[]interface{} `json:"fields,omitempty"` - // The absolute URL of the Supporting Document Type resource. + // The absolute URL of the Supporting Document Type resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_trust_product.go b/rest/trusthub/v1/model_trusthub_v1_trust_product.go index f228e2e35..1f24233b1 100644 --- a/rest/trusthub/v1/model_trusthub_v1_trust_product.go +++ b/rest/trusthub/v1/model_trusthub_v1_trust_product.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1TrustProduct struct for TrusthubV1TrustProduct type TrusthubV1TrustProduct struct { - // The unique string that we created to identify the Customer-Profile resource. + // The unique string that we created to identify the Customer-Profile resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a policy that is associated to the Customer-Profile resource. + // The unique string of a policy that is associated to the Customer-Profile resource. PolicySid *string `json:"policy_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + Status *string `json:"status,omitempty"` + // The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. ValidUntil *time.Time `json:"valid_until,omitempty"` - // The email address that will receive updates when the Customer-Profile resource changes status. + // The email address that will receive updates when the Customer-Profile resource changes status. Email *string `json:"email,omitempty"` - // The URL we call to inform your application of status changes. + // The URL we call to inform your application of status changes. StatusCallback *string `json:"status_callback,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Customer-Profile resource. + // The absolute URL of the Customer-Profile resource. Url *string `json:"url,omitempty"` - // The URLs of the Assigned Items of the Customer-Profile resource. + // The URLs of the Assigned Items of the Customer-Profile resource. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_trust_product_channel_endpoint_assignment.go b/rest/trusthub/v1/model_trusthub_v1_trust_product_channel_endpoint_assignment.go index fe6174e65..861024b42 100644 --- a/rest/trusthub/v1/model_trusthub_v1_trust_product_channel_endpoint_assignment.go +++ b/rest/trusthub/v1/model_trusthub_v1_trust_product_channel_endpoint_assignment.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1TrustProductChannelEndpointAssignment struct for TrusthubV1TrustProductChannelEndpointAssignment type TrusthubV1TrustProductChannelEndpointAssignment struct { - // The unique string that we created to identify the Item Assignment resource. + // The unique string that we created to identify the Item Assignment resource. Sid *string `json:"sid,omitempty"` - // The unique string that we created to identify the CustomerProfile resource. + // The unique string that we created to identify the CustomerProfile resource. TrustProductSid *string `json:"trust_product_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. AccountSid *string `json:"account_sid,omitempty"` - // The type of channel endpoint. eg: phone-number + // The type of channel endpoint. eg: phone-number ChannelEndpointType *string `json:"channel_endpoint_type,omitempty"` - // The SID of an channel endpoint + // The SID of an channel endpoint ChannelEndpointSid *string `json:"channel_endpoint_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Identity resource. + // The absolute URL of the Identity resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_trust_product_entity_assignment.go b/rest/trusthub/v1/model_trusthub_v1_trust_product_entity_assignment.go index 2a30a5b3d..ba2faf936 100644 --- a/rest/trusthub/v1/model_trusthub_v1_trust_product_entity_assignment.go +++ b/rest/trusthub/v1/model_trusthub_v1_trust_product_entity_assignment.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1TrustProductEntityAssignment struct for TrusthubV1TrustProductEntityAssignment type TrusthubV1TrustProductEntityAssignment struct { - // The unique string that we created to identify the Item Assignment resource. + // The unique string that we created to identify the Item Assignment resource. Sid *string `json:"sid,omitempty"` - // The unique string that we created to identify the TrustProduct resource. + // The unique string that we created to identify the TrustProduct resource. TrustProductSid *string `json:"trust_product_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of an object bag that holds information of the different items. + // The SID of an object bag that holds information of the different items. ObjectSid *string `json:"object_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The absolute URL of the Identity resource. + // The absolute URL of the Identity resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/model_trusthub_v1_trust_product_evaluation.go b/rest/trusthub/v1/model_trusthub_v1_trust_product_evaluation.go index dc616c2e6..1e2c2fedb 100644 --- a/rest/trusthub/v1/model_trusthub_v1_trust_product_evaluation.go +++ b/rest/trusthub/v1/model_trusthub_v1_trust_product_evaluation.go @@ -13,24 +13,26 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // TrusthubV1TrustProductEvaluation struct for TrusthubV1TrustProductEvaluation type TrusthubV1TrustProductEvaluation struct { - // The unique string that identifies the Evaluation resource. + // The unique string that identifies the Evaluation resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the trust_product resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the trust_product resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string of a policy that is associated to the trust_product resource. + // The unique string of a policy that is associated to the trust_product resource. PolicySid *string `json:"policy_sid,omitempty"` - // The unique string that we created to identify the trust_product resource. + // The unique string that we created to identify the trust_product resource. TrustProductSid *string `json:"trust_product_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The results of the Evaluation which includes the valid and invalid attributes. - Results *[]interface{} `json:"results,omitempty"` - DateCreated *time.Time `json:"date_created,omitempty"` - Url *string `json:"url,omitempty"` + Status *string `json:"status,omitempty"` + // The results of the Evaluation which includes the valid and invalid attributes. + Results *[]interface{} `json:"results,omitempty"` + DateCreated *time.Time `json:"date_created,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/trusthub/v1/policies.go b/rest/trusthub/v1/policies.go index 2c06d0452..7fa2b0539 100644 --- a/rest/trusthub/v1/policies.go +++ b/rest/trusthub/v1/policies.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch specific Policy Instance. -func (c *ApiService) FetchPolicies(Sid string) (*TrusthubV1Policies, error) { - path := "/v1/Policies/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchPolicies(Sid string, ) (*TrusthubV1Policies, error) { + path := "/v1/Policies/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1Policies{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &TrusthubV1Policies{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListPolicies' type ListPoliciesParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListPoliciesParams) SetPageSize(PageSize int) *ListPoliciesParams { - params.PageSize = &PageSize - return params +func (params *ListPoliciesParams) SetPageSize(PageSize int) (*ListPoliciesParams){ + params.PageSize = &PageSize + return params } -func (params *ListPoliciesParams) SetLimit(Limit int) *ListPoliciesParams { - params.Limit = &Limit - return params +func (params *ListPoliciesParams) SetLimit(Limit int) (*ListPoliciesParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Policies records from the API. Request is executed immediately. func (c *ApiService) PagePolicies(params *ListPoliciesParams, pageToken, pageNumber string) (*ListPoliciesResponse, error) { - path := "/v1/Policies" + path := "/v1/Policies" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListPoliciesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListPoliciesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Policies records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamPolicies(params *ListPoliciesParams) (chan TrusthubV1 return recordChannel, errorChannel } + func (c *ApiService) streamPolicies(response *ListPoliciesResponse, params *ListPoliciesParams, recordChannel chan TrusthubV1Policies, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamPolicies(response *ListPoliciesResponse, params *List } func (c *ApiService) getNextListPoliciesResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListPoliciesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListPoliciesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/supporting_document_types.go b/rest/trusthub/v1/supporting_document_types.go index 6c929f71e..edb7ddb8a 100644 --- a/rest/trusthub/v1/supporting_document_types.go +++ b/rest/trusthub/v1/supporting_document_types.go @@ -18,82 +18,85 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific Supporting Document Type Instance. -func (c *ApiService) FetchSupportingDocumentType(Sid string) (*TrusthubV1SupportingDocumentType, error) { - path := "/v1/SupportingDocumentTypes/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSupportingDocumentType(Sid string, ) (*TrusthubV1SupportingDocumentType, error) { + path := "/v1/SupportingDocumentTypes/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1SupportingDocumentType{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &TrusthubV1SupportingDocumentType{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSupportingDocumentType' type ListSupportingDocumentTypeParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSupportingDocumentTypeParams) SetPageSize(PageSize int) *ListSupportingDocumentTypeParams { - params.PageSize = &PageSize - return params +func (params *ListSupportingDocumentTypeParams) SetPageSize(PageSize int) (*ListSupportingDocumentTypeParams){ + params.PageSize = &PageSize + return params } -func (params *ListSupportingDocumentTypeParams) SetLimit(Limit int) *ListSupportingDocumentTypeParams { - params.Limit = &Limit - return params +func (params *ListSupportingDocumentTypeParams) SetLimit(Limit int) (*ListSupportingDocumentTypeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SupportingDocumentType records from the API. Request is executed immediately. func (c *ApiService) PageSupportingDocumentType(params *ListSupportingDocumentTypeParams, pageToken, pageNumber string) (*ListSupportingDocumentTypeResponse, error) { - path := "/v1/SupportingDocumentTypes" + path := "/v1/SupportingDocumentTypes" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSupportingDocumentTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSupportingDocumentTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SupportingDocumentType records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -134,6 +137,7 @@ func (c *ApiService) StreamSupportingDocumentType(params *ListSupportingDocument return recordChannel, errorChannel } + func (c *ApiService) streamSupportingDocumentType(response *ListSupportingDocumentTypeResponse, params *ListSupportingDocumentTypeParams, recordChannel chan TrusthubV1SupportingDocumentType, errorChannel chan error) { curRecord := 1 @@ -165,19 +169,20 @@ func (c *ApiService) streamSupportingDocumentType(response *ListSupportingDocume } func (c *ApiService) getNextListSupportingDocumentTypeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSupportingDocumentTypeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSupportingDocumentTypeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/supporting_documents.go b/rest/trusthub/v1/supporting_documents.go index ac2e78c0b..c1c0cbfb7 100644 --- a/rest/trusthub/v1/supporting_documents.go +++ b/rest/trusthub/v1/supporting_documents.go @@ -18,161 +18,167 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSupportingDocument' type CreateSupportingDocumentParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The type of the Supporting Document. - Type *string `json:"Type,omitempty"` - // The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The type of the Supporting Document. + Type *string `json:"Type,omitempty"` + // The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *CreateSupportingDocumentParams) SetFriendlyName(FriendlyName string) *CreateSupportingDocumentParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateSupportingDocumentParams) SetFriendlyName(FriendlyName string) (*CreateSupportingDocumentParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateSupportingDocumentParams) SetType(Type string) *CreateSupportingDocumentParams { - params.Type = &Type - return params +func (params *CreateSupportingDocumentParams) SetType(Type string) (*CreateSupportingDocumentParams){ + params.Type = &Type + return params } -func (params *CreateSupportingDocumentParams) SetAttributes(Attributes interface{}) *CreateSupportingDocumentParams { - params.Attributes = &Attributes - return params +func (params *CreateSupportingDocumentParams) SetAttributes(Attributes interface{}) (*CreateSupportingDocumentParams){ + params.Attributes = &Attributes + return params } // Create a new Supporting Document. func (c *ApiService) CreateSupportingDocument(params *CreateSupportingDocumentParams) (*TrusthubV1SupportingDocument, error) { - path := "/v1/SupportingDocuments" + path := "/v1/SupportingDocuments" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Attributes", string(v)) + } - data.Set("Attributes", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &TrusthubV1SupportingDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &TrusthubV1SupportingDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Supporting Document. -func (c *ApiService) DeleteSupportingDocument(Sid string) error { - path := "/v1/SupportingDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSupportingDocument(Sid string, ) (error) { + path := "/v1/SupportingDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific Supporting Document Instance. -func (c *ApiService) FetchSupportingDocument(Sid string) (*TrusthubV1SupportingDocument, error) { - path := "/v1/SupportingDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSupportingDocument(Sid string, ) (*TrusthubV1SupportingDocument, error) { + path := "/v1/SupportingDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1SupportingDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1SupportingDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSupportingDocument' type ListSupportingDocumentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSupportingDocumentParams) SetPageSize(PageSize int) *ListSupportingDocumentParams { - params.PageSize = &PageSize - return params +func (params *ListSupportingDocumentParams) SetPageSize(PageSize int) (*ListSupportingDocumentParams){ + params.PageSize = &PageSize + return params } -func (params *ListSupportingDocumentParams) SetLimit(Limit int) *ListSupportingDocumentParams { - params.Limit = &Limit - return params +func (params *ListSupportingDocumentParams) SetLimit(Limit int) (*ListSupportingDocumentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SupportingDocument records from the API. Request is executed immediately. func (c *ApiService) PageSupportingDocument(params *ListSupportingDocumentParams, pageToken, pageNumber string) (*ListSupportingDocumentResponse, error) { - path := "/v1/SupportingDocuments" + path := "/v1/SupportingDocuments" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSupportingDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSupportingDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SupportingDocument records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -213,6 +219,7 @@ func (c *ApiService) StreamSupportingDocument(params *ListSupportingDocumentPara return recordChannel, errorChannel } + func (c *ApiService) streamSupportingDocument(response *ListSupportingDocumentResponse, params *ListSupportingDocumentParams, recordChannel chan TrusthubV1SupportingDocument, errorChannel chan error) { curRecord := 1 @@ -244,72 +251,74 @@ func (c *ApiService) streamSupportingDocument(response *ListSupportingDocumentRe } func (c *ApiService) getNextListSupportingDocumentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSupportingDocumentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSupportingDocumentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSupportingDocument' type UpdateSupportingDocumentParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. - Attributes *interface{} `json:"Attributes,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. + Attributes *interface{} `json:"Attributes,omitempty"` } -func (params *UpdateSupportingDocumentParams) SetFriendlyName(FriendlyName string) *UpdateSupportingDocumentParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateSupportingDocumentParams) SetFriendlyName(FriendlyName string) (*UpdateSupportingDocumentParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateSupportingDocumentParams) SetAttributes(Attributes interface{}) *UpdateSupportingDocumentParams { - params.Attributes = &Attributes - return params +func (params *UpdateSupportingDocumentParams) SetAttributes(Attributes interface{}) (*UpdateSupportingDocumentParams){ + params.Attributes = &Attributes + return params } // Update an existing Supporting Document. func (c *ApiService) UpdateSupportingDocument(Sid string, params *UpdateSupportingDocumentParams) (*TrusthubV1SupportingDocument, error) { - path := "/v1/SupportingDocuments/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/SupportingDocuments/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Attributes != nil { - v, err := json.Marshal(params.Attributes) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Attributes != nil { + v, err := json.Marshal(params.Attributes) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Attributes", string(v)) - } + data.Set("Attributes", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1SupportingDocument{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrusthubV1SupportingDocument{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/trusthub/v1/trust_products.go b/rest/trusthub/v1/trust_products.go index 5d6de413e..7fde58cfd 100644 --- a/rest/trusthub/v1/trust_products.go +++ b/rest/trusthub/v1/trust_products.go @@ -18,191 +18,197 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTrustProduct' type CreateTrustProductParams struct { - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The email address that will receive updates when the Customer-Profile resource changes status. - Email *string `json:"Email,omitempty"` - // The unique string of a policy that is associated to the Customer-Profile resource. - PolicySid *string `json:"PolicySid,omitempty"` - // The URL we call to inform your application of status changes. - StatusCallback *string `json:"StatusCallback,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The email address that will receive updates when the Customer-Profile resource changes status. + Email *string `json:"Email,omitempty"` + // The unique string of a policy that is associated to the Customer-Profile resource. + PolicySid *string `json:"PolicySid,omitempty"` + // The URL we call to inform your application of status changes. + StatusCallback *string `json:"StatusCallback,omitempty"` } -func (params *CreateTrustProductParams) SetFriendlyName(FriendlyName string) *CreateTrustProductParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateTrustProductParams) SetFriendlyName(FriendlyName string) (*CreateTrustProductParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateTrustProductParams) SetEmail(Email string) *CreateTrustProductParams { - params.Email = &Email - return params +func (params *CreateTrustProductParams) SetEmail(Email string) (*CreateTrustProductParams){ + params.Email = &Email + return params } -func (params *CreateTrustProductParams) SetPolicySid(PolicySid string) *CreateTrustProductParams { - params.PolicySid = &PolicySid - return params +func (params *CreateTrustProductParams) SetPolicySid(PolicySid string) (*CreateTrustProductParams){ + params.PolicySid = &PolicySid + return params } -func (params *CreateTrustProductParams) SetStatusCallback(StatusCallback string) *CreateTrustProductParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateTrustProductParams) SetStatusCallback(StatusCallback string) (*CreateTrustProductParams){ + params.StatusCallback = &StatusCallback + return params } // Create a new Customer-Profile. func (c *ApiService) CreateTrustProduct(params *CreateTrustProductParams) (*TrusthubV1TrustProduct, error) { - path := "/v1/TrustProducts" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - if params != nil && params.PolicySid != nil { - data.Set("PolicySid", *params.PolicySid) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TrusthubV1TrustProduct{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/TrustProducts" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + if params != nil && params.PolicySid != nil { + data.Set("PolicySid", *params.PolicySid) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1TrustProduct{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Customer-Profile. -func (c *ApiService) DeleteTrustProduct(Sid string) error { - path := "/v1/TrustProducts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteTrustProduct(Sid string, ) (error) { + path := "/v1/TrustProducts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Customer-Profile instance. -func (c *ApiService) FetchTrustProduct(Sid string) (*TrusthubV1TrustProduct, error) { - path := "/v1/TrustProducts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchTrustProduct(Sid string, ) (*TrusthubV1TrustProduct, error) { + path := "/v1/TrustProducts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1TrustProduct{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1TrustProduct{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTrustProduct' type ListTrustProductParams struct { - // The verification status of the Customer-Profile resource. - Status *string `json:"Status,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The unique string of a policy that is associated to the Customer-Profile resource. - PolicySid *string `json:"PolicySid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The verification status of the Customer-Profile resource. + Status *string `json:"Status,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The unique string of a policy that is associated to the Customer-Profile resource. + PolicySid *string `json:"PolicySid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTrustProductParams) SetStatus(Status string) *ListTrustProductParams { - params.Status = &Status - return params +func (params *ListTrustProductParams) SetStatus(Status string) (*ListTrustProductParams){ + params.Status = &Status + return params } -func (params *ListTrustProductParams) SetFriendlyName(FriendlyName string) *ListTrustProductParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListTrustProductParams) SetFriendlyName(FriendlyName string) (*ListTrustProductParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListTrustProductParams) SetPolicySid(PolicySid string) *ListTrustProductParams { - params.PolicySid = &PolicySid - return params +func (params *ListTrustProductParams) SetPolicySid(PolicySid string) (*ListTrustProductParams){ + params.PolicySid = &PolicySid + return params } -func (params *ListTrustProductParams) SetPageSize(PageSize int) *ListTrustProductParams { - params.PageSize = &PageSize - return params +func (params *ListTrustProductParams) SetPageSize(PageSize int) (*ListTrustProductParams){ + params.PageSize = &PageSize + return params } -func (params *ListTrustProductParams) SetLimit(Limit int) *ListTrustProductParams { - params.Limit = &Limit - return params +func (params *ListTrustProductParams) SetLimit(Limit int) (*ListTrustProductParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TrustProduct records from the API. Request is executed immediately. func (c *ApiService) PageTrustProduct(params *ListTrustProductParams, pageToken, pageNumber string) (*ListTrustProductResponse, error) { - path := "/v1/TrustProducts" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PolicySid != nil { - data.Set("PolicySid", *params.PolicySid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrustProductResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/TrustProducts" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PolicySid != nil { + data.Set("PolicySid", *params.PolicySid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrustProductResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists TrustProduct records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -243,6 +249,7 @@ func (c *ApiService) StreamTrustProduct(params *ListTrustProductParams) (chan Tr return recordChannel, errorChannel } + func (c *ApiService) streamTrustProduct(response *ListTrustProductResponse, params *ListTrustProductParams, recordChannel chan TrusthubV1TrustProduct, errorChannel chan error) { curRecord := 1 @@ -274,84 +281,86 @@ func (c *ApiService) streamTrustProduct(response *ListTrustProductResponse, para } func (c *ApiService) getNextListTrustProductResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrustProductResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrustProductResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateTrustProduct' type UpdateTrustProductParams struct { - // - Status *string `json:"Status,omitempty"` - // The URL we call to inform your application of status changes. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The string that you assigned to describe the resource. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The email address that will receive updates when the Customer-Profile resource changes status. - Email *string `json:"Email,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The URL we call to inform your application of status changes. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The string that you assigned to describe the resource. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The email address that will receive updates when the Customer-Profile resource changes status. + Email *string `json:"Email,omitempty"` } -func (params *UpdateTrustProductParams) SetStatus(Status string) *UpdateTrustProductParams { - params.Status = &Status - return params +func (params *UpdateTrustProductParams) SetStatus(Status string) (*UpdateTrustProductParams){ + params.Status = &Status + return params } -func (params *UpdateTrustProductParams) SetStatusCallback(StatusCallback string) *UpdateTrustProductParams { - params.StatusCallback = &StatusCallback - return params +func (params *UpdateTrustProductParams) SetStatusCallback(StatusCallback string) (*UpdateTrustProductParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *UpdateTrustProductParams) SetFriendlyName(FriendlyName string) *UpdateTrustProductParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateTrustProductParams) SetFriendlyName(FriendlyName string) (*UpdateTrustProductParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateTrustProductParams) SetEmail(Email string) *UpdateTrustProductParams { - params.Email = &Email - return params +func (params *UpdateTrustProductParams) SetEmail(Email string) (*UpdateTrustProductParams){ + params.Email = &Email + return params } // Updates a Customer-Profile in an account. func (c *ApiService) UpdateTrustProduct(Sid string, params *UpdateTrustProductParams) (*TrusthubV1TrustProduct, error) { - path := "/v1/TrustProducts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Email != nil { - data.Set("Email", *params.Email) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &TrusthubV1TrustProduct{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/TrustProducts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Email != nil { + data.Set("Email", *params.Email) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1TrustProduct{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/trusthub/v1/trust_products_channel_endpoint_assignments.go b/rest/trusthub/v1/trust_products_channel_endpoint_assignments.go index c90bc4ca0..039c56c96 100644 --- a/rest/trusthub/v1/trust_products_channel_endpoint_assignments.go +++ b/rest/trusthub/v1/trust_products_channel_endpoint_assignments.go @@ -18,169 +18,174 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTrustProductChannelEndpointAssignment' type CreateTrustProductChannelEndpointAssignmentParams struct { - // The type of channel endpoint. eg: phone-number - ChannelEndpointType *string `json:"ChannelEndpointType,omitempty"` - // The SID of an channel endpoint - ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` + // The type of channel endpoint. eg: phone-number + ChannelEndpointType *string `json:"ChannelEndpointType,omitempty"` + // The SID of an channel endpoint + ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` } -func (params *CreateTrustProductChannelEndpointAssignmentParams) SetChannelEndpointType(ChannelEndpointType string) *CreateTrustProductChannelEndpointAssignmentParams { - params.ChannelEndpointType = &ChannelEndpointType - return params +func (params *CreateTrustProductChannelEndpointAssignmentParams) SetChannelEndpointType(ChannelEndpointType string) (*CreateTrustProductChannelEndpointAssignmentParams){ + params.ChannelEndpointType = &ChannelEndpointType + return params } -func (params *CreateTrustProductChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) *CreateTrustProductChannelEndpointAssignmentParams { - params.ChannelEndpointSid = &ChannelEndpointSid - return params +func (params *CreateTrustProductChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) (*CreateTrustProductChannelEndpointAssignmentParams){ + params.ChannelEndpointSid = &ChannelEndpointSid + return params } // Create a new Assigned Item. func (c *ApiService) CreateTrustProductChannelEndpointAssignment(TrustProductSid string, params *CreateTrustProductChannelEndpointAssignmentParams) (*TrusthubV1TrustProductChannelEndpointAssignment, error) { - path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ChannelEndpointType != nil { - data.Set("ChannelEndpointType", *params.ChannelEndpointType) - } - if params != nil && params.ChannelEndpointSid != nil { - data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) - } + if params != nil && params.ChannelEndpointType != nil { + data.Set("ChannelEndpointType", *params.ChannelEndpointType) + } + if params != nil && params.ChannelEndpointSid != nil { + data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1TrustProductChannelEndpointAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrusthubV1TrustProductChannelEndpointAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an Assignment Item Instance. -func (c *ApiService) DeleteTrustProductChannelEndpointAssignment(TrustProductSid string, Sid string) error { - path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments/{Sid}" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteTrustProductChannelEndpointAssignment(TrustProductSid string, Sid string, ) (error) { + path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments/{Sid}" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch specific Assigned Item Instance. -func (c *ApiService) FetchTrustProductChannelEndpointAssignment(TrustProductSid string, Sid string) (*TrusthubV1TrustProductChannelEndpointAssignment, error) { - path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments/{Sid}" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchTrustProductChannelEndpointAssignment(TrustProductSid string, Sid string, ) (*TrusthubV1TrustProductChannelEndpointAssignment, error) { + path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments/{Sid}" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1TrustProductChannelEndpointAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &TrusthubV1TrustProductChannelEndpointAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTrustProductChannelEndpointAssignment' type ListTrustProductChannelEndpointAssignmentParams struct { - // The SID of an channel endpoint - ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` - // comma separated list of channel endpoint sids - ChannelEndpointSids *string `json:"ChannelEndpointSids,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The SID of an channel endpoint + ChannelEndpointSid *string `json:"ChannelEndpointSid,omitempty"` + // comma separated list of channel endpoint sids + ChannelEndpointSids *string `json:"ChannelEndpointSids,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTrustProductChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) *ListTrustProductChannelEndpointAssignmentParams { - params.ChannelEndpointSid = &ChannelEndpointSid - return params +func (params *ListTrustProductChannelEndpointAssignmentParams) SetChannelEndpointSid(ChannelEndpointSid string) (*ListTrustProductChannelEndpointAssignmentParams){ + params.ChannelEndpointSid = &ChannelEndpointSid + return params } -func (params *ListTrustProductChannelEndpointAssignmentParams) SetChannelEndpointSids(ChannelEndpointSids string) *ListTrustProductChannelEndpointAssignmentParams { - params.ChannelEndpointSids = &ChannelEndpointSids - return params +func (params *ListTrustProductChannelEndpointAssignmentParams) SetChannelEndpointSids(ChannelEndpointSids string) (*ListTrustProductChannelEndpointAssignmentParams){ + params.ChannelEndpointSids = &ChannelEndpointSids + return params } -func (params *ListTrustProductChannelEndpointAssignmentParams) SetPageSize(PageSize int) *ListTrustProductChannelEndpointAssignmentParams { - params.PageSize = &PageSize - return params +func (params *ListTrustProductChannelEndpointAssignmentParams) SetPageSize(PageSize int) (*ListTrustProductChannelEndpointAssignmentParams){ + params.PageSize = &PageSize + return params } -func (params *ListTrustProductChannelEndpointAssignmentParams) SetLimit(Limit int) *ListTrustProductChannelEndpointAssignmentParams { - params.Limit = &Limit - return params +func (params *ListTrustProductChannelEndpointAssignmentParams) SetLimit(Limit int) (*ListTrustProductChannelEndpointAssignmentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TrustProductChannelEndpointAssignment records from the API. Request is executed immediately. func (c *ApiService) PageTrustProductChannelEndpointAssignment(TrustProductSid string, params *ListTrustProductChannelEndpointAssignmentParams, pageToken, pageNumber string) (*ListTrustProductChannelEndpointAssignmentResponse, error) { - path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments" - - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.ChannelEndpointSid != nil { - data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) - } - if params != nil && params.ChannelEndpointSids != nil { - data.Set("ChannelEndpointSids", *params.ChannelEndpointSids) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrustProductChannelEndpointAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/TrustProducts/{TrustProductSid}/ChannelEndpointAssignments" + + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.ChannelEndpointSid != nil { + data.Set("ChannelEndpointSid", *params.ChannelEndpointSid) + } + if params != nil && params.ChannelEndpointSids != nil { + data.Set("ChannelEndpointSids", *params.ChannelEndpointSids) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrustProductChannelEndpointAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists TrustProductChannelEndpointAssignment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -221,6 +226,7 @@ func (c *ApiService) StreamTrustProductChannelEndpointAssignment(TrustProductSid return recordChannel, errorChannel } + func (c *ApiService) streamTrustProductChannelEndpointAssignment(response *ListTrustProductChannelEndpointAssignmentResponse, params *ListTrustProductChannelEndpointAssignmentParams, recordChannel chan TrusthubV1TrustProductChannelEndpointAssignment, errorChannel chan error) { curRecord := 1 @@ -252,19 +258,20 @@ func (c *ApiService) streamTrustProductChannelEndpointAssignment(response *ListT } func (c *ApiService) getNextListTrustProductChannelEndpointAssignmentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrustProductChannelEndpointAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrustProductChannelEndpointAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/trust_products_entity_assignments.go b/rest/trusthub/v1/trust_products_entity_assignments.go index cc5bc2b31..c1eb2f391 100644 --- a/rest/trusthub/v1/trust_products_entity_assignments.go +++ b/rest/trusthub/v1/trust_products_entity_assignments.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTrustProductEntityAssignment' type CreateTrustProductEntityAssignmentParams struct { - // The SID of an object bag that holds information of the different items. - ObjectSid *string `json:"ObjectSid,omitempty"` + // The SID of an object bag that holds information of the different items. + ObjectSid *string `json:"ObjectSid,omitempty"` } -func (params *CreateTrustProductEntityAssignmentParams) SetObjectSid(ObjectSid string) *CreateTrustProductEntityAssignmentParams { - params.ObjectSid = &ObjectSid - return params +func (params *CreateTrustProductEntityAssignmentParams) SetObjectSid(ObjectSid string) (*CreateTrustProductEntityAssignmentParams){ + params.ObjectSid = &ObjectSid + return params } // Create a new Assigned Item. func (c *ApiService) CreateTrustProductEntityAssignment(TrustProductSid string, params *CreateTrustProductEntityAssignmentParams) (*TrusthubV1TrustProductEntityAssignment, error) { - path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.ObjectSid != nil { - data.Set("ObjectSid", *params.ObjectSid) - } + if params != nil && params.ObjectSid != nil { + data.Set("ObjectSid", *params.ObjectSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1TrustProductEntityAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &TrusthubV1TrustProductEntityAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove an Assignment Item Instance. -func (c *ApiService) DeleteTrustProductEntityAssignment(TrustProductSid string, Sid string) error { - path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments/{Sid}" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteTrustProductEntityAssignment(TrustProductSid string, Sid string, ) (error) { + path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments/{Sid}" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch specific Assigned Item Instance. -func (c *ApiService) FetchTrustProductEntityAssignment(TrustProductSid string, Sid string) (*TrusthubV1TrustProductEntityAssignment, error) { - path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments/{Sid}" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchTrustProductEntityAssignment(TrustProductSid string, Sid string, ) (*TrusthubV1TrustProductEntityAssignment, error) { + path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments/{Sid}" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1TrustProductEntityAssignment{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &TrusthubV1TrustProductEntityAssignment{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListTrustProductEntityAssignment' type ListTrustProductEntityAssignmentParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTrustProductEntityAssignmentParams) SetPageSize(PageSize int) *ListTrustProductEntityAssignmentParams { - params.PageSize = &PageSize - return params +func (params *ListTrustProductEntityAssignmentParams) SetPageSize(PageSize int) (*ListTrustProductEntityAssignmentParams){ + params.PageSize = &PageSize + return params } -func (params *ListTrustProductEntityAssignmentParams) SetLimit(Limit int) *ListTrustProductEntityAssignmentParams { - params.Limit = &Limit - return params +func (params *ListTrustProductEntityAssignmentParams) SetLimit(Limit int) (*ListTrustProductEntityAssignmentParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TrustProductEntityAssignment records from the API. Request is executed immediately. func (c *ApiService) PageTrustProductEntityAssignment(TrustProductSid string, params *ListTrustProductEntityAssignmentParams, pageToken, pageNumber string) (*ListTrustProductEntityAssignmentResponse, error) { - path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments" + path := "/v1/TrustProducts/{TrustProductSid}/EntityAssignments" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTrustProductEntityAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTrustProductEntityAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists TrustProductEntityAssignment records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamTrustProductEntityAssignment(TrustProductSid string, return recordChannel, errorChannel } + func (c *ApiService) streamTrustProductEntityAssignment(response *ListTrustProductEntityAssignmentResponse, params *ListTrustProductEntityAssignmentParams, recordChannel chan TrusthubV1TrustProductEntityAssignment, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamTrustProductEntityAssignment(response *ListTrustProdu } func (c *ApiService) getNextListTrustProductEntityAssignmentResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrustProductEntityAssignmentResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrustProductEntityAssignmentResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/trusthub/v1/trust_products_evaluations.go b/rest/trusthub/v1/trust_products_evaluations.go index 652c6e9b0..1a189b56f 100644 --- a/rest/trusthub/v1/trust_products_evaluations.go +++ b/rest/trusthub/v1/trust_products_evaluations.go @@ -18,123 +18,126 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateTrustProductEvaluation' type CreateTrustProductEvaluationParams struct { - // The unique string of a policy that is associated to the customer_profile resource. - PolicySid *string `json:"PolicySid,omitempty"` + // The unique string of a policy that is associated to the customer_profile resource. + PolicySid *string `json:"PolicySid,omitempty"` } -func (params *CreateTrustProductEvaluationParams) SetPolicySid(PolicySid string) *CreateTrustProductEvaluationParams { - params.PolicySid = &PolicySid - return params +func (params *CreateTrustProductEvaluationParams) SetPolicySid(PolicySid string) (*CreateTrustProductEvaluationParams){ + params.PolicySid = &PolicySid + return params } // Create a new Evaluation func (c *ApiService) CreateTrustProductEvaluation(TrustProductSid string, params *CreateTrustProductEvaluationParams) (*TrusthubV1TrustProductEvaluation, error) { - path := "/v1/TrustProducts/{TrustProductSid}/Evaluations" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path := "/v1/TrustProducts/{TrustProductSid}/Evaluations" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PolicySid != nil { - data.Set("PolicySid", *params.PolicySid) - } + if params != nil && params.PolicySid != nil { + data.Set("PolicySid", *params.PolicySid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &TrusthubV1TrustProductEvaluation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &TrusthubV1TrustProductEvaluation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch specific Evaluation Instance. -func (c *ApiService) FetchTrustProductEvaluation(TrustProductSid string, Sid string) (*TrusthubV1TrustProductEvaluation, error) { - path := "/v1/TrustProducts/{TrustProductSid}/Evaluations/{Sid}" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchTrustProductEvaluation(TrustProductSid string, Sid string, ) (*TrusthubV1TrustProductEvaluation, error) { + path := "/v1/TrustProducts/{TrustProductSid}/Evaluations/{Sid}" + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &TrusthubV1TrustProductEvaluation{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &TrusthubV1TrustProductEvaluation{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListTrustProductEvaluation' type ListTrustProductEvaluationParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListTrustProductEvaluationParams) SetPageSize(PageSize int) *ListTrustProductEvaluationParams { - params.PageSize = &PageSize - return params +func (params *ListTrustProductEvaluationParams) SetPageSize(PageSize int) (*ListTrustProductEvaluationParams){ + params.PageSize = &PageSize + return params } -func (params *ListTrustProductEvaluationParams) SetLimit(Limit int) *ListTrustProductEvaluationParams { - params.Limit = &Limit - return params +func (params *ListTrustProductEvaluationParams) SetLimit(Limit int) (*ListTrustProductEvaluationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of TrustProductEvaluation records from the API. Request is executed immediately. func (c *ApiService) PageTrustProductEvaluation(TrustProductSid string, params *ListTrustProductEvaluationParams, pageToken, pageNumber string) (*ListTrustProductEvaluationResponse, error) { - path := "/v1/TrustProducts/{TrustProductSid}/Evaluations" + path := "/v1/TrustProducts/{TrustProductSid}/Evaluations" - path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) + path = strings.Replace(path, "{"+"TrustProductSid"+"}", TrustProductSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListTrustProductEvaluationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListTrustProductEvaluationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists TrustProductEvaluation records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -175,6 +178,7 @@ func (c *ApiService) StreamTrustProductEvaluation(TrustProductSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamTrustProductEvaluation(response *ListTrustProductEvaluationResponse, params *ListTrustProductEvaluationParams, recordChannel chan TrusthubV1TrustProductEvaluation, errorChannel chan error) { curRecord := 1 @@ -206,19 +210,20 @@ func (c *ApiService) streamTrustProductEvaluation(response *ListTrustProductEval } func (c *ApiService) getNextListTrustProductEvaluationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListTrustProductEvaluationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListTrustProductEvaluationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/verify/v2/README.md b/rest/verify/v2/README.md index 83ee98111..2c29002ff 100644 --- a/rest/verify/v2/README.md +++ b/rest/verify/v2/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/verify/v2/api_service.go b/rest/verify/v2/api_service.go index fa0c14223..a247ad2ed 100644 --- a/rest/verify/v2/api_service.go +++ b/rest/verify/v2/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://verify.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/verify/v2/attempts.go b/rest/verify/v2/attempts.go index 426ad0dcc..628db45f3 100644 --- a/rest/verify/v2/attempts.go +++ b/rest/verify/v2/attempts.go @@ -18,155 +18,157 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Fetch a specific verification attempt. -func (c *ApiService) FetchVerificationAttempt(Sid string) (*VerifyV2VerificationAttempt, error) { - path := "/v2/Attempts/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchVerificationAttempt(Sid string, ) (*VerifyV2VerificationAttempt, error) { + path := "/v2/Attempts/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2VerificationAttempt{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &VerifyV2VerificationAttempt{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListVerificationAttempt' type ListVerificationAttemptParams struct { - // Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // Destination of a verification. It is phone number in E.164 format. - ChannelDataTo *string `json:"ChannelData.To,omitempty"` - // Filter used to query Verification Attempts sent to the specified destination country. - Country *string `json:"Country,omitempty"` - // Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` - Channel *string `json:"Channel,omitempty"` - // Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. - VerifyServiceSid *string `json:"VerifyServiceSid,omitempty"` - // Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. - VerificationSid *string `json:"VerificationSid,omitempty"` - // Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. - Status *string `json:"Status,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // Destination of a verification. It is phone number in E.164 format. + ChannelDataTo *string `json:"ChannelData.To,omitempty"` + // Filter used to query Verification Attempts sent to the specified destination country. + Country *string `json:"Country,omitempty"` + // Filter used to query Verification Attempts by communication channel. Valid values are `SMS` and `CALL` + Channel *string `json:"Channel,omitempty"` + // Filter used to query Verification Attempts by verify service. Only attempts of the provided SID will be returned. + VerifyServiceSid *string `json:"VerifyServiceSid,omitempty"` + // Filter used to return all the Verification Attempts of a single verification. Only attempts of the provided verification SID will be returned. + VerificationSid *string `json:"VerificationSid,omitempty"` + // Filter used to query Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for attempts that were not converted, and `CONVERTED`, for attempts that were confirmed. + Status *string `json:"Status,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVerificationAttemptParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListVerificationAttemptParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListVerificationAttemptParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListVerificationAttemptParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListVerificationAttemptParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListVerificationAttemptParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListVerificationAttemptParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListVerificationAttemptParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListVerificationAttemptParams) SetChannelDataTo(ChannelDataTo string) *ListVerificationAttemptParams { - params.ChannelDataTo = &ChannelDataTo - return params +func (params *ListVerificationAttemptParams) SetChannelDataTo(ChannelDataTo string) (*ListVerificationAttemptParams){ + params.ChannelDataTo = &ChannelDataTo + return params } -func (params *ListVerificationAttemptParams) SetCountry(Country string) *ListVerificationAttemptParams { - params.Country = &Country - return params +func (params *ListVerificationAttemptParams) SetCountry(Country string) (*ListVerificationAttemptParams){ + params.Country = &Country + return params } -func (params *ListVerificationAttemptParams) SetChannel(Channel string) *ListVerificationAttemptParams { - params.Channel = &Channel - return params +func (params *ListVerificationAttemptParams) SetChannel(Channel string) (*ListVerificationAttemptParams){ + params.Channel = &Channel + return params } -func (params *ListVerificationAttemptParams) SetVerifyServiceSid(VerifyServiceSid string) *ListVerificationAttemptParams { - params.VerifyServiceSid = &VerifyServiceSid - return params +func (params *ListVerificationAttemptParams) SetVerifyServiceSid(VerifyServiceSid string) (*ListVerificationAttemptParams){ + params.VerifyServiceSid = &VerifyServiceSid + return params } -func (params *ListVerificationAttemptParams) SetVerificationSid(VerificationSid string) *ListVerificationAttemptParams { - params.VerificationSid = &VerificationSid - return params +func (params *ListVerificationAttemptParams) SetVerificationSid(VerificationSid string) (*ListVerificationAttemptParams){ + params.VerificationSid = &VerificationSid + return params } -func (params *ListVerificationAttemptParams) SetStatus(Status string) *ListVerificationAttemptParams { - params.Status = &Status - return params +func (params *ListVerificationAttemptParams) SetStatus(Status string) (*ListVerificationAttemptParams){ + params.Status = &Status + return params } -func (params *ListVerificationAttemptParams) SetPageSize(PageSize int) *ListVerificationAttemptParams { - params.PageSize = &PageSize - return params +func (params *ListVerificationAttemptParams) SetPageSize(PageSize int) (*ListVerificationAttemptParams){ + params.PageSize = &PageSize + return params } -func (params *ListVerificationAttemptParams) SetLimit(Limit int) *ListVerificationAttemptParams { - params.Limit = &Limit - return params +func (params *ListVerificationAttemptParams) SetLimit(Limit int) (*ListVerificationAttemptParams){ + params.Limit = &Limit + return params } // Retrieve a single page of VerificationAttempt records from the API. Request is executed immediately. func (c *ApiService) PageVerificationAttempt(params *ListVerificationAttemptParams, pageToken, pageNumber string) (*ListVerificationAttemptResponse, error) { - path := "/v2/Attempts" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.ChannelDataTo != nil { - data.Set("ChannelData.To", *params.ChannelDataTo) - } - if params != nil && params.Country != nil { - data.Set("Country", *params.Country) - } - if params != nil && params.Channel != nil { - data.Set("Channel", *params.Channel) - } - if params != nil && params.VerifyServiceSid != nil { - data.Set("VerifyServiceSid", *params.VerifyServiceSid) - } - if params != nil && params.VerificationSid != nil { - data.Set("VerificationSid", *params.VerificationSid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVerificationAttemptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Attempts" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.ChannelDataTo != nil { + data.Set("ChannelData.To", *params.ChannelDataTo) + } + if params != nil && params.Country != nil { + data.Set("Country", *params.Country) + } + if params != nil && params.Channel != nil { + data.Set("Channel", *params.Channel) + } + if params != nil && params.VerifyServiceSid != nil { + data.Set("VerifyServiceSid", *params.VerifyServiceSid) + } + if params != nil && params.VerificationSid != nil { + data.Set("VerificationSid", *params.VerificationSid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVerificationAttemptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists VerificationAttempt records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +209,7 @@ func (c *ApiService) StreamVerificationAttempt(params *ListVerificationAttemptPa return recordChannel, errorChannel } + func (c *ApiService) streamVerificationAttempt(response *ListVerificationAttemptResponse, params *ListVerificationAttemptParams, recordChannel chan VerifyV2VerificationAttempt, errorChannel chan error) { curRecord := 1 @@ -238,19 +241,20 @@ func (c *ApiService) streamVerificationAttempt(response *ListVerificationAttempt } func (c *ApiService) getNextListVerificationAttemptResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVerificationAttemptResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVerificationAttemptResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/verify/v2/attempts_summary.go b/rest/verify/v2/attempts_summary.go index 6bb28cb9d..f40ab85ab 100644 --- a/rest/verify/v2/attempts_summary.go +++ b/rest/verify/v2/attempts_summary.go @@ -18,87 +18,90 @@ import ( "encoding/json" "fmt" "net/url" - "time" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'FetchVerificationAttemptsSummary' type FetchVerificationAttemptsSummaryParams struct { - // Filter used to consider only Verification Attempts of the given verify service on the summary aggregation. - VerifyServiceSid *string `json:"VerifyServiceSid,omitempty"` - // Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. - Country *string `json:"Country,omitempty"` - // Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` - Channel *string `json:"Channel,omitempty"` - // Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. - DestinationPrefix *string `json:"DestinationPrefix,omitempty"` + // Filter used to consider only Verification Attempts of the given verify service on the summary aggregation. + VerifyServiceSid *string `json:"VerifyServiceSid,omitempty"` + // Datetime filter used to consider only Verification Attempts created after this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Datetime filter used to consider only Verification Attempts created before this datetime on the summary aggregation. Given as GMT in ISO 8601 formatted datetime string: yyyy-MM-dd'T'HH:mm:ss'Z. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // Filter used to consider only Verification Attempts sent to the specified destination country on the summary aggregation. + Country *string `json:"Country,omitempty"` + // Filter Verification Attempts considered on the summary aggregation by communication channel. Valid values are `SMS`, `CALL` and `WHATSAPP` + Channel *string `json:"Channel,omitempty"` + // Filter the Verification Attempts considered on the summary aggregation by Destination prefix. It is the prefix of a phone number in E.164 format. + DestinationPrefix *string `json:"DestinationPrefix,omitempty"` } -func (params *FetchVerificationAttemptsSummaryParams) SetVerifyServiceSid(VerifyServiceSid string) *FetchVerificationAttemptsSummaryParams { - params.VerifyServiceSid = &VerifyServiceSid - return params +func (params *FetchVerificationAttemptsSummaryParams) SetVerifyServiceSid(VerifyServiceSid string) (*FetchVerificationAttemptsSummaryParams){ + params.VerifyServiceSid = &VerifyServiceSid + return params } -func (params *FetchVerificationAttemptsSummaryParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *FetchVerificationAttemptsSummaryParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *FetchVerificationAttemptsSummaryParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*FetchVerificationAttemptsSummaryParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *FetchVerificationAttemptsSummaryParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *FetchVerificationAttemptsSummaryParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *FetchVerificationAttemptsSummaryParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*FetchVerificationAttemptsSummaryParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *FetchVerificationAttemptsSummaryParams) SetCountry(Country string) *FetchVerificationAttemptsSummaryParams { - params.Country = &Country - return params +func (params *FetchVerificationAttemptsSummaryParams) SetCountry(Country string) (*FetchVerificationAttemptsSummaryParams){ + params.Country = &Country + return params } -func (params *FetchVerificationAttemptsSummaryParams) SetChannel(Channel string) *FetchVerificationAttemptsSummaryParams { - params.Channel = &Channel - return params +func (params *FetchVerificationAttemptsSummaryParams) SetChannel(Channel string) (*FetchVerificationAttemptsSummaryParams){ + params.Channel = &Channel + return params } -func (params *FetchVerificationAttemptsSummaryParams) SetDestinationPrefix(DestinationPrefix string) *FetchVerificationAttemptsSummaryParams { - params.DestinationPrefix = &DestinationPrefix - return params +func (params *FetchVerificationAttemptsSummaryParams) SetDestinationPrefix(DestinationPrefix string) (*FetchVerificationAttemptsSummaryParams){ + params.DestinationPrefix = &DestinationPrefix + return params } // Get a summary of how many attempts were made and how many were converted. func (c *ApiService) FetchVerificationAttemptsSummary(params *FetchVerificationAttemptsSummaryParams) (*VerifyV2VerificationAttemptsSummary, error) { - path := "/v2/Attempts/Summary" + path := "/v2/Attempts/Summary" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.VerifyServiceSid != nil { + data.Set("VerifyServiceSid", *params.VerifyServiceSid) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.Country != nil { + data.Set("Country", *params.Country) + } + if params != nil && params.Channel != nil { + data.Set("Channel", *params.Channel) + } + if params != nil && params.DestinationPrefix != nil { + data.Set("DestinationPrefix", *params.DestinationPrefix) + } - if params != nil && params.VerifyServiceSid != nil { - data.Set("VerifyServiceSid", *params.VerifyServiceSid) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.Country != nil { - data.Set("Country", *params.Country) - } - if params != nil && params.Channel != nil { - data.Set("Channel", *params.Channel) - } - if params != nil && params.DestinationPrefix != nil { - data.Set("DestinationPrefix", *params.DestinationPrefix) - } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2VerificationAttemptsSummary{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2VerificationAttemptsSummary{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/docs/ListBucketResponseMeta.md b/rest/verify/v2/docs/ListBucketResponseMeta.md index 43e65a61c..648b2b04e 100644 --- a/rest/verify/v2/docs/ListBucketResponseMeta.md +++ b/rest/verify/v2/docs/ListBucketResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/verify/v2/forms.go b/rest/verify/v2/forms.go index 16db4c563..d6f457b82 100644 --- a/rest/verify/v2/forms.go +++ b/rest/verify/v2/forms.go @@ -16,29 +16,34 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Fetch the forms for a specific Form Type. -func (c *ApiService) FetchForm(FormType string) (*VerifyV2Form, error) { - path := "/v2/Forms/{FormType}" - path = strings.Replace(path, "{"+"FormType"+"}", FormType, -1) +func (c *ApiService) FetchForm(FormType string, ) (*VerifyV2Form, error) { + path := "/v2/Forms/{FormType}" + path = strings.Replace(path, "{"+"FormType"+"}", FormType, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2Form{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2Form{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/model_list_bucket_response.go b/rest/verify/v2/model_list_bucket_response.go index 5447b91e6..729b068bf 100644 --- a/rest/verify/v2/model_list_bucket_response.go +++ b/rest/verify/v2/model_list_bucket_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBucketResponse struct for ListBucketResponse type ListBucketResponse struct { - Buckets []VerifyV2Bucket `json:"buckets,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Buckets []VerifyV2Bucket `json:"buckets,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_bucket_response_meta.go b/rest/verify/v2/model_list_bucket_response_meta.go index 749697319..894a00d75 100644 --- a/rest/verify/v2/model_list_bucket_response_meta.go +++ b/rest/verify/v2/model_list_bucket_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListBucketResponseMeta struct for ListBucketResponseMeta type ListBucketResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_list_challenge_response.go b/rest/verify/v2/model_list_challenge_response.go index b6d4e2d46..60f8754ee 100644 --- a/rest/verify/v2/model_list_challenge_response.go +++ b/rest/verify/v2/model_list_challenge_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListChallengeResponse struct for ListChallengeResponse type ListChallengeResponse struct { - Challenges []VerifyV2Challenge `json:"challenges,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Challenges []VerifyV2Challenge `json:"challenges,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_entity_response.go b/rest/verify/v2/model_list_entity_response.go index b03465df8..d426f2888 100644 --- a/rest/verify/v2/model_list_entity_response.go +++ b/rest/verify/v2/model_list_entity_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListEntityResponse struct for ListEntityResponse type ListEntityResponse struct { - Entities []VerifyV2Entity `json:"entities,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Entities []VerifyV2Entity `json:"entities,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_factor_response.go b/rest/verify/v2/model_list_factor_response.go index 68ad82f8e..64007c9a3 100644 --- a/rest/verify/v2/model_list_factor_response.go +++ b/rest/verify/v2/model_list_factor_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListFactorResponse struct for ListFactorResponse type ListFactorResponse struct { - Factors []VerifyV2Factor `json:"factors,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Factors []VerifyV2Factor `json:"factors,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_messaging_configuration_response.go b/rest/verify/v2/model_list_messaging_configuration_response.go index a24b08cf8..022645f91 100644 --- a/rest/verify/v2/model_list_messaging_configuration_response.go +++ b/rest/verify/v2/model_list_messaging_configuration_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListMessagingConfigurationResponse struct for ListMessagingConfigurationResponse type ListMessagingConfigurationResponse struct { MessagingConfigurations []VerifyV2MessagingConfiguration `json:"messaging_configurations,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_rate_limit_response.go b/rest/verify/v2/model_list_rate_limit_response.go index 246a2a8dc..b6d1bc178 100644 --- a/rest/verify/v2/model_list_rate_limit_response.go +++ b/rest/verify/v2/model_list_rate_limit_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRateLimitResponse struct for ListRateLimitResponse type ListRateLimitResponse struct { - RateLimits []VerifyV2RateLimit `json:"rate_limits,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + RateLimits []VerifyV2RateLimit `json:"rate_limits,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_service_response.go b/rest/verify/v2/model_list_service_response.go index 55c0c5387..e8088de76 100644 --- a/rest/verify/v2/model_list_service_response.go +++ b/rest/verify/v2/model_list_service_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListServiceResponse struct for ListServiceResponse type ListServiceResponse struct { - Services []VerifyV2Service `json:"services,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Services []VerifyV2Service `json:"services,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_verification_attempt_response.go b/rest/verify/v2/model_list_verification_attempt_response.go index 422e89bb0..b18879b28 100644 --- a/rest/verify/v2/model_list_verification_attempt_response.go +++ b/rest/verify/v2/model_list_verification_attempt_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVerificationAttemptResponse struct for ListVerificationAttemptResponse type ListVerificationAttemptResponse struct { Attempts []VerifyV2VerificationAttempt `json:"attempts,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_verification_template_response.go b/rest/verify/v2/model_list_verification_template_response.go index 0ee7ad135..8c1b707c7 100644 --- a/rest/verify/v2/model_list_verification_template_response.go +++ b/rest/verify/v2/model_list_verification_template_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListVerificationTemplateResponse struct for ListVerificationTemplateResponse type ListVerificationTemplateResponse struct { Templates []VerifyV2VerificationTemplate `json:"templates,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_list_webhook_response.go b/rest/verify/v2/model_list_webhook_response.go index 15f04c347..be62522dd 100644 --- a/rest/verify/v2/model_list_webhook_response.go +++ b/rest/verify/v2/model_list_webhook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListWebhookResponse struct for ListWebhookResponse type ListWebhookResponse struct { - Webhooks []VerifyV2Webhook `json:"webhooks,omitempty"` - Meta ListBucketResponseMeta `json:"meta,omitempty"` + Webhooks []VerifyV2Webhook `json:"webhooks,omitempty"` + Meta ListBucketResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_access_token.go b/rest/verify/v2/model_verify_v2_access_token.go index b45a6a981..1cd619ef9 100644 --- a/rest/verify/v2/model_verify_v2_access_token.go +++ b/rest/verify/v2/model_verify_v2_access_token.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2AccessToken struct for VerifyV2AccessToken type VerifyV2AccessToken struct { - // A 34 character string that uniquely identifies this Access Token. + // A 34 character string that uniquely identifies this Access Token. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Verify Service. + // The unique SID identifier of the Verify Service. ServiceSid *string `json:"service_sid,omitempty"` - // The unique external identifier for the Entity of the Service. + // The unique external identifier for the Entity of the Service. EntityIdentity *string `json:"entity_identity,omitempty"` - FactorType *string `json:"factor_type,omitempty"` - // A human readable description of this factor, up to 64 characters. For a push factor, this can be the device's name. + FactorType *string `json:"factor_type,omitempty"` + // A human readable description of this factor, up to 64 characters. For a push factor, this can be the device's name. FactorFriendlyName *string `json:"factor_friendly_name,omitempty"` - // The access token generated for enrollment, this is an encrypted json web token. + // The access token generated for enrollment, this is an encrypted json web token. Token *string `json:"token,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // How long, in seconds, the access token is valid. Max: 5 minutes + // How long, in seconds, the access token is valid. Max: 5 minutes Ttl *int `json:"ttl,omitempty"` - // The date that this access token was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this access token was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_bucket.go b/rest/verify/v2/model_verify_v2_bucket.go index b4d83a067..8ce3229b9 100644 --- a/rest/verify/v2/model_verify_v2_bucket.go +++ b/rest/verify/v2/model_verify_v2_bucket.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Bucket struct for VerifyV2Bucket type VerifyV2Bucket struct { - // A 34 character string that uniquely identifies this Bucket. + // A 34 character string that uniquely identifies this Bucket. Sid *string `json:"sid,omitempty"` - // The Twilio-provided string that uniquely identifies the Rate Limit resource. + // The Twilio-provided string that uniquely identifies the Rate Limit resource. RateLimitSid *string `json:"rate_limit_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. AccountSid *string `json:"account_sid,omitempty"` - // Maximum number of requests permitted in during the interval. + // Maximum number of requests permitted in during the interval. Max *int `json:"max,omitempty"` - // Number of seconds that the rate limit will be enforced over. + // Number of seconds that the rate limit will be enforced over. Interval *int `json:"interval,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_challenge.go b/rest/verify/v2/model_verify_v2_challenge.go index 1f5794467..6b423f13c 100644 --- a/rest/verify/v2/model_verify_v2_challenge.go +++ b/rest/verify/v2/model_verify_v2_challenge.go @@ -13,44 +13,46 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Challenge struct for VerifyV2Challenge type VerifyV2Challenge struct { - // A 34 character string that uniquely identifies this Challenge. + // A 34 character string that uniquely identifies this Challenge. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The unique SID identifier of the Entity. + // The unique SID identifier of the Entity. EntitySid *string `json:"entity_sid,omitempty"` - // Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + // Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. Identity *string `json:"identity,omitempty"` - // The unique SID identifier of the Factor. + // The unique SID identifier of the Factor. FactorSid *string `json:"factor_sid,omitempty"` - // The date that this Challenge was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Challenge was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Challenge was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Challenge was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The date that this Challenge was responded, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Challenge was responded, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateResponded *time.Time `json:"date_responded,omitempty"` - // The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. - ExpirationDate *time.Time `json:"expiration_date,omitempty"` - Status *string `json:"status,omitempty"` - RespondedReason *string `json:"responded_reason,omitempty"` - // Details provided to give context about the Challenge. Intended to be shown to the end user. + // The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. + ExpirationDate *time.Time `json:"expiration_date,omitempty"` + Status *string `json:"status,omitempty"` + RespondedReason *string `json:"responded_reason,omitempty"` + // Details provided to give context about the Challenge. Intended to be shown to the end user. Details *interface{} `json:"details,omitempty"` - // Details provided to give context about the Challenge. Intended to be hidden from the end user. It must be a stringified JSON with only strings values eg. `{\"ip\": \"172.168.1.234\"}` + // Details provided to give context about the Challenge. Intended to be hidden from the end user. It must be a stringified JSON with only strings values eg. `{\"ip\": \"172.168.1.234\"}` HiddenDetails *interface{} `json:"hidden_details,omitempty"` - // Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. - Metadata *interface{} `json:"metadata,omitempty"` - FactorType *string `json:"factor_type,omitempty"` - // The URL of this resource. + // Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. + Metadata *interface{} `json:"metadata,omitempty"` + FactorType *string `json:"factor_type,omitempty"` + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this Challenge. + // Contains a dictionary of URL links to nested resources of this Challenge. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_entity.go b/rest/verify/v2/model_verify_v2_entity.go index 7a72fddd2..c01fc1056 100644 --- a/rest/verify/v2/model_verify_v2_entity.go +++ b/rest/verify/v2/model_verify_v2_entity.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Entity struct for VerifyV2Entity type VerifyV2Entity struct { - // A 34 character string that uniquely identifies this Entity. + // A 34 character string that uniquely identifies this Entity. Sid *string `json:"sid,omitempty"` - // The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + // The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. Identity *string `json:"identity,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The date that this Entity was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Entity was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Entity was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Entity was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // Contains a dictionary of URL links to nested resources of this Entity. + // Contains a dictionary of URL links to nested resources of this Entity. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_factor.go b/rest/verify/v2/model_verify_v2_factor.go index cb9cf5bf5..2c8dd908d 100644 --- a/rest/verify/v2/model_verify_v2_factor.go +++ b/rest/verify/v2/model_verify_v2_factor.go @@ -13,35 +13,37 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Factor struct for VerifyV2Factor type VerifyV2Factor struct { - // A 34 character string that uniquely identifies this Factor. + // A 34 character string that uniquely identifies this Factor. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The unique SID identifier of the Entity. + // The unique SID identifier of the Entity. EntitySid *string `json:"entity_sid,omitempty"` - // Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + // Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. Identity *string `json:"identity,omitempty"` - // The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // A human readable description of this resource, up to 64 characters. For a push factor, this can be the device's name. + // A human readable description of this resource, up to 64 characters. For a push factor, this can be the device's name. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - FactorType *string `json:"factor_type,omitempty"` - // An object that contains configurations specific to a `factor_type`. + Status *string `json:"status,omitempty"` + FactorType *string `json:"factor_type,omitempty"` + // An object that contains configurations specific to a `factor_type`. Config *interface{} `json:"config,omitempty"` - // Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. + // Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. Metadata *interface{} `json:"metadata,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_form.go b/rest/verify/v2/model_verify_v2_form.go index 9e2a85b6a..bd677b45b 100644 --- a/rest/verify/v2/model_verify_v2_form.go +++ b/rest/verify/v2/model_verify_v2_form.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VerifyV2Form struct for VerifyV2Form type VerifyV2Form struct { FormType *string `json:"form_type,omitempty"` - // Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](https://json-schema.org/) format + // Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](https://json-schema.org/) format Forms *interface{} `json:"forms,omitempty"` - // Additional information for the available forms for this type. E.g. The separator string used for `binding` in a Factor push. + // Additional information for the available forms for this type. E.g. The separator string used for `binding` in a Factor push. FormMeta *interface{} `json:"form_meta,omitempty"` - // The URL to access the forms for this type. + // The URL to access the forms for this type. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_messaging_configuration.go b/rest/verify/v2/model_verify_v2_messaging_configuration.go index ecb013649..f4acd7fb8 100644 --- a/rest/verify/v2/model_verify_v2_messaging_configuration.go +++ b/rest/verify/v2/model_verify_v2_messaging_configuration.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2MessagingConfiguration struct for VerifyV2MessagingConfiguration type VerifyV2MessagingConfiguration struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) that the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) that the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. + // The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. Country *string `json:"country,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_new_factor.go b/rest/verify/v2/model_verify_v2_new_factor.go index cc3239d9f..62a7a31b5 100644 --- a/rest/verify/v2/model_verify_v2_new_factor.go +++ b/rest/verify/v2/model_verify_v2_new_factor.go @@ -13,37 +13,39 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2NewFactor struct for VerifyV2NewFactor type VerifyV2NewFactor struct { - // A 34 character string that uniquely identifies this Factor. + // A 34 character string that uniquely identifies this Factor. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The unique SID identifier of the Entity. + // The unique SID identifier of the Entity. EntitySid *string `json:"entity_sid,omitempty"` - // Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + // Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. Identity *string `json:"identity,omitempty"` - // Contains the `factor_type` specific secret and metadata. For push, this is `binding.public_key` and `binding.alg`. For totp, this is `binding.secret` and `binding.uri`. The `binding.uri` property is generated following the [google authenticator key URI format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format), and `Factor.friendly_name` is used for the “accountname” value and `Service.friendly_name` or `Service.totp.issuer` is used for the `issuer` value. The Binding property is ONLY returned upon Factor creation. + // Contains the `factor_type` specific secret and metadata. For push, this is `binding.public_key` and `binding.alg`. For totp, this is `binding.secret` and `binding.uri`. The `binding.uri` property is generated following the [google authenticator key URI format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format), and `Factor.friendly_name` is used for the “accountname” value and `Service.friendly_name` or `Service.totp.issuer` is used for the `issuer` value. The Binding property is ONLY returned upon Factor creation. Binding *interface{} `json:"binding,omitempty"` - // The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. + // The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. FriendlyName *string `json:"friendly_name,omitempty"` - Status *string `json:"status,omitempty"` - FactorType *string `json:"factor_type,omitempty"` - // An object that contains configurations specific to a `factor_type`. + Status *string `json:"status,omitempty"` + FactorType *string `json:"factor_type,omitempty"` + // An object that contains configurations specific to a `factor_type`. Config *interface{} `json:"config,omitempty"` - // Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. + // Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. Metadata *interface{} `json:"metadata,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_notification.go b/rest/verify/v2/model_verify_v2_notification.go index 51cfe6306..e4efce34c 100644 --- a/rest/verify/v2/model_verify_v2_notification.go +++ b/rest/verify/v2/model_verify_v2_notification.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Notification struct for VerifyV2Notification type VerifyV2Notification struct { - // A 34 character string that uniquely identifies this Notification. + // A 34 character string that uniquely identifies this Notification. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The unique SID identifier of the Entity. + // The unique SID identifier of the Entity. EntitySid *string `json:"entity_sid,omitempty"` - // Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + // Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. Identity *string `json:"identity,omitempty"` - // The unique SID identifier of the Challenge. + // The unique SID identifier of the Challenge. ChallengeSid *string `json:"challenge_sid,omitempty"` - // The priority of the notification. For `push` Challenges it's always `high` which sends the notification immediately, and can wake up a sleeping device. + // The priority of the notification. For `push` Challenges it's always `high` which sends the notification immediately, and can wake up a sleeping device. Priority *string `json:"priority,omitempty"` - // How long, in seconds, the notification is valid. Max: 5 minutes + // How long, in seconds, the notification is valid. Max: 5 minutes Ttl *int `json:"ttl,omitempty"` - // The date that this Notification was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Notification was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_rate_limit.go b/rest/verify/v2/model_verify_v2_rate_limit.go index 4008ffb9c..30976db3b 100644 --- a/rest/verify/v2/model_verify_v2_rate_limit.go +++ b/rest/verify/v2/model_verify_v2_rate_limit.go @@ -13,29 +13,31 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2RateLimit struct for VerifyV2RateLimit type VerifyV2RateLimit struct { - // A 34 character string that uniquely identifies this Rate Limit. + // A 34 character string that uniquely identifies this Rate Limit. Sid *string `json:"sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. AccountSid *string `json:"account_sid,omitempty"` - // Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** + // Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** UniqueName *string `json:"unique_name,omitempty"` - // Description of this Rate Limit + // Description of this Rate Limit Description *string `json:"description,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The URL of this resource. + // The URL of this resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_safelist.go b/rest/verify/v2/model_verify_v2_safelist.go index a3d2d7d9f..fc398b105 100644 --- a/rest/verify/v2/model_verify_v2_safelist.go +++ b/rest/verify/v2/model_verify_v2_safelist.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VerifyV2Safelist struct for VerifyV2Safelist type VerifyV2Safelist struct { - // The unique string that we created to identify the SafeList resource. + // The unique string that we created to identify the SafeList resource. Sid *string `json:"sid,omitempty"` - // The phone number in SafeList. + // The phone number in SafeList. PhoneNumber *string `json:"phone_number,omitempty"` - // The absolute URL of the SafeList resource. + // The absolute URL of the SafeList resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_service.go b/rest/verify/v2/model_verify_v2_service.go index 1a9fabfe2..b2eeb6394 100644 --- a/rest/verify/v2/model_verify_v2_service.go +++ b/rest/verify/v2/model_verify_v2_service.go @@ -13,46 +13,48 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Service struct for VerifyV2Service type VerifyV2Service struct { - // The unique string that we created to identify the Service resource. + // The unique string that we created to identify the Service resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** + // The string that you assigned to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** FriendlyName *string `json:"friendly_name,omitempty"` - // The length of the verification code to generate. + // The length of the verification code to generate. CodeLength *int `json:"code_length,omitempty"` - // Whether to perform a lookup with each verification started and return info about the phone number. + // Whether to perform a lookup with each verification started and return info about the phone number. LookupEnabled *bool `json:"lookup_enabled,omitempty"` - // Whether to pass PSD2 transaction parameters when starting a verification. + // Whether to pass PSD2 transaction parameters when starting a verification. Psd2Enabled *bool `json:"psd2_enabled,omitempty"` - // Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. + // Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. SkipSmsToLandlines *bool `json:"skip_sms_to_landlines,omitempty"` - // Whether to ask the user to press a number before delivering the verify code in a phone call. + // Whether to ask the user to press a number before delivering the verify code in a phone call. DtmfInputRequired *bool `json:"dtmf_input_required,omitempty"` - // The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. + // The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. TtsName *string `json:"tts_name,omitempty"` - // Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` + // Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` DoNotShareWarningEnabled *bool `json:"do_not_share_warning_enabled,omitempty"` - // Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + // Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. CustomCodeEnabled *bool `json:"custom_code_enabled,omitempty"` - // Configurations for the Push factors (channel) created under this Service. + // Configurations for the Push factors (channel) created under this Service. Push *interface{} `json:"push,omitempty"` - // Configurations for the TOTP factors (channel) created under this Service. - Totp *interface{} `json:"totp,omitempty"` - DefaultTemplateSid *string `json:"default_template_sid,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // Configurations for the TOTP factors (channel) created under this Service. + Totp *interface{} `json:"totp,omitempty"` + DefaultTemplateSid *string `json:"default_template_sid,omitempty"` + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_verification.go b/rest/verify/v2/model_verify_v2_verification.go index 810a06041..57de49ced 100644 --- a/rest/verify/v2/model_verify_v2_verification.go +++ b/rest/verify/v2/model_verify_v2_verification.go @@ -13,40 +13,42 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Verification struct for VerifyV2Verification type VerifyV2Verification struct { - // The unique string that we created to identify the Verification resource. + // The unique string that we created to identify the Verification resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. AccountSid *string `json:"account_sid,omitempty"` - // The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - To *string `json:"to,omitempty"` + // The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + To *string `json:"to,omitempty"` Channel *string `json:"channel,omitempty"` - // The status of the verification. One of: `pending`, `approved`, or `canceled` + // The status of the verification. One of: `pending`, `approved`, or `canceled` Status *string `json:"status,omitempty"` - // Use \"status\" instead. Legacy property indicating whether the verification was successful. + // Use \"status\" instead. Legacy property indicating whether the verification was successful. Valid *bool `json:"valid,omitempty"` - // Information about the phone number being verified. + // Information about the phone number being verified. Lookup *interface{} `json:"lookup,omitempty"` - // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. Amount *string `json:"amount,omitempty"` - // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. Payee *string `json:"payee,omitempty"` - // An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID. + // An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID. SendCodeAttempts *[]interface{} `json:"send_code_attempts,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The set of fields used for a silent network auth (`sna`) verification. Contains a single field with the URL to be invoked to verify the phone number. + // The set of fields used for a silent network auth (`sna`) verification. Contains a single field with the URL to be invoked to verify the phone number. Sna *interface{} `json:"sna,omitempty"` - // The absolute URL of the Verification resource. + // The absolute URL of the Verification resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_verification_attempt.go b/rest/verify/v2/model_verify_v2_verification_attempt.go index e4570537b..cdf9e1bf5 100644 --- a/rest/verify/v2/model_verify_v2_verification_attempt.go +++ b/rest/verify/v2/model_verify_v2_verification_attempt.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2VerificationAttempt struct for VerifyV2VerificationAttempt type VerifyV2VerificationAttempt struct { - // The SID that uniquely identifies the verification attempt resource. + // The SID that uniquely identifies the verification attempt resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) used to generate the attempt. + // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) used to generate the attempt. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Verification](https://www.twilio.com/docs/verify/api/verification) that generated the attempt. + // The SID of the [Verification](https://www.twilio.com/docs/verify/api/verification) that generated the attempt. VerificationSid *string `json:"verification_sid,omitempty"` - // The date that this Attempt was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date that this Attempt was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date that this Attempt was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - DateUpdated *time.Time `json:"date_updated,omitempty"` - ConversionStatus *string `json:"conversion_status,omitempty"` - Channel *string `json:"channel,omitempty"` - // An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/verify/pricing). + // The date that this Attempt was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + DateUpdated *time.Time `json:"date_updated,omitempty"` + ConversionStatus *string `json:"conversion_status,omitempty"` + Channel *string `json:"channel,omitempty"` + // An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/verify/pricing). Price *interface{} `json:"price,omitempty"` - // An object containing the channel specific information for an attempt. + // An object containing the channel specific information for an attempt. ChannelData *interface{} `json:"channel_data,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_verification_attempts_summary.go b/rest/verify/v2/model_verify_v2_verification_attempts_summary.go index 10f6793d0..ab5aaf9b8 100644 --- a/rest/verify/v2/model_verify_v2_verification_attempts_summary.go +++ b/rest/verify/v2/model_verify_v2_verification_attempts_summary.go @@ -13,33 +13,30 @@ */ package openapi - import ( "encoding/json" - "github.com/twilio/twilio-go/client" ) - // VerifyV2VerificationAttemptsSummary struct for VerifyV2VerificationAttemptsSummary type VerifyV2VerificationAttemptsSummary struct { - // Total of attempts made according to the provided filters + // Total of attempts made according to the provided filters TotalAttempts *int `json:"total_attempts,omitempty"` - // Total of attempts made that were confirmed by the end user, according to the provided filters. + // Total of attempts made that were confirmed by the end user, according to the provided filters. TotalConverted *int `json:"total_converted,omitempty"` - // Total of attempts made that were not confirmed by the end user, according to the provided filters. + // Total of attempts made that were not confirmed by the end user, according to the provided filters. TotalUnconverted *int `json:"total_unconverted,omitempty"` - // Percentage of the confirmed messages over the total, defined by (total_converted/total_attempts)*100. + // Percentage of the confirmed messages over the total, defined by (total_converted/total_attempts)*100. ConversionRatePercentage *float32 `json:"conversion_rate_percentage,omitempty"` - Url *string `json:"url,omitempty"` + Url *string `json:"url,omitempty"` } func (response *VerifyV2VerificationAttemptsSummary) UnmarshalJSON(bytes []byte) (err error) { raw := struct { - TotalAttempts *int `json:"total_attempts"` - TotalConverted *int `json:"total_converted"` - TotalUnconverted *int `json:"total_unconverted"` + TotalAttempts *int `json:"total_attempts"` + TotalConverted *int `json:"total_converted"` + TotalUnconverted *int `json:"total_unconverted"` ConversionRatePercentage *interface{} `json:"conversion_rate_percentage"` - Url *string `json:"url"` + Url *string `json:"url"` }{} if err = json.Unmarshal(bytes, &raw); err != nil { @@ -47,10 +44,10 @@ func (response *VerifyV2VerificationAttemptsSummary) UnmarshalJSON(bytes []byte) } *response = VerifyV2VerificationAttemptsSummary{ - TotalAttempts: raw.TotalAttempts, - TotalConverted: raw.TotalConverted, + TotalAttempts: raw.TotalAttempts, + TotalConverted: raw.TotalConverted, TotalUnconverted: raw.TotalUnconverted, - Url: raw.Url, + Url: raw.Url, } responseConversionRatePercentage, err := client.UnmarshalFloat32(raw.ConversionRatePercentage) @@ -61,3 +58,4 @@ func (response *VerifyV2VerificationAttemptsSummary) UnmarshalJSON(bytes []byte) return } + diff --git a/rest/verify/v2/model_verify_v2_verification_check.go b/rest/verify/v2/model_verify_v2_verification_check.go index b47c6e098..2e2268c6a 100644 --- a/rest/verify/v2/model_verify_v2_verification_check.go +++ b/rest/verify/v2/model_verify_v2_verification_check.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2VerificationCheck struct for VerifyV2VerificationCheck type VerifyV2VerificationCheck struct { - // The unique string that we created to identify the VerificationCheck resource. + // The unique string that we created to identify the VerificationCheck resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + // The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the VerificationCheck resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the VerificationCheck resource. AccountSid *string `json:"account_sid,omitempty"` - // The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - To *string `json:"to,omitempty"` + // The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + To *string `json:"to,omitempty"` Channel *string `json:"channel,omitempty"` - // The status of the verification. Can be: `pending`, `approved`, or `canceled`. + // The status of the verification. Can be: `pending`, `approved`, or `canceled`. Status *string `json:"status,omitempty"` - // Use \"status\" instead. Legacy property indicating whether the verification was successful. + // Use \"status\" instead. Legacy property indicating whether the verification was successful. Valid *bool `json:"valid,omitempty"` - // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. Amount *string `json:"amount,omitempty"` - // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. Payee *string `json:"payee,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was created. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was created. DateCreated *time.Time `json:"date_created,omitempty"` - // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was last updated. + // The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was last updated. DateUpdated *time.Time `json:"date_updated,omitempty"` - // List of error codes as a result of attempting a verification using the `sna` channel. The error codes are chronologically ordered, from the first attempt to the latest attempt. This will be an empty list if no errors occured or `null` if the last channel used wasn't `sna`. + // List of error codes as a result of attempting a verification using the `sna` channel. The error codes are chronologically ordered, from the first attempt to the latest attempt. This will be an empty list if no errors occured or `null` if the last channel used wasn't `sna`. SnaAttemptsErrorCodes *[]interface{} `json:"sna_attempts_error_codes,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_verification_template.go b/rest/verify/v2/model_verify_v2_verification_template.go index 578290c13..ae2e5d964 100644 --- a/rest/verify/v2/model_verify_v2_verification_template.go +++ b/rest/verify/v2/model_verify_v2_verification_template.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VerifyV2VerificationTemplate struct for VerifyV2VerificationTemplate type VerifyV2VerificationTemplate struct { - // A 34 character string that uniquely identifies a Verification Template. + // A 34 character string that uniquely identifies a Verification Template. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Account. + // The unique SID identifier of the Account. AccountSid *string `json:"account_sid,omitempty"` - // A descriptive string that you create to describe a Template. It can be up to 32 characters long. + // A descriptive string that you create to describe a Template. It can be up to 32 characters long. FriendlyName *string `json:"friendly_name,omitempty"` - // A list of channels that support the Template. Can include: sms, voice. + // A list of channels that support the Template. Can include: sms, voice. Channels *[]string `json:"channels,omitempty"` - // An object that contains the different translations of the template. Every translation is identified by the language short name and contains its respective information as the approval status, text and created/modified date. + // An object that contains the different translations of the template. Every translation is identified by the language short name and contains its respective information as the approval status, text and created/modified date. Translations *interface{} `json:"translations,omitempty"` } + + diff --git a/rest/verify/v2/model_verify_v2_webhook.go b/rest/verify/v2/model_verify_v2_webhook.go index f2e3ec3c8..e5734c383 100644 --- a/rest/verify/v2/model_verify_v2_webhook.go +++ b/rest/verify/v2/model_verify_v2_webhook.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VerifyV2Webhook struct for VerifyV2Webhook type VerifyV2Webhook struct { - // The unique string that we created to identify the Webhook resource. + // The unique string that we created to identify the Webhook resource. Sid *string `json:"sid,omitempty"` - // The unique SID identifier of the Service. + // The unique SID identifier of the Service. ServiceSid *string `json:"service_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the webhook. **This value should not contain PII.** + // The string that you assigned to describe the webhook. **This value should not contain PII.** FriendlyName *string `json:"friendly_name,omitempty"` - // The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` + // The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` EventTypes *[]string `json:"event_types,omitempty"` - Status *string `json:"status,omitempty"` - Version *string `json:"version,omitempty"` - // The URL associated with this Webhook. - WebhookUrl *string `json:"webhook_url,omitempty"` + Status *string `json:"status,omitempty"` + Version *string `json:"version,omitempty"` + // The URL associated with this Webhook. + WebhookUrl *string `json:"webhook_url,omitempty"` WebhookMethod *string `json:"webhook_method,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the Webhook resource. + // The absolute URL of the Webhook resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/verify/v2/safe_list_numbers.go b/rest/verify/v2/safe_list_numbers.go index 52594bedf..af1bc5db5 100644 --- a/rest/verify/v2/safe_list_numbers.go +++ b/rest/verify/v2/safe_list_numbers.go @@ -16,84 +16,92 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSafelist' type CreateSafelistParams struct { - // The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - PhoneNumber *string `json:"PhoneNumber,omitempty"` + // The phone number to be added in SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + PhoneNumber *string `json:"PhoneNumber,omitempty"` } -func (params *CreateSafelistParams) SetPhoneNumber(PhoneNumber string) *CreateSafelistParams { - params.PhoneNumber = &PhoneNumber - return params +func (params *CreateSafelistParams) SetPhoneNumber(PhoneNumber string) (*CreateSafelistParams){ + params.PhoneNumber = &PhoneNumber + return params } // Add a new phone number to SafeList. func (c *ApiService) CreateSafelist(params *CreateSafelistParams) (*VerifyV2Safelist, error) { - path := "/v2/SafeList/Numbers" + path := "/v2/SafeList/Numbers" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.PhoneNumber != nil { + data.Set("PhoneNumber", *params.PhoneNumber) + } - if params != nil && params.PhoneNumber != nil { - data.Set("PhoneNumber", *params.PhoneNumber) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2Safelist{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2Safelist{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Remove a phone number from SafeList. -func (c *ApiService) DeleteSafelist(PhoneNumber string) error { - path := "/v2/SafeList/Numbers/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) +func (c *ApiService) DeleteSafelist(PhoneNumber string, ) (error) { + path := "/v2/SafeList/Numbers/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Check if a phone number exists in SafeList. -func (c *ApiService) FetchSafelist(PhoneNumber string) (*VerifyV2Safelist, error) { - path := "/v2/SafeList/Numbers/{PhoneNumber}" - path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) +func (c *ApiService) FetchSafelist(PhoneNumber string, ) (*VerifyV2Safelist, error) { + path := "/v2/SafeList/Numbers/{PhoneNumber}" + path = strings.Replace(path, "{"+"PhoneNumber"+"}", PhoneNumber, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2Safelist{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2Safelist{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services.go b/rest/verify/v2/services.go index 6f16f0ff7..bf5980318 100644 --- a/rest/verify/v2/services.go +++ b/rest/verify/v2/services.go @@ -18,281 +18,287 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateService' type CreateServiceParams struct { - // A descriptive string that you create to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** - FriendlyName *string `json:"FriendlyName,omitempty"` - // The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. - CodeLength *int `json:"CodeLength,omitempty"` - // Whether to perform a lookup with each verification started and return info about the phone number. - LookupEnabled *bool `json:"LookupEnabled,omitempty"` - // Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. - SkipSmsToLandlines *bool `json:"SkipSmsToLandlines,omitempty"` - // Whether to ask the user to press a number before delivering the verify code in a phone call. - DtmfInputRequired *bool `json:"DtmfInputRequired,omitempty"` - // The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. - TtsName *string `json:"TtsName,omitempty"` - // Whether to pass PSD2 transaction parameters when starting a verification. - Psd2Enabled *bool `json:"Psd2Enabled,omitempty"` - // Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` - DoNotShareWarningEnabled *bool `json:"DoNotShareWarningEnabled,omitempty"` - // Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. - CustomCodeEnabled *bool `json:"CustomCodeEnabled,omitempty"` - // Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. - PushIncludeDate *bool `json:"Push.IncludeDate,omitempty"` - // Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) - PushApnCredentialSid *string `json:"Push.ApnCredentialSid,omitempty"` - // Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) - PushFcmCredentialSid *string `json:"Push.FcmCredentialSid,omitempty"` - // Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. Defaults to the service friendly name if not provided. - TotpIssuer *string `json:"Totp.Issuer,omitempty"` - // Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds - TotpTimeStep *int `json:"Totp.TimeStep,omitempty"` - // Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 - TotpCodeLength *int `json:"Totp.CodeLength,omitempty"` - // Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 - TotpSkew *int `json:"Totp.Skew,omitempty"` - // The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. - DefaultTemplateSid *string `json:"DefaultTemplateSid,omitempty"` -} - -func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) *CreateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateServiceParams) SetCodeLength(CodeLength int) *CreateServiceParams { - params.CodeLength = &CodeLength - return params -} -func (params *CreateServiceParams) SetLookupEnabled(LookupEnabled bool) *CreateServiceParams { - params.LookupEnabled = &LookupEnabled - return params -} -func (params *CreateServiceParams) SetSkipSmsToLandlines(SkipSmsToLandlines bool) *CreateServiceParams { - params.SkipSmsToLandlines = &SkipSmsToLandlines - return params -} -func (params *CreateServiceParams) SetDtmfInputRequired(DtmfInputRequired bool) *CreateServiceParams { - params.DtmfInputRequired = &DtmfInputRequired - return params -} -func (params *CreateServiceParams) SetTtsName(TtsName string) *CreateServiceParams { - params.TtsName = &TtsName - return params -} -func (params *CreateServiceParams) SetPsd2Enabled(Psd2Enabled bool) *CreateServiceParams { - params.Psd2Enabled = &Psd2Enabled - return params -} -func (params *CreateServiceParams) SetDoNotShareWarningEnabled(DoNotShareWarningEnabled bool) *CreateServiceParams { - params.DoNotShareWarningEnabled = &DoNotShareWarningEnabled - return params -} -func (params *CreateServiceParams) SetCustomCodeEnabled(CustomCodeEnabled bool) *CreateServiceParams { - params.CustomCodeEnabled = &CustomCodeEnabled - return params -} -func (params *CreateServiceParams) SetPushIncludeDate(PushIncludeDate bool) *CreateServiceParams { - params.PushIncludeDate = &PushIncludeDate - return params -} -func (params *CreateServiceParams) SetPushApnCredentialSid(PushApnCredentialSid string) *CreateServiceParams { - params.PushApnCredentialSid = &PushApnCredentialSid - return params -} -func (params *CreateServiceParams) SetPushFcmCredentialSid(PushFcmCredentialSid string) *CreateServiceParams { - params.PushFcmCredentialSid = &PushFcmCredentialSid - return params -} -func (params *CreateServiceParams) SetTotpIssuer(TotpIssuer string) *CreateServiceParams { - params.TotpIssuer = &TotpIssuer - return params -} -func (params *CreateServiceParams) SetTotpTimeStep(TotpTimeStep int) *CreateServiceParams { - params.TotpTimeStep = &TotpTimeStep - return params -} -func (params *CreateServiceParams) SetTotpCodeLength(TotpCodeLength int) *CreateServiceParams { - params.TotpCodeLength = &TotpCodeLength - return params -} -func (params *CreateServiceParams) SetTotpSkew(TotpSkew int) *CreateServiceParams { - params.TotpSkew = &TotpSkew - return params -} -func (params *CreateServiceParams) SetDefaultTemplateSid(DefaultTemplateSid string) *CreateServiceParams { - params.DefaultTemplateSid = &DefaultTemplateSid - return params + // A descriptive string that you create to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** + FriendlyName *string `json:"FriendlyName,omitempty"` + // The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. + CodeLength *int `json:"CodeLength,omitempty"` + // Whether to perform a lookup with each verification started and return info about the phone number. + LookupEnabled *bool `json:"LookupEnabled,omitempty"` + // Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. + SkipSmsToLandlines *bool `json:"SkipSmsToLandlines,omitempty"` + // Whether to ask the user to press a number before delivering the verify code in a phone call. + DtmfInputRequired *bool `json:"DtmfInputRequired,omitempty"` + // The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. + TtsName *string `json:"TtsName,omitempty"` + // Whether to pass PSD2 transaction parameters when starting a verification. + Psd2Enabled *bool `json:"Psd2Enabled,omitempty"` + // Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` + DoNotShareWarningEnabled *bool `json:"DoNotShareWarningEnabled,omitempty"` + // Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + CustomCodeEnabled *bool `json:"CustomCodeEnabled,omitempty"` + // Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. This timestamp value is the same one as the one found in `date_created`, please use that one instead. + PushIncludeDate *bool `json:"Push.IncludeDate,omitempty"` + // Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) + PushApnCredentialSid *string `json:"Push.ApnCredentialSid,omitempty"` + // Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) + PushFcmCredentialSid *string `json:"Push.FcmCredentialSid,omitempty"` + // Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. Defaults to the service friendly name if not provided. + TotpIssuer *string `json:"Totp.Issuer,omitempty"` + // Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds + TotpTimeStep *int `json:"Totp.TimeStep,omitempty"` + // Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 + TotpCodeLength *int `json:"Totp.CodeLength,omitempty"` + // Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 + TotpSkew *int `json:"Totp.Skew,omitempty"` + // The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + DefaultTemplateSid *string `json:"DefaultTemplateSid,omitempty"` +} + +func (params *CreateServiceParams) SetFriendlyName(FriendlyName string) (*CreateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateServiceParams) SetCodeLength(CodeLength int) (*CreateServiceParams){ + params.CodeLength = &CodeLength + return params +} +func (params *CreateServiceParams) SetLookupEnabled(LookupEnabled bool) (*CreateServiceParams){ + params.LookupEnabled = &LookupEnabled + return params +} +func (params *CreateServiceParams) SetSkipSmsToLandlines(SkipSmsToLandlines bool) (*CreateServiceParams){ + params.SkipSmsToLandlines = &SkipSmsToLandlines + return params +} +func (params *CreateServiceParams) SetDtmfInputRequired(DtmfInputRequired bool) (*CreateServiceParams){ + params.DtmfInputRequired = &DtmfInputRequired + return params +} +func (params *CreateServiceParams) SetTtsName(TtsName string) (*CreateServiceParams){ + params.TtsName = &TtsName + return params +} +func (params *CreateServiceParams) SetPsd2Enabled(Psd2Enabled bool) (*CreateServiceParams){ + params.Psd2Enabled = &Psd2Enabled + return params +} +func (params *CreateServiceParams) SetDoNotShareWarningEnabled(DoNotShareWarningEnabled bool) (*CreateServiceParams){ + params.DoNotShareWarningEnabled = &DoNotShareWarningEnabled + return params +} +func (params *CreateServiceParams) SetCustomCodeEnabled(CustomCodeEnabled bool) (*CreateServiceParams){ + params.CustomCodeEnabled = &CustomCodeEnabled + return params +} +func (params *CreateServiceParams) SetPushIncludeDate(PushIncludeDate bool) (*CreateServiceParams){ + params.PushIncludeDate = &PushIncludeDate + return params +} +func (params *CreateServiceParams) SetPushApnCredentialSid(PushApnCredentialSid string) (*CreateServiceParams){ + params.PushApnCredentialSid = &PushApnCredentialSid + return params +} +func (params *CreateServiceParams) SetPushFcmCredentialSid(PushFcmCredentialSid string) (*CreateServiceParams){ + params.PushFcmCredentialSid = &PushFcmCredentialSid + return params +} +func (params *CreateServiceParams) SetTotpIssuer(TotpIssuer string) (*CreateServiceParams){ + params.TotpIssuer = &TotpIssuer + return params +} +func (params *CreateServiceParams) SetTotpTimeStep(TotpTimeStep int) (*CreateServiceParams){ + params.TotpTimeStep = &TotpTimeStep + return params +} +func (params *CreateServiceParams) SetTotpCodeLength(TotpCodeLength int) (*CreateServiceParams){ + params.TotpCodeLength = &TotpCodeLength + return params +} +func (params *CreateServiceParams) SetTotpSkew(TotpSkew int) (*CreateServiceParams){ + params.TotpSkew = &TotpSkew + return params +} +func (params *CreateServiceParams) SetDefaultTemplateSid(DefaultTemplateSid string) (*CreateServiceParams){ + params.DefaultTemplateSid = &DefaultTemplateSid + return params } // Create a new Verification Service. func (c *ApiService) CreateService(params *CreateServiceParams) (*VerifyV2Service, error) { - path := "/v2/Services" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CodeLength != nil { - data.Set("CodeLength", fmt.Sprint(*params.CodeLength)) - } - if params != nil && params.LookupEnabled != nil { - data.Set("LookupEnabled", fmt.Sprint(*params.LookupEnabled)) - } - if params != nil && params.SkipSmsToLandlines != nil { - data.Set("SkipSmsToLandlines", fmt.Sprint(*params.SkipSmsToLandlines)) - } - if params != nil && params.DtmfInputRequired != nil { - data.Set("DtmfInputRequired", fmt.Sprint(*params.DtmfInputRequired)) - } - if params != nil && params.TtsName != nil { - data.Set("TtsName", *params.TtsName) - } - if params != nil && params.Psd2Enabled != nil { - data.Set("Psd2Enabled", fmt.Sprint(*params.Psd2Enabled)) - } - if params != nil && params.DoNotShareWarningEnabled != nil { - data.Set("DoNotShareWarningEnabled", fmt.Sprint(*params.DoNotShareWarningEnabled)) - } - if params != nil && params.CustomCodeEnabled != nil { - data.Set("CustomCodeEnabled", fmt.Sprint(*params.CustomCodeEnabled)) - } - if params != nil && params.PushIncludeDate != nil { - data.Set("Push.IncludeDate", fmt.Sprint(*params.PushIncludeDate)) - } - if params != nil && params.PushApnCredentialSid != nil { - data.Set("Push.ApnCredentialSid", *params.PushApnCredentialSid) - } - if params != nil && params.PushFcmCredentialSid != nil { - data.Set("Push.FcmCredentialSid", *params.PushFcmCredentialSid) - } - if params != nil && params.TotpIssuer != nil { - data.Set("Totp.Issuer", *params.TotpIssuer) - } - if params != nil && params.TotpTimeStep != nil { - data.Set("Totp.TimeStep", fmt.Sprint(*params.TotpTimeStep)) - } - if params != nil && params.TotpCodeLength != nil { - data.Set("Totp.CodeLength", fmt.Sprint(*params.TotpCodeLength)) - } - if params != nil && params.TotpSkew != nil { - data.Set("Totp.Skew", fmt.Sprint(*params.TotpSkew)) - } - if params != nil && params.DefaultTemplateSid != nil { - data.Set("DefaultTemplateSid", *params.DefaultTemplateSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CodeLength != nil { + data.Set("CodeLength", fmt.Sprint(*params.CodeLength)) + } + if params != nil && params.LookupEnabled != nil { + data.Set("LookupEnabled", fmt.Sprint(*params.LookupEnabled)) + } + if params != nil && params.SkipSmsToLandlines != nil { + data.Set("SkipSmsToLandlines", fmt.Sprint(*params.SkipSmsToLandlines)) + } + if params != nil && params.DtmfInputRequired != nil { + data.Set("DtmfInputRequired", fmt.Sprint(*params.DtmfInputRequired)) + } + if params != nil && params.TtsName != nil { + data.Set("TtsName", *params.TtsName) + } + if params != nil && params.Psd2Enabled != nil { + data.Set("Psd2Enabled", fmt.Sprint(*params.Psd2Enabled)) + } + if params != nil && params.DoNotShareWarningEnabled != nil { + data.Set("DoNotShareWarningEnabled", fmt.Sprint(*params.DoNotShareWarningEnabled)) + } + if params != nil && params.CustomCodeEnabled != nil { + data.Set("CustomCodeEnabled", fmt.Sprint(*params.CustomCodeEnabled)) + } + if params != nil && params.PushIncludeDate != nil { + data.Set("Push.IncludeDate", fmt.Sprint(*params.PushIncludeDate)) + } + if params != nil && params.PushApnCredentialSid != nil { + data.Set("Push.ApnCredentialSid", *params.PushApnCredentialSid) + } + if params != nil && params.PushFcmCredentialSid != nil { + data.Set("Push.FcmCredentialSid", *params.PushFcmCredentialSid) + } + if params != nil && params.TotpIssuer != nil { + data.Set("Totp.Issuer", *params.TotpIssuer) + } + if params != nil && params.TotpTimeStep != nil { + data.Set("Totp.TimeStep", fmt.Sprint(*params.TotpTimeStep)) + } + if params != nil && params.TotpCodeLength != nil { + data.Set("Totp.CodeLength", fmt.Sprint(*params.TotpCodeLength)) + } + if params != nil && params.TotpSkew != nil { + data.Set("Totp.Skew", fmt.Sprint(*params.TotpSkew)) + } + if params != nil && params.DefaultTemplateSid != nil { + data.Set("DefaultTemplateSid", *params.DefaultTemplateSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Verification Service Instance. -func (c *ApiService) DeleteService(Sid string) error { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteService(Sid string, ) (error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch specific Verification Service Instance. -func (c *ApiService) FetchService(Sid string) (*VerifyV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchService(Sid string, ) (*VerifyV2Service, error) { + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListService' type ListServiceParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListServiceParams) SetPageSize(PageSize int) *ListServiceParams { - params.PageSize = &PageSize - return params +func (params *ListServiceParams) SetPageSize(PageSize int) (*ListServiceParams){ + params.PageSize = &PageSize + return params } -func (params *ListServiceParams) SetLimit(Limit int) *ListServiceParams { - params.Limit = &Limit - return params +func (params *ListServiceParams) SetLimit(Limit int) (*ListServiceParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Service records from the API. Request is executed immediately. func (c *ApiService) PageService(params *ListServiceParams, pageToken, pageNumber string) (*ListServiceResponse, error) { - path := "/v2/Services" + path := "/v2/Services" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Service records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -333,6 +339,7 @@ func (c *ApiService) StreamService(params *ListServiceParams) (chan VerifyV2Serv return recordChannel, errorChannel } + func (c *ApiService) streamService(response *ListServiceResponse, params *ListServiceParams, recordChannel chan VerifyV2Service, errorChannel chan error) { curRecord := 1 @@ -364,201 +371,203 @@ func (c *ApiService) streamService(response *ListServiceResponse, params *ListSe } func (c *ApiService) getNextListServiceResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListServiceResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListServiceResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateService' type UpdateServiceParams struct { - // A descriptive string that you create to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** - FriendlyName *string `json:"FriendlyName,omitempty"` - // The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. - CodeLength *int `json:"CodeLength,omitempty"` - // Whether to perform a lookup with each verification started and return info about the phone number. - LookupEnabled *bool `json:"LookupEnabled,omitempty"` - // Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. - SkipSmsToLandlines *bool `json:"SkipSmsToLandlines,omitempty"` - // Whether to ask the user to press a number before delivering the verify code in a phone call. - DtmfInputRequired *bool `json:"DtmfInputRequired,omitempty"` - // The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. - TtsName *string `json:"TtsName,omitempty"` - // Whether to pass PSD2 transaction parameters when starting a verification. - Psd2Enabled *bool `json:"Psd2Enabled,omitempty"` - // Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** - DoNotShareWarningEnabled *bool `json:"DoNotShareWarningEnabled,omitempty"` - // Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. - CustomCodeEnabled *bool `json:"CustomCodeEnabled,omitempty"` - // Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. - PushIncludeDate *bool `json:"Push.IncludeDate,omitempty"` - // Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) - PushApnCredentialSid *string `json:"Push.ApnCredentialSid,omitempty"` - // Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) - PushFcmCredentialSid *string `json:"Push.FcmCredentialSid,omitempty"` - // Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. - TotpIssuer *string `json:"Totp.Issuer,omitempty"` - // Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds - TotpTimeStep *int `json:"Totp.TimeStep,omitempty"` - // Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 - TotpCodeLength *int `json:"Totp.CodeLength,omitempty"` - // Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 - TotpSkew *int `json:"Totp.Skew,omitempty"` - // The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. - DefaultTemplateSid *string `json:"DefaultTemplateSid,omitempty"` -} - -func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) *UpdateServiceParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateServiceParams) SetCodeLength(CodeLength int) *UpdateServiceParams { - params.CodeLength = &CodeLength - return params -} -func (params *UpdateServiceParams) SetLookupEnabled(LookupEnabled bool) *UpdateServiceParams { - params.LookupEnabled = &LookupEnabled - return params -} -func (params *UpdateServiceParams) SetSkipSmsToLandlines(SkipSmsToLandlines bool) *UpdateServiceParams { - params.SkipSmsToLandlines = &SkipSmsToLandlines - return params -} -func (params *UpdateServiceParams) SetDtmfInputRequired(DtmfInputRequired bool) *UpdateServiceParams { - params.DtmfInputRequired = &DtmfInputRequired - return params -} -func (params *UpdateServiceParams) SetTtsName(TtsName string) *UpdateServiceParams { - params.TtsName = &TtsName - return params -} -func (params *UpdateServiceParams) SetPsd2Enabled(Psd2Enabled bool) *UpdateServiceParams { - params.Psd2Enabled = &Psd2Enabled - return params -} -func (params *UpdateServiceParams) SetDoNotShareWarningEnabled(DoNotShareWarningEnabled bool) *UpdateServiceParams { - params.DoNotShareWarningEnabled = &DoNotShareWarningEnabled - return params -} -func (params *UpdateServiceParams) SetCustomCodeEnabled(CustomCodeEnabled bool) *UpdateServiceParams { - params.CustomCodeEnabled = &CustomCodeEnabled - return params -} -func (params *UpdateServiceParams) SetPushIncludeDate(PushIncludeDate bool) *UpdateServiceParams { - params.PushIncludeDate = &PushIncludeDate - return params -} -func (params *UpdateServiceParams) SetPushApnCredentialSid(PushApnCredentialSid string) *UpdateServiceParams { - params.PushApnCredentialSid = &PushApnCredentialSid - return params -} -func (params *UpdateServiceParams) SetPushFcmCredentialSid(PushFcmCredentialSid string) *UpdateServiceParams { - params.PushFcmCredentialSid = &PushFcmCredentialSid - return params -} -func (params *UpdateServiceParams) SetTotpIssuer(TotpIssuer string) *UpdateServiceParams { - params.TotpIssuer = &TotpIssuer - return params -} -func (params *UpdateServiceParams) SetTotpTimeStep(TotpTimeStep int) *UpdateServiceParams { - params.TotpTimeStep = &TotpTimeStep - return params -} -func (params *UpdateServiceParams) SetTotpCodeLength(TotpCodeLength int) *UpdateServiceParams { - params.TotpCodeLength = &TotpCodeLength - return params -} -func (params *UpdateServiceParams) SetTotpSkew(TotpSkew int) *UpdateServiceParams { - params.TotpSkew = &TotpSkew - return params -} -func (params *UpdateServiceParams) SetDefaultTemplateSid(DefaultTemplateSid string) *UpdateServiceParams { - params.DefaultTemplateSid = &DefaultTemplateSid - return params + // A descriptive string that you create to describe the verification service. It can be up to 32 characters long. **This value should not contain PII.** + FriendlyName *string `json:"FriendlyName,omitempty"` + // The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. + CodeLength *int `json:"CodeLength,omitempty"` + // Whether to perform a lookup with each verification started and return info about the phone number. + LookupEnabled *bool `json:"LookupEnabled,omitempty"` + // Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. + SkipSmsToLandlines *bool `json:"SkipSmsToLandlines,omitempty"` + // Whether to ask the user to press a number before delivering the verify code in a phone call. + DtmfInputRequired *bool `json:"DtmfInputRequired,omitempty"` + // The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. + TtsName *string `json:"TtsName,omitempty"` + // Whether to pass PSD2 transaction parameters when starting a verification. + Psd2Enabled *bool `json:"Psd2Enabled,omitempty"` + // Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** + DoNotShareWarningEnabled *bool `json:"DoNotShareWarningEnabled,omitempty"` + // Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + CustomCodeEnabled *bool `json:"CustomCodeEnabled,omitempty"` + // Optional configuration for the Push factors. If true, include the date in the Challenge's response. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: false. **Deprecated** do not use this parameter. + PushIncludeDate *bool `json:"Push.IncludeDate,omitempty"` + // Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) + PushApnCredentialSid *string `json:"Push.ApnCredentialSid,omitempty"` + // Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) + PushFcmCredentialSid *string `json:"Push.FcmCredentialSid,omitempty"` + // Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. + TotpIssuer *string `json:"Totp.Issuer,omitempty"` + // Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds + TotpTimeStep *int `json:"Totp.TimeStep,omitempty"` + // Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 + TotpCodeLength *int `json:"Totp.CodeLength,omitempty"` + // Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 + TotpSkew *int `json:"Totp.Skew,omitempty"` + // The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. + DefaultTemplateSid *string `json:"DefaultTemplateSid,omitempty"` +} + +func (params *UpdateServiceParams) SetFriendlyName(FriendlyName string) (*UpdateServiceParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateServiceParams) SetCodeLength(CodeLength int) (*UpdateServiceParams){ + params.CodeLength = &CodeLength + return params +} +func (params *UpdateServiceParams) SetLookupEnabled(LookupEnabled bool) (*UpdateServiceParams){ + params.LookupEnabled = &LookupEnabled + return params +} +func (params *UpdateServiceParams) SetSkipSmsToLandlines(SkipSmsToLandlines bool) (*UpdateServiceParams){ + params.SkipSmsToLandlines = &SkipSmsToLandlines + return params +} +func (params *UpdateServiceParams) SetDtmfInputRequired(DtmfInputRequired bool) (*UpdateServiceParams){ + params.DtmfInputRequired = &DtmfInputRequired + return params +} +func (params *UpdateServiceParams) SetTtsName(TtsName string) (*UpdateServiceParams){ + params.TtsName = &TtsName + return params +} +func (params *UpdateServiceParams) SetPsd2Enabled(Psd2Enabled bool) (*UpdateServiceParams){ + params.Psd2Enabled = &Psd2Enabled + return params +} +func (params *UpdateServiceParams) SetDoNotShareWarningEnabled(DoNotShareWarningEnabled bool) (*UpdateServiceParams){ + params.DoNotShareWarningEnabled = &DoNotShareWarningEnabled + return params +} +func (params *UpdateServiceParams) SetCustomCodeEnabled(CustomCodeEnabled bool) (*UpdateServiceParams){ + params.CustomCodeEnabled = &CustomCodeEnabled + return params +} +func (params *UpdateServiceParams) SetPushIncludeDate(PushIncludeDate bool) (*UpdateServiceParams){ + params.PushIncludeDate = &PushIncludeDate + return params +} +func (params *UpdateServiceParams) SetPushApnCredentialSid(PushApnCredentialSid string) (*UpdateServiceParams){ + params.PushApnCredentialSid = &PushApnCredentialSid + return params +} +func (params *UpdateServiceParams) SetPushFcmCredentialSid(PushFcmCredentialSid string) (*UpdateServiceParams){ + params.PushFcmCredentialSid = &PushFcmCredentialSid + return params +} +func (params *UpdateServiceParams) SetTotpIssuer(TotpIssuer string) (*UpdateServiceParams){ + params.TotpIssuer = &TotpIssuer + return params +} +func (params *UpdateServiceParams) SetTotpTimeStep(TotpTimeStep int) (*UpdateServiceParams){ + params.TotpTimeStep = &TotpTimeStep + return params +} +func (params *UpdateServiceParams) SetTotpCodeLength(TotpCodeLength int) (*UpdateServiceParams){ + params.TotpCodeLength = &TotpCodeLength + return params +} +func (params *UpdateServiceParams) SetTotpSkew(TotpSkew int) (*UpdateServiceParams){ + params.TotpSkew = &TotpSkew + return params +} +func (params *UpdateServiceParams) SetDefaultTemplateSid(DefaultTemplateSid string) (*UpdateServiceParams){ + params.DefaultTemplateSid = &DefaultTemplateSid + return params } // Update a specific Verification Service. func (c *ApiService) UpdateService(Sid string, params *UpdateServiceParams) (*VerifyV2Service, error) { - path := "/v2/Services/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CodeLength != nil { - data.Set("CodeLength", fmt.Sprint(*params.CodeLength)) - } - if params != nil && params.LookupEnabled != nil { - data.Set("LookupEnabled", fmt.Sprint(*params.LookupEnabled)) - } - if params != nil && params.SkipSmsToLandlines != nil { - data.Set("SkipSmsToLandlines", fmt.Sprint(*params.SkipSmsToLandlines)) - } - if params != nil && params.DtmfInputRequired != nil { - data.Set("DtmfInputRequired", fmt.Sprint(*params.DtmfInputRequired)) - } - if params != nil && params.TtsName != nil { - data.Set("TtsName", *params.TtsName) - } - if params != nil && params.Psd2Enabled != nil { - data.Set("Psd2Enabled", fmt.Sprint(*params.Psd2Enabled)) - } - if params != nil && params.DoNotShareWarningEnabled != nil { - data.Set("DoNotShareWarningEnabled", fmt.Sprint(*params.DoNotShareWarningEnabled)) - } - if params != nil && params.CustomCodeEnabled != nil { - data.Set("CustomCodeEnabled", fmt.Sprint(*params.CustomCodeEnabled)) - } - if params != nil && params.PushIncludeDate != nil { - data.Set("Push.IncludeDate", fmt.Sprint(*params.PushIncludeDate)) - } - if params != nil && params.PushApnCredentialSid != nil { - data.Set("Push.ApnCredentialSid", *params.PushApnCredentialSid) - } - if params != nil && params.PushFcmCredentialSid != nil { - data.Set("Push.FcmCredentialSid", *params.PushFcmCredentialSid) - } - if params != nil && params.TotpIssuer != nil { - data.Set("Totp.Issuer", *params.TotpIssuer) - } - if params != nil && params.TotpTimeStep != nil { - data.Set("Totp.TimeStep", fmt.Sprint(*params.TotpTimeStep)) - } - if params != nil && params.TotpCodeLength != nil { - data.Set("Totp.CodeLength", fmt.Sprint(*params.TotpCodeLength)) - } - if params != nil && params.TotpSkew != nil { - data.Set("Totp.Skew", fmt.Sprint(*params.TotpSkew)) - } - if params != nil && params.DefaultTemplateSid != nil { - data.Set("DefaultTemplateSid", *params.DefaultTemplateSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Service{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CodeLength != nil { + data.Set("CodeLength", fmt.Sprint(*params.CodeLength)) + } + if params != nil && params.LookupEnabled != nil { + data.Set("LookupEnabled", fmt.Sprint(*params.LookupEnabled)) + } + if params != nil && params.SkipSmsToLandlines != nil { + data.Set("SkipSmsToLandlines", fmt.Sprint(*params.SkipSmsToLandlines)) + } + if params != nil && params.DtmfInputRequired != nil { + data.Set("DtmfInputRequired", fmt.Sprint(*params.DtmfInputRequired)) + } + if params != nil && params.TtsName != nil { + data.Set("TtsName", *params.TtsName) + } + if params != nil && params.Psd2Enabled != nil { + data.Set("Psd2Enabled", fmt.Sprint(*params.Psd2Enabled)) + } + if params != nil && params.DoNotShareWarningEnabled != nil { + data.Set("DoNotShareWarningEnabled", fmt.Sprint(*params.DoNotShareWarningEnabled)) + } + if params != nil && params.CustomCodeEnabled != nil { + data.Set("CustomCodeEnabled", fmt.Sprint(*params.CustomCodeEnabled)) + } + if params != nil && params.PushIncludeDate != nil { + data.Set("Push.IncludeDate", fmt.Sprint(*params.PushIncludeDate)) + } + if params != nil && params.PushApnCredentialSid != nil { + data.Set("Push.ApnCredentialSid", *params.PushApnCredentialSid) + } + if params != nil && params.PushFcmCredentialSid != nil { + data.Set("Push.FcmCredentialSid", *params.PushFcmCredentialSid) + } + if params != nil && params.TotpIssuer != nil { + data.Set("Totp.Issuer", *params.TotpIssuer) + } + if params != nil && params.TotpTimeStep != nil { + data.Set("Totp.TimeStep", fmt.Sprint(*params.TotpTimeStep)) + } + if params != nil && params.TotpCodeLength != nil { + data.Set("Totp.CodeLength", fmt.Sprint(*params.TotpCodeLength)) + } + if params != nil && params.TotpSkew != nil { + data.Set("Totp.Skew", fmt.Sprint(*params.TotpSkew)) + } + if params != nil && params.DefaultTemplateSid != nil { + data.Set("DefaultTemplateSid", *params.DefaultTemplateSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Service{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/verify/v2/services_access_tokens.go b/rest/verify/v2/services_access_tokens.go index c2921683f..8acd08920 100644 --- a/rest/verify/v2/services_access_tokens.go +++ b/rest/verify/v2/services_access_tokens.go @@ -18,94 +18,99 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateAccessToken' type CreateAccessTokenParams struct { - // The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, and generated by your external system, such as your user's UUID, GUID, or SID. - Identity *string `json:"Identity,omitempty"` - // - FactorType *string `json:"FactorType,omitempty"` - // The friendly name of the factor that is going to be created with this access token - FactorFriendlyName *string `json:"FactorFriendlyName,omitempty"` - // How long, in seconds, the access token is valid. Can be an integer between 60 and 300. Default is 60. - Ttl *int `json:"Ttl,omitempty"` + // The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, and generated by your external system, such as your user's UUID, GUID, or SID. + Identity *string `json:"Identity,omitempty"` + // + FactorType *string `json:"FactorType,omitempty"` + // The friendly name of the factor that is going to be created with this access token + FactorFriendlyName *string `json:"FactorFriendlyName,omitempty"` + // How long, in seconds, the access token is valid. Can be an integer between 60 and 300. Default is 60. + Ttl *int `json:"Ttl,omitempty"` } -func (params *CreateAccessTokenParams) SetIdentity(Identity string) *CreateAccessTokenParams { - params.Identity = &Identity - return params +func (params *CreateAccessTokenParams) SetIdentity(Identity string) (*CreateAccessTokenParams){ + params.Identity = &Identity + return params } -func (params *CreateAccessTokenParams) SetFactorType(FactorType string) *CreateAccessTokenParams { - params.FactorType = &FactorType - return params +func (params *CreateAccessTokenParams) SetFactorType(FactorType string) (*CreateAccessTokenParams){ + params.FactorType = &FactorType + return params } -func (params *CreateAccessTokenParams) SetFactorFriendlyName(FactorFriendlyName string) *CreateAccessTokenParams { - params.FactorFriendlyName = &FactorFriendlyName - return params +func (params *CreateAccessTokenParams) SetFactorFriendlyName(FactorFriendlyName string) (*CreateAccessTokenParams){ + params.FactorFriendlyName = &FactorFriendlyName + return params } -func (params *CreateAccessTokenParams) SetTtl(Ttl int) *CreateAccessTokenParams { - params.Ttl = &Ttl - return params +func (params *CreateAccessTokenParams) SetTtl(Ttl int) (*CreateAccessTokenParams){ + params.Ttl = &Ttl + return params } // Create a new enrollment Access Token for the Entity func (c *ApiService) CreateAccessToken(ServiceSid string, params *CreateAccessTokenParams) (*VerifyV2AccessToken, error) { - path := "/v2/Services/{ServiceSid}/AccessTokens" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.FactorType != nil { - data.Set("FactorType", *params.FactorType) - } - if params != nil && params.FactorFriendlyName != nil { - data.Set("FactorFriendlyName", *params.FactorFriendlyName) - } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2AccessToken{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/AccessTokens" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.FactorType != nil { + data.Set("FactorType", *params.FactorType) + } + if params != nil && params.FactorFriendlyName != nil { + data.Set("FactorFriendlyName", *params.FactorFriendlyName) + } + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2AccessToken{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch an Access Token for the Entity -func (c *ApiService) FetchAccessToken(ServiceSid string, Sid string) (*VerifyV2AccessToken, error) { - path := "/v2/Services/{ServiceSid}/AccessTokens/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchAccessToken(ServiceSid string, Sid string, ) (*VerifyV2AccessToken, error) { + path := "/v2/Services/{ServiceSid}/AccessTokens/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2AccessToken{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2AccessToken{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_entities.go b/rest/verify/v2/services_entities.go index 4f5ce3457..cf398243c 100644 --- a/rest/verify/v2/services_entities.go +++ b/rest/verify/v2/services_entities.go @@ -18,142 +18,147 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateEntity' type CreateEntityParams struct { - // The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. - Identity *string `json:"Identity,omitempty"` + // The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + Identity *string `json:"Identity,omitempty"` } -func (params *CreateEntityParams) SetIdentity(Identity string) *CreateEntityParams { - params.Identity = &Identity - return params +func (params *CreateEntityParams) SetIdentity(Identity string) (*CreateEntityParams){ + params.Identity = &Identity + return params } // Create a new Entity for the Service func (c *ApiService) CreateEntity(ServiceSid string, params *CreateEntityParams) (*VerifyV2Entity, error) { - path := "/v2/Services/{ServiceSid}/Entities" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/Entities" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2Entity{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2Entity{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Entity. -func (c *ApiService) DeleteEntity(ServiceSid string, Identity string) error { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) DeleteEntity(ServiceSid string, Identity string, ) (error) { + path := "/v2/Services/{ServiceSid}/Entities/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Entity. -func (c *ApiService) FetchEntity(ServiceSid string, Identity string) (*VerifyV2Entity, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) +func (c *ApiService) FetchEntity(ServiceSid string, Identity string, ) (*VerifyV2Entity, error) { + path := "/v2/Services/{ServiceSid}/Entities/{Identity}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2Entity{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Entity{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListEntity' type ListEntityParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListEntityParams) SetPageSize(PageSize int) *ListEntityParams { - params.PageSize = &PageSize - return params +func (params *ListEntityParams) SetPageSize(PageSize int) (*ListEntityParams){ + params.PageSize = &PageSize + return params } -func (params *ListEntityParams) SetLimit(Limit int) *ListEntityParams { - params.Limit = &Limit - return params +func (params *ListEntityParams) SetLimit(Limit int) (*ListEntityParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Entity records from the API. Request is executed immediately. func (c *ApiService) PageEntity(ServiceSid string, params *ListEntityParams, pageToken, pageNumber string) (*ListEntityResponse, error) { - path := "/v2/Services/{ServiceSid}/Entities" + path := "/v2/Services/{ServiceSid}/Entities" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListEntityResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListEntityResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Entity records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -194,6 +199,7 @@ func (c *ApiService) StreamEntity(ServiceSid string, params *ListEntityParams) ( return recordChannel, errorChannel } + func (c *ApiService) streamEntity(response *ListEntityResponse, params *ListEntityParams, recordChannel chan VerifyV2Entity, errorChannel chan error) { curRecord := 1 @@ -225,19 +231,20 @@ func (c *ApiService) streamEntity(response *ListEntityResponse, params *ListEnti } func (c *ApiService) getNextListEntityResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListEntityResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListEntityResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/verify/v2/services_entities_challenges.go b/rest/verify/v2/services_entities_challenges.go index 9b200d5e4..9f8adc0d6 100644 --- a/rest/verify/v2/services_entities_challenges.go +++ b/rest/verify/v2/services_entities_challenges.go @@ -18,213 +18,215 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateChallenge' type CreateChallengeParams struct { - // The unique SID identifier of the Factor. - FactorSid *string `json:"FactorSid,omitempty"` - // The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. - ExpirationDate *time.Time `json:"ExpirationDate,omitempty"` - // Shown to the user when the push notification arrives. Required when `factor_type` is `push`. Can be up to 256 characters in length - DetailsMessage *string `json:"Details.Message,omitempty"` - // A list of objects that describe the Fields included in the Challenge. Each object contains the label and value of the field, the label can be up to 36 characters in length and the value can be up to 128 characters in length. Used when `factor_type` is `push`. There can be up to 20 details fields. - DetailsFields *[]interface{} `json:"Details.Fields,omitempty"` - // Details provided to give context about the Challenge. Not shown to the end user. It must be a stringified JSON with only strings values eg. `{\\\"ip\\\": \\\"172.168.1.234\\\"}`. Can be up to 1024 characters in length - HiddenDetails *interface{} `json:"HiddenDetails,omitempty"` - // Optional payload used to verify the Challenge upon creation. Only used with a Factor of type `totp` to carry the TOTP code that needs to be verified. For `TOTP` this value must be between 3 and 8 characters long. - AuthPayload *string `json:"AuthPayload,omitempty"` + // The unique SID identifier of the Factor. + FactorSid *string `json:"FactorSid,omitempty"` + // The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. + ExpirationDate *time.Time `json:"ExpirationDate,omitempty"` + // Shown to the user when the push notification arrives. Required when `factor_type` is `push`. Can be up to 256 characters in length + DetailsMessage *string `json:"Details.Message,omitempty"` + // A list of objects that describe the Fields included in the Challenge. Each object contains the label and value of the field, the label can be up to 36 characters in length and the value can be up to 128 characters in length. Used when `factor_type` is `push`. There can be up to 20 details fields. + DetailsFields *[]interface{} `json:"Details.Fields,omitempty"` + // Details provided to give context about the Challenge. Not shown to the end user. It must be a stringified JSON with only strings values eg. `{\\\"ip\\\": \\\"172.168.1.234\\\"}`. Can be up to 1024 characters in length + HiddenDetails *interface{} `json:"HiddenDetails,omitempty"` + // Optional payload used to verify the Challenge upon creation. Only used with a Factor of type `totp` to carry the TOTP code that needs to be verified. For `TOTP` this value must be between 3 and 8 characters long. + AuthPayload *string `json:"AuthPayload,omitempty"` } -func (params *CreateChallengeParams) SetFactorSid(FactorSid string) *CreateChallengeParams { - params.FactorSid = &FactorSid - return params +func (params *CreateChallengeParams) SetFactorSid(FactorSid string) (*CreateChallengeParams){ + params.FactorSid = &FactorSid + return params } -func (params *CreateChallengeParams) SetExpirationDate(ExpirationDate time.Time) *CreateChallengeParams { - params.ExpirationDate = &ExpirationDate - return params +func (params *CreateChallengeParams) SetExpirationDate(ExpirationDate time.Time) (*CreateChallengeParams){ + params.ExpirationDate = &ExpirationDate + return params } -func (params *CreateChallengeParams) SetDetailsMessage(DetailsMessage string) *CreateChallengeParams { - params.DetailsMessage = &DetailsMessage - return params +func (params *CreateChallengeParams) SetDetailsMessage(DetailsMessage string) (*CreateChallengeParams){ + params.DetailsMessage = &DetailsMessage + return params } -func (params *CreateChallengeParams) SetDetailsFields(DetailsFields []interface{}) *CreateChallengeParams { - params.DetailsFields = &DetailsFields - return params +func (params *CreateChallengeParams) SetDetailsFields(DetailsFields []interface{}) (*CreateChallengeParams){ + params.DetailsFields = &DetailsFields + return params } -func (params *CreateChallengeParams) SetHiddenDetails(HiddenDetails interface{}) *CreateChallengeParams { - params.HiddenDetails = &HiddenDetails - return params +func (params *CreateChallengeParams) SetHiddenDetails(HiddenDetails interface{}) (*CreateChallengeParams){ + params.HiddenDetails = &HiddenDetails + return params } -func (params *CreateChallengeParams) SetAuthPayload(AuthPayload string) *CreateChallengeParams { - params.AuthPayload = &AuthPayload - return params +func (params *CreateChallengeParams) SetAuthPayload(AuthPayload string) (*CreateChallengeParams){ + params.AuthPayload = &AuthPayload + return params } // Create a new Challenge for the Factor func (c *ApiService) CreateChallenge(ServiceSid string, Identity string, params *CreateChallengeParams) (*VerifyV2Challenge, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FactorSid != nil { - data.Set("FactorSid", *params.FactorSid) - } - if params != nil && params.ExpirationDate != nil { - data.Set("ExpirationDate", fmt.Sprint((*params.ExpirationDate).Format(time.RFC3339))) - } - if params != nil && params.DetailsMessage != nil { - data.Set("Details.Message", *params.DetailsMessage) - } - if params != nil && params.DetailsFields != nil { - for _, item := range *params.DetailsFields { - v, err := json.Marshal(item) - - if err != nil { - return nil, err - } - - data.Add("Details.Fields", string(v)) - } - } - if params != nil && params.HiddenDetails != nil { - v, err := json.Marshal(params.HiddenDetails) - - if err != nil { - return nil, err - } - - data.Set("HiddenDetails", string(v)) - } - if params != nil && params.AuthPayload != nil { - data.Set("AuthPayload", *params.AuthPayload) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Challenge{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FactorSid != nil { + data.Set("FactorSid", *params.FactorSid) + } + if params != nil && params.ExpirationDate != nil { + data.Set("ExpirationDate", fmt.Sprint((*params.ExpirationDate).Format(time.RFC3339))) + } + if params != nil && params.DetailsMessage != nil { + data.Set("Details.Message", *params.DetailsMessage) + } + if params != nil && params.DetailsFields != nil { + for _, item := range *params.DetailsFields { + v, err := json.Marshal(item) + + if err != nil { + return nil, err + } + + data.Add("Details.Fields", string(v)) + } + } + if params != nil && params.HiddenDetails != nil { + v, err := json.Marshal(params.HiddenDetails) + + if err != nil { + return nil, err + } + + data.Set("HiddenDetails", string(v)) + } + if params != nil && params.AuthPayload != nil { + data.Set("AuthPayload", *params.AuthPayload) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Challenge{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch a specific Challenge. -func (c *ApiService) FetchChallenge(ServiceSid string, Identity string, Sid string) (*VerifyV2Challenge, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchChallenge(ServiceSid string, Identity string, Sid string, ) (*VerifyV2Challenge, error) { + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2Challenge{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VerifyV2Challenge{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListChallenge' type ListChallengeParams struct { - // The unique SID identifier of the Factor. - FactorSid *string `json:"FactorSid,omitempty"` - // The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. - Status *string `json:"Status,omitempty"` - // The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. - Order *string `json:"Order,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The unique SID identifier of the Factor. + FactorSid *string `json:"FactorSid,omitempty"` + // The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. + Status *string `json:"Status,omitempty"` + // The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. + Order *string `json:"Order,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListChallengeParams) SetFactorSid(FactorSid string) *ListChallengeParams { - params.FactorSid = &FactorSid - return params +func (params *ListChallengeParams) SetFactorSid(FactorSid string) (*ListChallengeParams){ + params.FactorSid = &FactorSid + return params } -func (params *ListChallengeParams) SetStatus(Status string) *ListChallengeParams { - params.Status = &Status - return params +func (params *ListChallengeParams) SetStatus(Status string) (*ListChallengeParams){ + params.Status = &Status + return params } -func (params *ListChallengeParams) SetOrder(Order string) *ListChallengeParams { - params.Order = &Order - return params +func (params *ListChallengeParams) SetOrder(Order string) (*ListChallengeParams){ + params.Order = &Order + return params } -func (params *ListChallengeParams) SetPageSize(PageSize int) *ListChallengeParams { - params.PageSize = &PageSize - return params +func (params *ListChallengeParams) SetPageSize(PageSize int) (*ListChallengeParams){ + params.PageSize = &PageSize + return params } -func (params *ListChallengeParams) SetLimit(Limit int) *ListChallengeParams { - params.Limit = &Limit - return params +func (params *ListChallengeParams) SetLimit(Limit int) (*ListChallengeParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Challenge records from the API. Request is executed immediately. func (c *ApiService) PageChallenge(ServiceSid string, Identity string, params *ListChallengeParams, pageToken, pageNumber string) (*ListChallengeResponse, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges" - - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FactorSid != nil { - data.Set("FactorSid", *params.FactorSid) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Order != nil { - data.Set("Order", *params.Order) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChallengeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges" + + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FactorSid != nil { + data.Set("FactorSid", *params.FactorSid) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Order != nil { + data.Set("Order", *params.Order) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChallengeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Challenge records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -265,6 +267,7 @@ func (c *ApiService) StreamChallenge(ServiceSid string, Identity string, params return recordChannel, errorChannel } + func (c *ApiService) streamChallenge(response *ListChallengeResponse, params *ListChallengeParams, recordChannel chan VerifyV2Challenge, errorChannel chan error) { curRecord := 1 @@ -296,74 +299,76 @@ func (c *ApiService) streamChallenge(response *ListChallengeResponse, params *Li } func (c *ApiService) getNextListChallengeResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListChallengeResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListChallengeResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateChallenge' type UpdateChallengeParams struct { - // The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For `TOTP` this value must be between 3 and 8 characters long. For `Push` this value can be up to 5456 characters in length - AuthPayload *string `json:"AuthPayload,omitempty"` - // Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\\\"os\\\": \\\"Android\\\"}`. Can be up to 1024 characters in length. - Metadata *interface{} `json:"Metadata,omitempty"` + // The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For `TOTP` this value must be between 3 and 8 characters long. For `Push` this value can be up to 5456 characters in length + AuthPayload *string `json:"AuthPayload,omitempty"` + // Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\\\"os\\\": \\\"Android\\\"}`. Can be up to 1024 characters in length. + Metadata *interface{} `json:"Metadata,omitempty"` } -func (params *UpdateChallengeParams) SetAuthPayload(AuthPayload string) *UpdateChallengeParams { - params.AuthPayload = &AuthPayload - return params +func (params *UpdateChallengeParams) SetAuthPayload(AuthPayload string) (*UpdateChallengeParams){ + params.AuthPayload = &AuthPayload + return params } -func (params *UpdateChallengeParams) SetMetadata(Metadata interface{}) *UpdateChallengeParams { - params.Metadata = &Metadata - return params +func (params *UpdateChallengeParams) SetMetadata(Metadata interface{}) (*UpdateChallengeParams){ + params.Metadata = &Metadata + return params } // Verify a specific Challenge. func (c *ApiService) UpdateChallenge(ServiceSid string, Identity string, Sid string, params *UpdateChallengeParams) (*VerifyV2Challenge, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.AuthPayload != nil { - data.Set("AuthPayload", *params.AuthPayload) - } - if params != nil && params.Metadata != nil { - v, err := json.Marshal(params.Metadata) + if params != nil && params.AuthPayload != nil { + data.Set("AuthPayload", *params.AuthPayload) + } + if params != nil && params.Metadata != nil { + v, err := json.Marshal(params.Metadata) - if err != nil { - return nil, err - } + if err != nil { + return nil, err + } - data.Set("Metadata", string(v)) - } + data.Set("Metadata", string(v)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2Challenge{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2Challenge{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_entities_challenges_notifications.go b/rest/verify/v2/services_entities_challenges_notifications.go index 6d36b964a..50f1cb4e6 100644 --- a/rest/verify/v2/services_entities_challenges_notifications.go +++ b/rest/verify/v2/services_entities_challenges_notifications.go @@ -18,45 +18,48 @@ import ( "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNotification' type CreateNotificationParams struct { - // How long, in seconds, the notification is valid. Can be an integer between 0 and 300. Default is 300. Delivery is attempted until the TTL elapses, even if the device is offline. 0 means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. - Ttl *int `json:"Ttl,omitempty"` + // How long, in seconds, the notification is valid. Can be an integer between 0 and 300. Default is 300. Delivery is attempted until the TTL elapses, even if the device is offline. 0 means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. + Ttl *int `json:"Ttl,omitempty"` } -func (params *CreateNotificationParams) SetTtl(Ttl int) *CreateNotificationParams { - params.Ttl = &Ttl - return params +func (params *CreateNotificationParams) SetTtl(Ttl int) (*CreateNotificationParams){ + params.Ttl = &Ttl + return params } // Create a new Notification for the corresponding Challenge func (c *ApiService) CreateNotification(ServiceSid string, Identity string, ChallengeSid string, params *CreateNotificationParams) (*VerifyV2Notification, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{ChallengeSid}/Notifications" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - path = strings.Replace(path, "{"+"ChallengeSid"+"}", ChallengeSid, -1) + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Challenges/{ChallengeSid}/Notifications" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"ChallengeSid"+"}", ChallengeSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Ttl != nil { + data.Set("Ttl", fmt.Sprint(*params.Ttl)) + } - if params != nil && params.Ttl != nil { - data.Set("Ttl", fmt.Sprint(*params.Ttl)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2Notification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2Notification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_entities_factors.go b/rest/verify/v2/services_entities_factors.go index 089255ec7..8e72b284f 100644 --- a/rest/verify/v2/services_entities_factors.go +++ b/rest/verify/v2/services_entities_factors.go @@ -18,269 +18,274 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateNewFactor' type CreateNewFactorParams struct { - // The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. - FriendlyName *string `json:"FriendlyName,omitempty"` - // - FactorType *string `json:"FactorType,omitempty"` - // The algorithm used when `factor_type` is `push`. Algorithm supported: `ES256` - BindingAlg *string `json:"Binding.Alg,omitempty"` - // The Ecdsa public key in PKIX, ASN.1 DER format encoded in Base64. Required when `factor_type` is `push` - BindingPublicKey *string `json:"Binding.PublicKey,omitempty"` - // The ID that uniquely identifies your app in the Google or Apple store, such as `com.example.myapp`. It can be up to 100 characters long. Required when `factor_type` is `push`. - ConfigAppId *string `json:"Config.AppId,omitempty"` - // - ConfigNotificationPlatform *string `json:"Config.NotificationPlatform,omitempty"` - // For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Must be between 32 and 255 characters long. Required when `factor_type` is `push`. - ConfigNotificationToken *string `json:"Config.NotificationToken,omitempty"` - // The Verify Push SDK version used to configure the factor Required when `factor_type` is `push` - ConfigSdkVersion *string `json:"Config.SdkVersion,omitempty"` - // The shared secret for TOTP factors encoded in Base32. This can be provided when creating the Factor, otherwise it will be generated. Used when `factor_type` is `totp` - BindingSecret *string `json:"Binding.Secret,omitempty"` - // Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. The default value is defined at the service level in the property `totp.time_step`. Defaults to 30 seconds if not configured. Used when `factor_type` is `totp` - ConfigTimeStep *int `json:"Config.TimeStep,omitempty"` - // The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. The default value is defined at the service level in the property `totp.skew`. If not configured defaults to 1. Used when `factor_type` is `totp` - ConfigSkew *int `json:"Config.Skew,omitempty"` - // Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. The default value is defined at the service level in the property `totp.code_length`. If not configured defaults to 6. Used when `factor_type` is `totp` - ConfigCodeLength *int `json:"Config.CodeLength,omitempty"` - // - ConfigAlg *string `json:"Config.Alg,omitempty"` - // Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\\\"os\\\": \\\"Android\\\"}`. Can be up to 1024 characters in length. - Metadata *interface{} `json:"Metadata,omitempty"` -} - -func (params *CreateNewFactorParams) SetFriendlyName(FriendlyName string) *CreateNewFactorParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateNewFactorParams) SetFactorType(FactorType string) *CreateNewFactorParams { - params.FactorType = &FactorType - return params -} -func (params *CreateNewFactorParams) SetBindingAlg(BindingAlg string) *CreateNewFactorParams { - params.BindingAlg = &BindingAlg - return params -} -func (params *CreateNewFactorParams) SetBindingPublicKey(BindingPublicKey string) *CreateNewFactorParams { - params.BindingPublicKey = &BindingPublicKey - return params -} -func (params *CreateNewFactorParams) SetConfigAppId(ConfigAppId string) *CreateNewFactorParams { - params.ConfigAppId = &ConfigAppId - return params -} -func (params *CreateNewFactorParams) SetConfigNotificationPlatform(ConfigNotificationPlatform string) *CreateNewFactorParams { - params.ConfigNotificationPlatform = &ConfigNotificationPlatform - return params -} -func (params *CreateNewFactorParams) SetConfigNotificationToken(ConfigNotificationToken string) *CreateNewFactorParams { - params.ConfigNotificationToken = &ConfigNotificationToken - return params -} -func (params *CreateNewFactorParams) SetConfigSdkVersion(ConfigSdkVersion string) *CreateNewFactorParams { - params.ConfigSdkVersion = &ConfigSdkVersion - return params -} -func (params *CreateNewFactorParams) SetBindingSecret(BindingSecret string) *CreateNewFactorParams { - params.BindingSecret = &BindingSecret - return params -} -func (params *CreateNewFactorParams) SetConfigTimeStep(ConfigTimeStep int) *CreateNewFactorParams { - params.ConfigTimeStep = &ConfigTimeStep - return params -} -func (params *CreateNewFactorParams) SetConfigSkew(ConfigSkew int) *CreateNewFactorParams { - params.ConfigSkew = &ConfigSkew - return params -} -func (params *CreateNewFactorParams) SetConfigCodeLength(ConfigCodeLength int) *CreateNewFactorParams { - params.ConfigCodeLength = &ConfigCodeLength - return params -} -func (params *CreateNewFactorParams) SetConfigAlg(ConfigAlg string) *CreateNewFactorParams { - params.ConfigAlg = &ConfigAlg - return params -} -func (params *CreateNewFactorParams) SetMetadata(Metadata interface{}) *CreateNewFactorParams { - params.Metadata = &Metadata - return params + // The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. + FriendlyName *string `json:"FriendlyName,omitempty"` + // + FactorType *string `json:"FactorType,omitempty"` + // The algorithm used when `factor_type` is `push`. Algorithm supported: `ES256` + BindingAlg *string `json:"Binding.Alg,omitempty"` + // The Ecdsa public key in PKIX, ASN.1 DER format encoded in Base64. Required when `factor_type` is `push` + BindingPublicKey *string `json:"Binding.PublicKey,omitempty"` + // The ID that uniquely identifies your app in the Google or Apple store, such as `com.example.myapp`. It can be up to 100 characters long. Required when `factor_type` is `push`. + ConfigAppId *string `json:"Config.AppId,omitempty"` + // + ConfigNotificationPlatform *string `json:"Config.NotificationPlatform,omitempty"` + // For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Must be between 32 and 255 characters long. Required when `factor_type` is `push`. + ConfigNotificationToken *string `json:"Config.NotificationToken,omitempty"` + // The Verify Push SDK version used to configure the factor Required when `factor_type` is `push` + ConfigSdkVersion *string `json:"Config.SdkVersion,omitempty"` + // The shared secret for TOTP factors encoded in Base32. This can be provided when creating the Factor, otherwise it will be generated. Used when `factor_type` is `totp` + BindingSecret *string `json:"Binding.Secret,omitempty"` + // Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. The default value is defined at the service level in the property `totp.time_step`. Defaults to 30 seconds if not configured. Used when `factor_type` is `totp` + ConfigTimeStep *int `json:"Config.TimeStep,omitempty"` + // The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. The default value is defined at the service level in the property `totp.skew`. If not configured defaults to 1. Used when `factor_type` is `totp` + ConfigSkew *int `json:"Config.Skew,omitempty"` + // Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. The default value is defined at the service level in the property `totp.code_length`. If not configured defaults to 6. Used when `factor_type` is `totp` + ConfigCodeLength *int `json:"Config.CodeLength,omitempty"` + // + ConfigAlg *string `json:"Config.Alg,omitempty"` + // Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\\\"os\\\": \\\"Android\\\"}`. Can be up to 1024 characters in length. + Metadata *interface{} `json:"Metadata,omitempty"` +} + +func (params *CreateNewFactorParams) SetFriendlyName(FriendlyName string) (*CreateNewFactorParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateNewFactorParams) SetFactorType(FactorType string) (*CreateNewFactorParams){ + params.FactorType = &FactorType + return params +} +func (params *CreateNewFactorParams) SetBindingAlg(BindingAlg string) (*CreateNewFactorParams){ + params.BindingAlg = &BindingAlg + return params +} +func (params *CreateNewFactorParams) SetBindingPublicKey(BindingPublicKey string) (*CreateNewFactorParams){ + params.BindingPublicKey = &BindingPublicKey + return params +} +func (params *CreateNewFactorParams) SetConfigAppId(ConfigAppId string) (*CreateNewFactorParams){ + params.ConfigAppId = &ConfigAppId + return params +} +func (params *CreateNewFactorParams) SetConfigNotificationPlatform(ConfigNotificationPlatform string) (*CreateNewFactorParams){ + params.ConfigNotificationPlatform = &ConfigNotificationPlatform + return params +} +func (params *CreateNewFactorParams) SetConfigNotificationToken(ConfigNotificationToken string) (*CreateNewFactorParams){ + params.ConfigNotificationToken = &ConfigNotificationToken + return params +} +func (params *CreateNewFactorParams) SetConfigSdkVersion(ConfigSdkVersion string) (*CreateNewFactorParams){ + params.ConfigSdkVersion = &ConfigSdkVersion + return params +} +func (params *CreateNewFactorParams) SetBindingSecret(BindingSecret string) (*CreateNewFactorParams){ + params.BindingSecret = &BindingSecret + return params +} +func (params *CreateNewFactorParams) SetConfigTimeStep(ConfigTimeStep int) (*CreateNewFactorParams){ + params.ConfigTimeStep = &ConfigTimeStep + return params +} +func (params *CreateNewFactorParams) SetConfigSkew(ConfigSkew int) (*CreateNewFactorParams){ + params.ConfigSkew = &ConfigSkew + return params +} +func (params *CreateNewFactorParams) SetConfigCodeLength(ConfigCodeLength int) (*CreateNewFactorParams){ + params.ConfigCodeLength = &ConfigCodeLength + return params +} +func (params *CreateNewFactorParams) SetConfigAlg(ConfigAlg string) (*CreateNewFactorParams){ + params.ConfigAlg = &ConfigAlg + return params +} +func (params *CreateNewFactorParams) SetMetadata(Metadata interface{}) (*CreateNewFactorParams){ + params.Metadata = &Metadata + return params } // Create a new Factor for the Entity func (c *ApiService) CreateNewFactor(ServiceSid string, Identity string, params *CreateNewFactorParams) (*VerifyV2NewFactor, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - - data := url.Values{} - headers := make(map[string]interface{}) + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.FactorType != nil { + data.Set("FactorType", *params.FactorType) + } + if params != nil && params.BindingAlg != nil { + data.Set("Binding.Alg", *params.BindingAlg) + } + if params != nil && params.BindingPublicKey != nil { + data.Set("Binding.PublicKey", *params.BindingPublicKey) + } + if params != nil && params.ConfigAppId != nil { + data.Set("Config.AppId", *params.ConfigAppId) + } + if params != nil && params.ConfigNotificationPlatform != nil { + data.Set("Config.NotificationPlatform", *params.ConfigNotificationPlatform) + } + if params != nil && params.ConfigNotificationToken != nil { + data.Set("Config.NotificationToken", *params.ConfigNotificationToken) + } + if params != nil && params.ConfigSdkVersion != nil { + data.Set("Config.SdkVersion", *params.ConfigSdkVersion) + } + if params != nil && params.BindingSecret != nil { + data.Set("Binding.Secret", *params.BindingSecret) + } + if params != nil && params.ConfigTimeStep != nil { + data.Set("Config.TimeStep", fmt.Sprint(*params.ConfigTimeStep)) + } + if params != nil && params.ConfigSkew != nil { + data.Set("Config.Skew", fmt.Sprint(*params.ConfigSkew)) + } + if params != nil && params.ConfigCodeLength != nil { + data.Set("Config.CodeLength", fmt.Sprint(*params.ConfigCodeLength)) + } + if params != nil && params.ConfigAlg != nil { + data.Set("Config.Alg", *params.ConfigAlg) + } + if params != nil && params.Metadata != nil { + v, err := json.Marshal(params.Metadata) + + if err != nil { + return nil, err + } + + data.Set("Metadata", string(v)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2NewFactor{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.FactorType != nil { - data.Set("FactorType", *params.FactorType) - } - if params != nil && params.BindingAlg != nil { - data.Set("Binding.Alg", *params.BindingAlg) - } - if params != nil && params.BindingPublicKey != nil { - data.Set("Binding.PublicKey", *params.BindingPublicKey) - } - if params != nil && params.ConfigAppId != nil { - data.Set("Config.AppId", *params.ConfigAppId) - } - if params != nil && params.ConfigNotificationPlatform != nil { - data.Set("Config.NotificationPlatform", *params.ConfigNotificationPlatform) - } - if params != nil && params.ConfigNotificationToken != nil { - data.Set("Config.NotificationToken", *params.ConfigNotificationToken) - } - if params != nil && params.ConfigSdkVersion != nil { - data.Set("Config.SdkVersion", *params.ConfigSdkVersion) - } - if params != nil && params.BindingSecret != nil { - data.Set("Binding.Secret", *params.BindingSecret) - } - if params != nil && params.ConfigTimeStep != nil { - data.Set("Config.TimeStep", fmt.Sprint(*params.ConfigTimeStep)) - } - if params != nil && params.ConfigSkew != nil { - data.Set("Config.Skew", fmt.Sprint(*params.ConfigSkew)) - } - if params != nil && params.ConfigCodeLength != nil { - data.Set("Config.CodeLength", fmt.Sprint(*params.ConfigCodeLength)) - } - if params != nil && params.ConfigAlg != nil { - data.Set("Config.Alg", *params.ConfigAlg) - } - if params != nil && params.Metadata != nil { - v, err := json.Marshal(params.Metadata) +// Delete a specific Factor. +func (c *ApiService) DeleteFactor(ServiceSid string, Identity string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - data.Set("Metadata", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - ps := &VerifyV2NewFactor{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + return nil } -// Delete a specific Factor. -func (c *ApiService) DeleteFactor(ServiceSid string, Identity string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// Fetch a specific Factor. +func (c *ApiService) FetchFactor(ServiceSid string, Identity string, Sid string, ) (*VerifyV2Factor, error) { + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// Fetch a specific Factor. -func (c *ApiService) FetchFactor(ServiceSid string, Identity string, Sid string) (*VerifyV2Factor, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &VerifyV2Factor{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &VerifyV2Factor{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListFactor' type ListFactorParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListFactorParams) SetPageSize(PageSize int) *ListFactorParams { - params.PageSize = &PageSize - return params +func (params *ListFactorParams) SetPageSize(PageSize int) (*ListFactorParams){ + params.PageSize = &PageSize + return params } -func (params *ListFactorParams) SetLimit(Limit int) *ListFactorParams { - params.Limit = &Limit - return params +func (params *ListFactorParams) SetLimit(Limit int) (*ListFactorParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Factor records from the API. Request is executed immediately. func (c *ApiService) PageFactor(ServiceSid string, Identity string, params *ListFactorParams, pageToken, pageNumber string) (*ListFactorResponse, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors" + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFactorResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListFactorResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Factor records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -321,6 +326,7 @@ func (c *ApiService) StreamFactor(ServiceSid string, Identity string, params *Li return recordChannel, errorChannel } + func (c *ApiService) streamFactor(response *ListFactorResponse, params *ListFactorParams, recordChannel chan VerifyV2Factor, errorChannel chan error) { curRecord := 1 @@ -352,131 +358,133 @@ func (c *ApiService) streamFactor(response *ListFactorResponse, params *ListFact } func (c *ApiService) getNextListFactorResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListFactorResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListFactorResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateFactor' type UpdateFactorParams struct { - // The optional payload needed to verify the Factor for the first time. E.g. for a TOTP, the numeric code. - AuthPayload *string `json:"AuthPayload,omitempty"` - // The new friendly name of this Factor. It can be up to 64 characters. - FriendlyName *string `json:"FriendlyName,omitempty"` - // For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Required when `factor_type` is `push`. If specified, this value must be between 32 and 255 characters long. - ConfigNotificationToken *string `json:"Config.NotificationToken,omitempty"` - // The Verify Push SDK version used to configure the factor - ConfigSdkVersion *string `json:"Config.SdkVersion,omitempty"` - // Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive - ConfigTimeStep *int `json:"Config.TimeStep,omitempty"` - // The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive - ConfigSkew *int `json:"Config.Skew,omitempty"` - // Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive - ConfigCodeLength *int `json:"Config.CodeLength,omitempty"` - // - ConfigAlg *string `json:"Config.Alg,omitempty"` - // The transport technology used to generate the Notification Token. Can be `apn`, `fcm` or `none`. Required when `factor_type` is `push`. - ConfigNotificationPlatform *string `json:"Config.NotificationPlatform,omitempty"` -} - -func (params *UpdateFactorParams) SetAuthPayload(AuthPayload string) *UpdateFactorParams { - params.AuthPayload = &AuthPayload - return params -} -func (params *UpdateFactorParams) SetFriendlyName(FriendlyName string) *UpdateFactorParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateFactorParams) SetConfigNotificationToken(ConfigNotificationToken string) *UpdateFactorParams { - params.ConfigNotificationToken = &ConfigNotificationToken - return params -} -func (params *UpdateFactorParams) SetConfigSdkVersion(ConfigSdkVersion string) *UpdateFactorParams { - params.ConfigSdkVersion = &ConfigSdkVersion - return params -} -func (params *UpdateFactorParams) SetConfigTimeStep(ConfigTimeStep int) *UpdateFactorParams { - params.ConfigTimeStep = &ConfigTimeStep - return params -} -func (params *UpdateFactorParams) SetConfigSkew(ConfigSkew int) *UpdateFactorParams { - params.ConfigSkew = &ConfigSkew - return params -} -func (params *UpdateFactorParams) SetConfigCodeLength(ConfigCodeLength int) *UpdateFactorParams { - params.ConfigCodeLength = &ConfigCodeLength - return params -} -func (params *UpdateFactorParams) SetConfigAlg(ConfigAlg string) *UpdateFactorParams { - params.ConfigAlg = &ConfigAlg - return params -} -func (params *UpdateFactorParams) SetConfigNotificationPlatform(ConfigNotificationPlatform string) *UpdateFactorParams { - params.ConfigNotificationPlatform = &ConfigNotificationPlatform - return params + // The optional payload needed to verify the Factor for the first time. E.g. for a TOTP, the numeric code. + AuthPayload *string `json:"AuthPayload,omitempty"` + // The new friendly name of this Factor. It can be up to 64 characters. + FriendlyName *string `json:"FriendlyName,omitempty"` + // For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Required when `factor_type` is `push`. If specified, this value must be between 32 and 255 characters long. + ConfigNotificationToken *string `json:"Config.NotificationToken,omitempty"` + // The Verify Push SDK version used to configure the factor + ConfigSdkVersion *string `json:"Config.SdkVersion,omitempty"` + // Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive + ConfigTimeStep *int `json:"Config.TimeStep,omitempty"` + // The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive + ConfigSkew *int `json:"Config.Skew,omitempty"` + // Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive + ConfigCodeLength *int `json:"Config.CodeLength,omitempty"` + // + ConfigAlg *string `json:"Config.Alg,omitempty"` + // The transport technology used to generate the Notification Token. Can be `apn`, `fcm` or `none`. Required when `factor_type` is `push`. + ConfigNotificationPlatform *string `json:"Config.NotificationPlatform,omitempty"` +} + +func (params *UpdateFactorParams) SetAuthPayload(AuthPayload string) (*UpdateFactorParams){ + params.AuthPayload = &AuthPayload + return params +} +func (params *UpdateFactorParams) SetFriendlyName(FriendlyName string) (*UpdateFactorParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateFactorParams) SetConfigNotificationToken(ConfigNotificationToken string) (*UpdateFactorParams){ + params.ConfigNotificationToken = &ConfigNotificationToken + return params +} +func (params *UpdateFactorParams) SetConfigSdkVersion(ConfigSdkVersion string) (*UpdateFactorParams){ + params.ConfigSdkVersion = &ConfigSdkVersion + return params +} +func (params *UpdateFactorParams) SetConfigTimeStep(ConfigTimeStep int) (*UpdateFactorParams){ + params.ConfigTimeStep = &ConfigTimeStep + return params +} +func (params *UpdateFactorParams) SetConfigSkew(ConfigSkew int) (*UpdateFactorParams){ + params.ConfigSkew = &ConfigSkew + return params +} +func (params *UpdateFactorParams) SetConfigCodeLength(ConfigCodeLength int) (*UpdateFactorParams){ + params.ConfigCodeLength = &ConfigCodeLength + return params +} +func (params *UpdateFactorParams) SetConfigAlg(ConfigAlg string) (*UpdateFactorParams){ + params.ConfigAlg = &ConfigAlg + return params +} +func (params *UpdateFactorParams) SetConfigNotificationPlatform(ConfigNotificationPlatform string) (*UpdateFactorParams){ + params.ConfigNotificationPlatform = &ConfigNotificationPlatform + return params } // Update a specific Factor. This endpoint can be used to Verify a Factor if passed an `AuthPayload` param. func (c *ApiService) UpdateFactor(ServiceSid string, Identity string, Sid string, params *UpdateFactorParams) (*VerifyV2Factor, error) { - path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.AuthPayload != nil { - data.Set("AuthPayload", *params.AuthPayload) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.ConfigNotificationToken != nil { - data.Set("Config.NotificationToken", *params.ConfigNotificationToken) - } - if params != nil && params.ConfigSdkVersion != nil { - data.Set("Config.SdkVersion", *params.ConfigSdkVersion) - } - if params != nil && params.ConfigTimeStep != nil { - data.Set("Config.TimeStep", fmt.Sprint(*params.ConfigTimeStep)) - } - if params != nil && params.ConfigSkew != nil { - data.Set("Config.Skew", fmt.Sprint(*params.ConfigSkew)) - } - if params != nil && params.ConfigCodeLength != nil { - data.Set("Config.CodeLength", fmt.Sprint(*params.ConfigCodeLength)) - } - if params != nil && params.ConfigAlg != nil { - data.Set("Config.Alg", *params.ConfigAlg) - } - if params != nil && params.ConfigNotificationPlatform != nil { - data.Set("Config.NotificationPlatform", *params.ConfigNotificationPlatform) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Factor{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Entities/{Identity}/Factors/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Identity"+"}", Identity, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.AuthPayload != nil { + data.Set("AuthPayload", *params.AuthPayload) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.ConfigNotificationToken != nil { + data.Set("Config.NotificationToken", *params.ConfigNotificationToken) + } + if params != nil && params.ConfigSdkVersion != nil { + data.Set("Config.SdkVersion", *params.ConfigSdkVersion) + } + if params != nil && params.ConfigTimeStep != nil { + data.Set("Config.TimeStep", fmt.Sprint(*params.ConfigTimeStep)) + } + if params != nil && params.ConfigSkew != nil { + data.Set("Config.Skew", fmt.Sprint(*params.ConfigSkew)) + } + if params != nil && params.ConfigCodeLength != nil { + data.Set("Config.CodeLength", fmt.Sprint(*params.ConfigCodeLength)) + } + if params != nil && params.ConfigAlg != nil { + data.Set("Config.Alg", *params.ConfigAlg) + } + if params != nil && params.ConfigNotificationPlatform != nil { + data.Set("Config.NotificationPlatform", *params.ConfigNotificationPlatform) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Factor{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/verify/v2/services_messaging_configurations.go b/rest/verify/v2/services_messaging_configurations.go index 06b8f916a..d814d1034 100644 --- a/rest/verify/v2/services_messaging_configurations.go +++ b/rest/verify/v2/services_messaging_configurations.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateMessagingConfiguration' type CreateMessagingConfigurationParams struct { - // The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. - Country *string `json:"Country,omitempty"` - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. + Country *string `json:"Country,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` } -func (params *CreateMessagingConfigurationParams) SetCountry(Country string) *CreateMessagingConfigurationParams { - params.Country = &Country - return params +func (params *CreateMessagingConfigurationParams) SetCountry(Country string) (*CreateMessagingConfigurationParams){ + params.Country = &Country + return params } -func (params *CreateMessagingConfigurationParams) SetMessagingServiceSid(MessagingServiceSid string) *CreateMessagingConfigurationParams { - params.MessagingServiceSid = &MessagingServiceSid - return params +func (params *CreateMessagingConfigurationParams) SetMessagingServiceSid(MessagingServiceSid string) (*CreateMessagingConfigurationParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params } // Create a new MessagingConfiguration for a service. func (c *ApiService) CreateMessagingConfiguration(ServiceSid string, params *CreateMessagingConfigurationParams) (*VerifyV2MessagingConfiguration, error) { - path := "/v2/Services/{ServiceSid}/MessagingConfigurations" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/MessagingConfigurations" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Country != nil { - data.Set("Country", *params.Country) - } - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } + if params != nil && params.Country != nil { + data.Set("Country", *params.Country) + } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2MessagingConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2MessagingConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific MessagingConfiguration. -func (c *ApiService) DeleteMessagingConfiguration(ServiceSid string, Country string) error { - path := "/v2/Services/{ServiceSid}/MessagingConfigurations/{Country}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Country"+"}", Country, -1) +func (c *ApiService) DeleteMessagingConfiguration(ServiceSid string, Country string, ) (error) { + path := "/v2/Services/{ServiceSid}/MessagingConfigurations/{Country}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Country"+"}", Country, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific MessagingConfiguration. -func (c *ApiService) FetchMessagingConfiguration(ServiceSid string, Country string) (*VerifyV2MessagingConfiguration, error) { - path := "/v2/Services/{ServiceSid}/MessagingConfigurations/{Country}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Country"+"}", Country, -1) +func (c *ApiService) FetchMessagingConfiguration(ServiceSid string, Country string, ) (*VerifyV2MessagingConfiguration, error) { + path := "/v2/Services/{ServiceSid}/MessagingConfigurations/{Country}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Country"+"}", Country, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2MessagingConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &VerifyV2MessagingConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListMessagingConfiguration' type ListMessagingConfigurationParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListMessagingConfigurationParams) SetPageSize(PageSize int) *ListMessagingConfigurationParams { - params.PageSize = &PageSize - return params +func (params *ListMessagingConfigurationParams) SetPageSize(PageSize int) (*ListMessagingConfigurationParams){ + params.PageSize = &PageSize + return params } -func (params *ListMessagingConfigurationParams) SetLimit(Limit int) *ListMessagingConfigurationParams { - params.Limit = &Limit - return params +func (params *ListMessagingConfigurationParams) SetLimit(Limit int) (*ListMessagingConfigurationParams){ + params.Limit = &Limit + return params } // Retrieve a single page of MessagingConfiguration records from the API. Request is executed immediately. func (c *ApiService) PageMessagingConfiguration(ServiceSid string, params *ListMessagingConfigurationParams, pageToken, pageNumber string) (*ListMessagingConfigurationResponse, error) { - path := "/v2/Services/{ServiceSid}/MessagingConfigurations" + path := "/v2/Services/{ServiceSid}/MessagingConfigurations" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListMessagingConfigurationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListMessagingConfigurationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists MessagingConfiguration records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamMessagingConfiguration(ServiceSid string, params *Lis return recordChannel, errorChannel } + func (c *ApiService) streamMessagingConfiguration(response *ListMessagingConfigurationResponse, params *ListMessagingConfigurationParams, recordChannel chan VerifyV2MessagingConfiguration, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamMessagingConfiguration(response *ListMessagingConfigu } func (c *ApiService) getNextListMessagingConfigurationResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListMessagingConfigurationResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListMessagingConfigurationResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateMessagingConfiguration' type UpdateMessagingConfigurationParams struct { - // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. - MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` + // The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration. + MessagingServiceSid *string `json:"MessagingServiceSid,omitempty"` } -func (params *UpdateMessagingConfigurationParams) SetMessagingServiceSid(MessagingServiceSid string) *UpdateMessagingConfigurationParams { - params.MessagingServiceSid = &MessagingServiceSid - return params +func (params *UpdateMessagingConfigurationParams) SetMessagingServiceSid(MessagingServiceSid string) (*UpdateMessagingConfigurationParams){ + params.MessagingServiceSid = &MessagingServiceSid + return params } // Update a specific MessagingConfiguration func (c *ApiService) UpdateMessagingConfiguration(ServiceSid string, Country string, params *UpdateMessagingConfigurationParams) (*VerifyV2MessagingConfiguration, error) { - path := "/v2/Services/{ServiceSid}/MessagingConfigurations/{Country}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Country"+"}", Country, -1) + path := "/v2/Services/{ServiceSid}/MessagingConfigurations/{Country}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Country"+"}", Country, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.MessagingServiceSid != nil { - data.Set("MessagingServiceSid", *params.MessagingServiceSid) - } + if params != nil && params.MessagingServiceSid != nil { + data.Set("MessagingServiceSid", *params.MessagingServiceSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2MessagingConfiguration{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2MessagingConfiguration{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_rate_limits.go b/rest/verify/v2/services_rate_limits.go index 82c83ac73..8661a5d4f 100644 --- a/rest/verify/v2/services_rate_limits.go +++ b/rest/verify/v2/services_rate_limits.go @@ -18,151 +18,156 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRateLimit' type CreateRateLimitParams struct { - // Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** - UniqueName *string `json:"UniqueName,omitempty"` - // Description of this Rate Limit - Description *string `json:"Description,omitempty"` + // Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** + UniqueName *string `json:"UniqueName,omitempty"` + // Description of this Rate Limit + Description *string `json:"Description,omitempty"` } -func (params *CreateRateLimitParams) SetUniqueName(UniqueName string) *CreateRateLimitParams { - params.UniqueName = &UniqueName - return params +func (params *CreateRateLimitParams) SetUniqueName(UniqueName string) (*CreateRateLimitParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateRateLimitParams) SetDescription(Description string) *CreateRateLimitParams { - params.Description = &Description - return params +func (params *CreateRateLimitParams) SetDescription(Description string) (*CreateRateLimitParams){ + params.Description = &Description + return params } // Create a new Rate Limit for a Service func (c *ApiService) CreateRateLimit(ServiceSid string, params *CreateRateLimitParams) (*VerifyV2RateLimit, error) { - path := "/v2/Services/{ServiceSid}/RateLimits" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/RateLimits" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2RateLimit{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2RateLimit{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Rate Limit. -func (c *ApiService) DeleteRateLimit(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/RateLimits/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteRateLimit(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/RateLimits/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific Rate Limit. -func (c *ApiService) FetchRateLimit(ServiceSid string, Sid string) (*VerifyV2RateLimit, error) { - path := "/v2/Services/{ServiceSid}/RateLimits/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchRateLimit(ServiceSid string, Sid string, ) (*VerifyV2RateLimit, error) { + path := "/v2/Services/{ServiceSid}/RateLimits/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2RateLimit{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &VerifyV2RateLimit{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRateLimit' type ListRateLimitParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRateLimitParams) SetPageSize(PageSize int) *ListRateLimitParams { - params.PageSize = &PageSize - return params +func (params *ListRateLimitParams) SetPageSize(PageSize int) (*ListRateLimitParams){ + params.PageSize = &PageSize + return params } -func (params *ListRateLimitParams) SetLimit(Limit int) *ListRateLimitParams { - params.Limit = &Limit - return params +func (params *ListRateLimitParams) SetLimit(Limit int) (*ListRateLimitParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RateLimit records from the API. Request is executed immediately. func (c *ApiService) PageRateLimit(ServiceSid string, params *ListRateLimitParams, pageToken, pageNumber string) (*ListRateLimitResponse, error) { - path := "/v2/Services/{ServiceSid}/RateLimits" + path := "/v2/Services/{ServiceSid}/RateLimits" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRateLimitResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRateLimitResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RateLimit records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -203,6 +208,7 @@ func (c *ApiService) StreamRateLimit(ServiceSid string, params *ListRateLimitPar return recordChannel, errorChannel } + func (c *ApiService) streamRateLimit(response *ListRateLimitResponse, params *ListRateLimitParams, recordChannel chan VerifyV2RateLimit, errorChannel chan error) { curRecord := 1 @@ -234,58 +240,60 @@ func (c *ApiService) streamRateLimit(response *ListRateLimitResponse, params *Li } func (c *ApiService) getNextListRateLimitResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRateLimitResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRateLimitResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRateLimit' type UpdateRateLimitParams struct { - // Description of this Rate Limit - Description *string `json:"Description,omitempty"` + // Description of this Rate Limit + Description *string `json:"Description,omitempty"` } -func (params *UpdateRateLimitParams) SetDescription(Description string) *UpdateRateLimitParams { - params.Description = &Description - return params +func (params *UpdateRateLimitParams) SetDescription(Description string) (*UpdateRateLimitParams){ + params.Description = &Description + return params } // Update a specific Rate Limit. func (c *ApiService) UpdateRateLimit(ServiceSid string, Sid string, params *UpdateRateLimitParams) (*VerifyV2RateLimit, error) { - path := "/v2/Services/{ServiceSid}/RateLimits/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/RateLimits/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Description != nil { - data.Set("Description", *params.Description) - } + if params != nil && params.Description != nil { + data.Set("Description", *params.Description) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2RateLimit{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2RateLimit{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_rate_limits_buckets.go b/rest/verify/v2/services_rate_limits_buckets.go index 1eb51fac3..54fa3ff84 100644 --- a/rest/verify/v2/services_rate_limits_buckets.go +++ b/rest/verify/v2/services_rate_limits_buckets.go @@ -18,155 +18,160 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateBucket' type CreateBucketParams struct { - // Maximum number of requests permitted in during the interval. - Max *int `json:"Max,omitempty"` - // Number of seconds that the rate limit will be enforced over. - Interval *int `json:"Interval,omitempty"` + // Maximum number of requests permitted in during the interval. + Max *int `json:"Max,omitempty"` + // Number of seconds that the rate limit will be enforced over. + Interval *int `json:"Interval,omitempty"` } -func (params *CreateBucketParams) SetMax(Max int) *CreateBucketParams { - params.Max = &Max - return params +func (params *CreateBucketParams) SetMax(Max int) (*CreateBucketParams){ + params.Max = &Max + return params } -func (params *CreateBucketParams) SetInterval(Interval int) *CreateBucketParams { - params.Interval = &Interval - return params +func (params *CreateBucketParams) SetInterval(Interval int) (*CreateBucketParams){ + params.Interval = &Interval + return params } // Create a new Bucket for a Rate Limit func (c *ApiService) CreateBucket(ServiceSid string, RateLimitSid string, params *CreateBucketParams) (*VerifyV2Bucket, error) { - path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) + path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Max != nil { - data.Set("Max", fmt.Sprint(*params.Max)) - } - if params != nil && params.Interval != nil { - data.Set("Interval", fmt.Sprint(*params.Interval)) - } + if params != nil && params.Max != nil { + data.Set("Max", fmt.Sprint(*params.Max)) + } + if params != nil && params.Interval != nil { + data.Set("Interval", fmt.Sprint(*params.Interval)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2Bucket{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2Bucket{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Delete a specific Bucket. -func (c *ApiService) DeleteBucket(ServiceSid string, RateLimitSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteBucket(ServiceSid string, RateLimitSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } // Fetch a specific Bucket. -func (c *ApiService) FetchBucket(ServiceSid string, RateLimitSid string, Sid string) (*VerifyV2Bucket, error) { - path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchBucket(ServiceSid string, RateLimitSid string, Sid string, ) (*VerifyV2Bucket, error) { + path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2Bucket{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &VerifyV2Bucket{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListBucket' type ListBucketParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListBucketParams) SetPageSize(PageSize int) *ListBucketParams { - params.PageSize = &PageSize - return params +func (params *ListBucketParams) SetPageSize(PageSize int) (*ListBucketParams){ + params.PageSize = &PageSize + return params } -func (params *ListBucketParams) SetLimit(Limit int) *ListBucketParams { - params.Limit = &Limit - return params +func (params *ListBucketParams) SetLimit(Limit int) (*ListBucketParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Bucket records from the API. Request is executed immediately. func (c *ApiService) PageBucket(ServiceSid string, RateLimitSid string, params *ListBucketParams, pageToken, pageNumber string) (*ListBucketResponse, error) { - path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets" + path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListBucketResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListBucketResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Bucket records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +212,7 @@ func (c *ApiService) StreamBucket(ServiceSid string, RateLimitSid string, params return recordChannel, errorChannel } + func (c *ApiService) streamBucket(response *ListBucketResponse, params *ListBucketParams, recordChannel chan VerifyV2Bucket, errorChannel chan error) { curRecord := 1 @@ -238,68 +244,70 @@ func (c *ApiService) streamBucket(response *ListBucketResponse, params *ListBuck } func (c *ApiService) getNextListBucketResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListBucketResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListBucketResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateBucket' type UpdateBucketParams struct { - // Maximum number of requests permitted in during the interval. - Max *int `json:"Max,omitempty"` - // Number of seconds that the rate limit will be enforced over. - Interval *int `json:"Interval,omitempty"` + // Maximum number of requests permitted in during the interval. + Max *int `json:"Max,omitempty"` + // Number of seconds that the rate limit will be enforced over. + Interval *int `json:"Interval,omitempty"` } -func (params *UpdateBucketParams) SetMax(Max int) *UpdateBucketParams { - params.Max = &Max - return params +func (params *UpdateBucketParams) SetMax(Max int) (*UpdateBucketParams){ + params.Max = &Max + return params } -func (params *UpdateBucketParams) SetInterval(Interval int) *UpdateBucketParams { - params.Interval = &Interval - return params +func (params *UpdateBucketParams) SetInterval(Interval int) (*UpdateBucketParams){ + params.Interval = &Interval + return params } // Update a specific Bucket. func (c *ApiService) UpdateBucket(ServiceSid string, RateLimitSid string, Sid string, params *UpdateBucketParams) (*VerifyV2Bucket, error) { - path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/RateLimits/{RateLimitSid}/Buckets/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"RateLimitSid"+"}", RateLimitSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Max != nil { - data.Set("Max", fmt.Sprint(*params.Max)) - } - if params != nil && params.Interval != nil { - data.Set("Interval", fmt.Sprint(*params.Interval)) - } + if params != nil && params.Max != nil { + data.Set("Max", fmt.Sprint(*params.Max)) + } + if params != nil && params.Interval != nil { + data.Set("Interval", fmt.Sprint(*params.Interval)) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2Bucket{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VerifyV2Bucket{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_verification_check.go b/rest/verify/v2/services_verification_check.go index 0f2caad79..452870de0 100644 --- a/rest/verify/v2/services_verification_check.go +++ b/rest/verify/v2/services_verification_check.go @@ -16,80 +16,84 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateVerificationCheck' type CreateVerificationCheckParams struct { - // The 4-10 character string being verified. - Code *string `json:"Code,omitempty"` - // The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Either this parameter or the `verification_sid` must be specified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - To *string `json:"To,omitempty"` - // A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. - VerificationSid *string `json:"VerificationSid,omitempty"` - // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - Amount *string `json:"Amount,omitempty"` - // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - Payee *string `json:"Payee,omitempty"` + // The 4-10 character string being verified. + Code *string `json:"Code,omitempty"` + // The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Either this parameter or the `verification_sid` must be specified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + To *string `json:"To,omitempty"` + // A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. + VerificationSid *string `json:"VerificationSid,omitempty"` + // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + Amount *string `json:"Amount,omitempty"` + // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + Payee *string `json:"Payee,omitempty"` } -func (params *CreateVerificationCheckParams) SetCode(Code string) *CreateVerificationCheckParams { - params.Code = &Code - return params +func (params *CreateVerificationCheckParams) SetCode(Code string) (*CreateVerificationCheckParams){ + params.Code = &Code + return params } -func (params *CreateVerificationCheckParams) SetTo(To string) *CreateVerificationCheckParams { - params.To = &To - return params +func (params *CreateVerificationCheckParams) SetTo(To string) (*CreateVerificationCheckParams){ + params.To = &To + return params } -func (params *CreateVerificationCheckParams) SetVerificationSid(VerificationSid string) *CreateVerificationCheckParams { - params.VerificationSid = &VerificationSid - return params +func (params *CreateVerificationCheckParams) SetVerificationSid(VerificationSid string) (*CreateVerificationCheckParams){ + params.VerificationSid = &VerificationSid + return params } -func (params *CreateVerificationCheckParams) SetAmount(Amount string) *CreateVerificationCheckParams { - params.Amount = &Amount - return params +func (params *CreateVerificationCheckParams) SetAmount(Amount string) (*CreateVerificationCheckParams){ + params.Amount = &Amount + return params } -func (params *CreateVerificationCheckParams) SetPayee(Payee string) *CreateVerificationCheckParams { - params.Payee = &Payee - return params +func (params *CreateVerificationCheckParams) SetPayee(Payee string) (*CreateVerificationCheckParams){ + params.Payee = &Payee + return params } // challenge a specific Verification Check. func (c *ApiService) CreateVerificationCheck(ServiceSid string, params *CreateVerificationCheckParams) (*VerifyV2VerificationCheck, error) { - path := "/v2/Services/{ServiceSid}/VerificationCheck" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path := "/v2/Services/{ServiceSid}/VerificationCheck" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Code != nil { + data.Set("Code", *params.Code) + } + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.VerificationSid != nil { + data.Set("VerificationSid", *params.VerificationSid) + } + if params != nil && params.Amount != nil { + data.Set("Amount", *params.Amount) + } + if params != nil && params.Payee != nil { + data.Set("Payee", *params.Payee) + } - if params != nil && params.Code != nil { - data.Set("Code", *params.Code) - } - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.VerificationSid != nil { - data.Set("VerificationSid", *params.VerificationSid) - } - if params != nil && params.Amount != nil { - data.Set("Amount", *params.Amount) - } - if params != nil && params.Payee != nil { - data.Set("Payee", *params.Payee) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2VerificationCheck{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2VerificationCheck{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_verifications.go b/rest/verify/v2/services_verifications.go index efa4a82e0..0b7adb2cc 100644 --- a/rest/verify/v2/services_verifications.go +++ b/rest/verify/v2/services_verifications.go @@ -16,254 +16,261 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateVerification' type CreateVerificationParams struct { - // The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - To *string `json:"To,omitempty"` - // The verification method to use. One of: [`email`](https://www.twilio.com/docs/verify/email), `sms`, `whatsapp`, `call`, `sna` or `auto`. - Channel *string `json:"Channel,omitempty"` - // A custom user defined friendly name that overwrites the existing one in the verification message - CustomFriendlyName *string `json:"CustomFriendlyName,omitempty"` - // The text of a custom message to use for the verification. - CustomMessage *string `json:"CustomMessage,omitempty"` - // The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of [sendDigits](https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits). - SendDigits *string `json:"SendDigits,omitempty"` - // Locale will automatically resolve based on phone number country code for SMS, WhatsApp, and call channel verifications. It will fallback to English or the template’s default translation if the selected translation is not available. This parameter will override the automatic locale resolution. [See supported languages and more information here](https://www.twilio.com/docs/verify/supported-languages). - Locale *string `json:"Locale,omitempty"` - // A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive. - CustomCode *string `json:"CustomCode,omitempty"` - // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - Amount *string `json:"Amount,omitempty"` - // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - Payee *string `json:"Payee,omitempty"` - // The custom key-value pairs of Programmable Rate Limits. Keys correspond to `unique_name` fields defined when [creating your Rate Limit](https://www.twilio.com/docs/verify/api/service-rate-limits). Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request. - RateLimits *interface{} `json:"RateLimits,omitempty"` - // [`email`](https://www.twilio.com/docs/verify/email) channel configuration in json format. The fields 'from' and 'from_name' are optional but if included the 'from' field must have a valid email address. - ChannelConfiguration *interface{} `json:"ChannelConfiguration,omitempty"` - // Your [App Hash](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string) to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: `<#> Your AppName verification code is: 1234 He42w354ol9`. - AppHash *string `json:"AppHash,omitempty"` - // The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only. - TemplateSid *string `json:"TemplateSid,omitempty"` - // A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions. - TemplateCustomSubstitutions *string `json:"TemplateCustomSubstitutions,omitempty"` - // Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address. - DeviceIp *string `json:"DeviceIp,omitempty"` - // - RiskCheck *string `json:"RiskCheck,omitempty"` + // The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + To *string `json:"To,omitempty"` + // The verification method to use. One of: [`email`](https://www.twilio.com/docs/verify/email), `sms`, `whatsapp`, `call`, `sna` or `auto`. + Channel *string `json:"Channel,omitempty"` + // A custom user defined friendly name that overwrites the existing one in the verification message + CustomFriendlyName *string `json:"CustomFriendlyName,omitempty"` + // The text of a custom message to use for the verification. + CustomMessage *string `json:"CustomMessage,omitempty"` + // The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of [sendDigits](https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits). + SendDigits *string `json:"SendDigits,omitempty"` + // Locale will automatically resolve based on phone number country code for SMS, WhatsApp, and call channel verifications. It will fallback to English or the template’s default translation if the selected translation is not available. This parameter will override the automatic locale resolution. [See supported languages and more information here](https://www.twilio.com/docs/verify/supported-languages). + Locale *string `json:"Locale,omitempty"` + // A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive. + CustomCode *string `json:"CustomCode,omitempty"` + // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + Amount *string `json:"Amount,omitempty"` + // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + Payee *string `json:"Payee,omitempty"` + // The custom key-value pairs of Programmable Rate Limits. Keys correspond to `unique_name` fields defined when [creating your Rate Limit](https://www.twilio.com/docs/verify/api/service-rate-limits). Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request. + RateLimits *interface{} `json:"RateLimits,omitempty"` + // [`email`](https://www.twilio.com/docs/verify/email) channel configuration in json format. The fields 'from' and 'from_name' are optional but if included the 'from' field must have a valid email address. + ChannelConfiguration *interface{} `json:"ChannelConfiguration,omitempty"` + // Your [App Hash](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string) to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: `<#> Your AppName verification code is: 1234 He42w354ol9`. + AppHash *string `json:"AppHash,omitempty"` + // The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS and Voice channels only. + TemplateSid *string `json:"TemplateSid,omitempty"` + // A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions. + TemplateCustomSubstitutions *string `json:"TemplateCustomSubstitutions,omitempty"` + // Strongly encouraged if using the auto channel. The IP address of the client's device. If provided, it has to be a valid IPv4 or IPv6 address. + DeviceIp *string `json:"DeviceIp,omitempty"` + // + RiskCheck *string `json:"RiskCheck,omitempty"` } -func (params *CreateVerificationParams) SetTo(To string) *CreateVerificationParams { - params.To = &To - return params +func (params *CreateVerificationParams) SetTo(To string) (*CreateVerificationParams){ + params.To = &To + return params } -func (params *CreateVerificationParams) SetChannel(Channel string) *CreateVerificationParams { - params.Channel = &Channel - return params +func (params *CreateVerificationParams) SetChannel(Channel string) (*CreateVerificationParams){ + params.Channel = &Channel + return params } -func (params *CreateVerificationParams) SetCustomFriendlyName(CustomFriendlyName string) *CreateVerificationParams { - params.CustomFriendlyName = &CustomFriendlyName - return params +func (params *CreateVerificationParams) SetCustomFriendlyName(CustomFriendlyName string) (*CreateVerificationParams){ + params.CustomFriendlyName = &CustomFriendlyName + return params } -func (params *CreateVerificationParams) SetCustomMessage(CustomMessage string) *CreateVerificationParams { - params.CustomMessage = &CustomMessage - return params +func (params *CreateVerificationParams) SetCustomMessage(CustomMessage string) (*CreateVerificationParams){ + params.CustomMessage = &CustomMessage + return params } -func (params *CreateVerificationParams) SetSendDigits(SendDigits string) *CreateVerificationParams { - params.SendDigits = &SendDigits - return params +func (params *CreateVerificationParams) SetSendDigits(SendDigits string) (*CreateVerificationParams){ + params.SendDigits = &SendDigits + return params } -func (params *CreateVerificationParams) SetLocale(Locale string) *CreateVerificationParams { - params.Locale = &Locale - return params +func (params *CreateVerificationParams) SetLocale(Locale string) (*CreateVerificationParams){ + params.Locale = &Locale + return params } -func (params *CreateVerificationParams) SetCustomCode(CustomCode string) *CreateVerificationParams { - params.CustomCode = &CustomCode - return params +func (params *CreateVerificationParams) SetCustomCode(CustomCode string) (*CreateVerificationParams){ + params.CustomCode = &CustomCode + return params } -func (params *CreateVerificationParams) SetAmount(Amount string) *CreateVerificationParams { - params.Amount = &Amount - return params +func (params *CreateVerificationParams) SetAmount(Amount string) (*CreateVerificationParams){ + params.Amount = &Amount + return params } -func (params *CreateVerificationParams) SetPayee(Payee string) *CreateVerificationParams { - params.Payee = &Payee - return params +func (params *CreateVerificationParams) SetPayee(Payee string) (*CreateVerificationParams){ + params.Payee = &Payee + return params } -func (params *CreateVerificationParams) SetRateLimits(RateLimits interface{}) *CreateVerificationParams { - params.RateLimits = &RateLimits - return params +func (params *CreateVerificationParams) SetRateLimits(RateLimits interface{}) (*CreateVerificationParams){ + params.RateLimits = &RateLimits + return params } -func (params *CreateVerificationParams) SetChannelConfiguration(ChannelConfiguration interface{}) *CreateVerificationParams { - params.ChannelConfiguration = &ChannelConfiguration - return params +func (params *CreateVerificationParams) SetChannelConfiguration(ChannelConfiguration interface{}) (*CreateVerificationParams){ + params.ChannelConfiguration = &ChannelConfiguration + return params } -func (params *CreateVerificationParams) SetAppHash(AppHash string) *CreateVerificationParams { - params.AppHash = &AppHash - return params +func (params *CreateVerificationParams) SetAppHash(AppHash string) (*CreateVerificationParams){ + params.AppHash = &AppHash + return params } -func (params *CreateVerificationParams) SetTemplateSid(TemplateSid string) *CreateVerificationParams { - params.TemplateSid = &TemplateSid - return params +func (params *CreateVerificationParams) SetTemplateSid(TemplateSid string) (*CreateVerificationParams){ + params.TemplateSid = &TemplateSid + return params } -func (params *CreateVerificationParams) SetTemplateCustomSubstitutions(TemplateCustomSubstitutions string) *CreateVerificationParams { - params.TemplateCustomSubstitutions = &TemplateCustomSubstitutions - return params +func (params *CreateVerificationParams) SetTemplateCustomSubstitutions(TemplateCustomSubstitutions string) (*CreateVerificationParams){ + params.TemplateCustomSubstitutions = &TemplateCustomSubstitutions + return params } -func (params *CreateVerificationParams) SetDeviceIp(DeviceIp string) *CreateVerificationParams { - params.DeviceIp = &DeviceIp - return params +func (params *CreateVerificationParams) SetDeviceIp(DeviceIp string) (*CreateVerificationParams){ + params.DeviceIp = &DeviceIp + return params } -func (params *CreateVerificationParams) SetRiskCheck(RiskCheck string) *CreateVerificationParams { - params.RiskCheck = &RiskCheck - return params +func (params *CreateVerificationParams) SetRiskCheck(RiskCheck string) (*CreateVerificationParams){ + params.RiskCheck = &RiskCheck + return params } // Create a new Verification using a Service func (c *ApiService) CreateVerification(ServiceSid string, params *CreateVerificationParams) (*VerifyV2Verification, error) { - path := "/v2/Services/{ServiceSid}/Verifications" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.To != nil { - data.Set("To", *params.To) - } - if params != nil && params.Channel != nil { - data.Set("Channel", *params.Channel) - } - if params != nil && params.CustomFriendlyName != nil { - data.Set("CustomFriendlyName", *params.CustomFriendlyName) - } - if params != nil && params.CustomMessage != nil { - data.Set("CustomMessage", *params.CustomMessage) - } - if params != nil && params.SendDigits != nil { - data.Set("SendDigits", *params.SendDigits) - } - if params != nil && params.Locale != nil { - data.Set("Locale", *params.Locale) - } - if params != nil && params.CustomCode != nil { - data.Set("CustomCode", *params.CustomCode) - } - if params != nil && params.Amount != nil { - data.Set("Amount", *params.Amount) - } - if params != nil && params.Payee != nil { - data.Set("Payee", *params.Payee) - } - if params != nil && params.RateLimits != nil { - v, err := json.Marshal(params.RateLimits) - - if err != nil { - return nil, err - } - - data.Set("RateLimits", string(v)) - } - if params != nil && params.ChannelConfiguration != nil { - v, err := json.Marshal(params.ChannelConfiguration) - - if err != nil { - return nil, err - } - - data.Set("ChannelConfiguration", string(v)) - } - if params != nil && params.AppHash != nil { - data.Set("AppHash", *params.AppHash) - } - if params != nil && params.TemplateSid != nil { - data.Set("TemplateSid", *params.TemplateSid) - } - if params != nil && params.TemplateCustomSubstitutions != nil { - data.Set("TemplateCustomSubstitutions", *params.TemplateCustomSubstitutions) - } - if params != nil && params.DeviceIp != nil { - data.Set("DeviceIp", *params.DeviceIp) - } - if params != nil && params.RiskCheck != nil { - data.Set("RiskCheck", *params.RiskCheck) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Verification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Verifications" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.To != nil { + data.Set("To", *params.To) + } + if params != nil && params.Channel != nil { + data.Set("Channel", *params.Channel) + } + if params != nil && params.CustomFriendlyName != nil { + data.Set("CustomFriendlyName", *params.CustomFriendlyName) + } + if params != nil && params.CustomMessage != nil { + data.Set("CustomMessage", *params.CustomMessage) + } + if params != nil && params.SendDigits != nil { + data.Set("SendDigits", *params.SendDigits) + } + if params != nil && params.Locale != nil { + data.Set("Locale", *params.Locale) + } + if params != nil && params.CustomCode != nil { + data.Set("CustomCode", *params.CustomCode) + } + if params != nil && params.Amount != nil { + data.Set("Amount", *params.Amount) + } + if params != nil && params.Payee != nil { + data.Set("Payee", *params.Payee) + } + if params != nil && params.RateLimits != nil { + v, err := json.Marshal(params.RateLimits) + + if err != nil { + return nil, err + } + + data.Set("RateLimits", string(v)) + } + if params != nil && params.ChannelConfiguration != nil { + v, err := json.Marshal(params.ChannelConfiguration) + + if err != nil { + return nil, err + } + + data.Set("ChannelConfiguration", string(v)) + } + if params != nil && params.AppHash != nil { + data.Set("AppHash", *params.AppHash) + } + if params != nil && params.TemplateSid != nil { + data.Set("TemplateSid", *params.TemplateSid) + } + if params != nil && params.TemplateCustomSubstitutions != nil { + data.Set("TemplateCustomSubstitutions", *params.TemplateCustomSubstitutions) + } + if params != nil && params.DeviceIp != nil { + data.Set("DeviceIp", *params.DeviceIp) + } + if params != nil && params.RiskCheck != nil { + data.Set("RiskCheck", *params.RiskCheck) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Verification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Fetch a specific Verification -func (c *ApiService) FetchVerification(ServiceSid string, Sid string) (*VerifyV2Verification, error) { - path := "/v2/Services/{ServiceSid}/Verifications/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchVerification(ServiceSid string, Sid string, ) (*VerifyV2Verification, error) { + path := "/v2/Services/{ServiceSid}/Verifications/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VerifyV2Verification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &VerifyV2Verification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateVerification' type UpdateVerificationParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateVerificationParams) SetStatus(Status string) *UpdateVerificationParams { - params.Status = &Status - return params +func (params *UpdateVerificationParams) SetStatus(Status string) (*UpdateVerificationParams){ + params.Status = &Status + return params } // Update a Verification status func (c *ApiService) UpdateVerification(ServiceSid string, Sid string, params *UpdateVerificationParams) (*VerifyV2Verification, error) { - path := "/v2/Services/{ServiceSid}/Verifications/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v2/Services/{ServiceSid}/Verifications/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VerifyV2Verification{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VerifyV2Verification{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/verify/v2/services_webhooks.go b/rest/verify/v2/services_webhooks.go index 46dd9318c..d23c9ca90 100644 --- a/rest/verify/v2/services_webhooks.go +++ b/rest/verify/v2/services_webhooks.go @@ -18,180 +18,185 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateWebhook' type CreateWebhookParams struct { - // The string that you assigned to describe the webhook. **This value should not contain PII.** - FriendlyName *string `json:"FriendlyName,omitempty"` - // The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` - EventTypes *[]string `json:"EventTypes,omitempty"` - // The URL associated with this Webhook. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // - Status *string `json:"Status,omitempty"` - // - Version *string `json:"Version,omitempty"` + // The string that you assigned to describe the webhook. **This value should not contain PII.** + FriendlyName *string `json:"FriendlyName,omitempty"` + // The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` + EventTypes *[]string `json:"EventTypes,omitempty"` + // The URL associated with this Webhook. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // + Status *string `json:"Status,omitempty"` + // + Version *string `json:"Version,omitempty"` } -func (params *CreateWebhookParams) SetFriendlyName(FriendlyName string) *CreateWebhookParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateWebhookParams) SetFriendlyName(FriendlyName string) (*CreateWebhookParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateWebhookParams) SetEventTypes(EventTypes []string) *CreateWebhookParams { - params.EventTypes = &EventTypes - return params +func (params *CreateWebhookParams) SetEventTypes(EventTypes []string) (*CreateWebhookParams){ + params.EventTypes = &EventTypes + return params } -func (params *CreateWebhookParams) SetWebhookUrl(WebhookUrl string) *CreateWebhookParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *CreateWebhookParams) SetWebhookUrl(WebhookUrl string) (*CreateWebhookParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *CreateWebhookParams) SetStatus(Status string) *CreateWebhookParams { - params.Status = &Status - return params +func (params *CreateWebhookParams) SetStatus(Status string) (*CreateWebhookParams){ + params.Status = &Status + return params } -func (params *CreateWebhookParams) SetVersion(Version string) *CreateWebhookParams { - params.Version = &Version - return params +func (params *CreateWebhookParams) SetVersion(Version string) (*CreateWebhookParams){ + params.Version = &Version + return params } // Create a new Webhook for the Service func (c *ApiService) CreateWebhook(ServiceSid string, params *CreateWebhookParams) (*VerifyV2Webhook, error) { - path := "/v2/Services/{ServiceSid}/Webhooks" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.EventTypes != nil { - for _, item := range *params.EventTypes { - data.Add("EventTypes", item) - } - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Version != nil { - data.Set("Version", *params.Version) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Webhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Webhooks" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.EventTypes != nil { + for _, item := range *params.EventTypes { + data.Add("EventTypes", item) + } + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Version != nil { + data.Set("Version", *params.Version) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Webhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a specific Webhook. -func (c *ApiService) DeleteWebhook(ServiceSid string, Sid string) error { - path := "/v2/Services/{ServiceSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteWebhook(ServiceSid string, Sid string, ) (error) { + path := "/v2/Services/{ServiceSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a specific Webhook. -func (c *ApiService) FetchWebhook(ServiceSid string, Sid string) (*VerifyV2Webhook, error) { - path := "/v2/Services/{ServiceSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchWebhook(ServiceSid string, Sid string, ) (*VerifyV2Webhook, error) { + path := "/v2/Services/{ServiceSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VerifyV2Webhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VerifyV2Webhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListWebhook' type ListWebhookParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListWebhookParams) SetPageSize(PageSize int) *ListWebhookParams { - params.PageSize = &PageSize - return params +func (params *ListWebhookParams) SetPageSize(PageSize int) (*ListWebhookParams){ + params.PageSize = &PageSize + return params } -func (params *ListWebhookParams) SetLimit(Limit int) *ListWebhookParams { - params.Limit = &Limit - return params +func (params *ListWebhookParams) SetLimit(Limit int) (*ListWebhookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Webhook records from the API. Request is executed immediately. func (c *ApiService) PageWebhook(ServiceSid string, params *ListWebhookParams, pageToken, pageNumber string) (*ListWebhookResponse, error) { - path := "/v2/Services/{ServiceSid}/Webhooks" + path := "/v2/Services/{ServiceSid}/Webhooks" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists Webhook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -232,6 +237,7 @@ func (c *ApiService) StreamWebhook(ServiceSid string, params *ListWebhookParams) return recordChannel, errorChannel } + func (c *ApiService) streamWebhook(response *ListWebhookResponse, params *ListWebhookParams, recordChannel chan VerifyV2Webhook, errorChannel chan error) { curRecord := 1 @@ -263,96 +269,98 @@ func (c *ApiService) streamWebhook(response *ListWebhookResponse, params *ListWe } func (c *ApiService) getNextListWebhookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListWebhookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListWebhookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateWebhook' type UpdateWebhookParams struct { - // The string that you assigned to describe the webhook. **This value should not contain PII.** - FriendlyName *string `json:"FriendlyName,omitempty"` - // The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` - EventTypes *[]string `json:"EventTypes,omitempty"` - // The URL associated with this Webhook. - WebhookUrl *string `json:"WebhookUrl,omitempty"` - // - Status *string `json:"Status,omitempty"` - // - Version *string `json:"Version,omitempty"` + // The string that you assigned to describe the webhook. **This value should not contain PII.** + FriendlyName *string `json:"FriendlyName,omitempty"` + // The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` + EventTypes *[]string `json:"EventTypes,omitempty"` + // The URL associated with this Webhook. + WebhookUrl *string `json:"WebhookUrl,omitempty"` + // + Status *string `json:"Status,omitempty"` + // + Version *string `json:"Version,omitempty"` } -func (params *UpdateWebhookParams) SetFriendlyName(FriendlyName string) *UpdateWebhookParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateWebhookParams) SetFriendlyName(FriendlyName string) (*UpdateWebhookParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateWebhookParams) SetEventTypes(EventTypes []string) *UpdateWebhookParams { - params.EventTypes = &EventTypes - return params +func (params *UpdateWebhookParams) SetEventTypes(EventTypes []string) (*UpdateWebhookParams){ + params.EventTypes = &EventTypes + return params } -func (params *UpdateWebhookParams) SetWebhookUrl(WebhookUrl string) *UpdateWebhookParams { - params.WebhookUrl = &WebhookUrl - return params +func (params *UpdateWebhookParams) SetWebhookUrl(WebhookUrl string) (*UpdateWebhookParams){ + params.WebhookUrl = &WebhookUrl + return params } -func (params *UpdateWebhookParams) SetStatus(Status string) *UpdateWebhookParams { - params.Status = &Status - return params +func (params *UpdateWebhookParams) SetStatus(Status string) (*UpdateWebhookParams){ + params.Status = &Status + return params } -func (params *UpdateWebhookParams) SetVersion(Version string) *UpdateWebhookParams { - params.Version = &Version - return params +func (params *UpdateWebhookParams) SetVersion(Version string) (*UpdateWebhookParams){ + params.Version = &Version + return params } -// +// func (c *ApiService) UpdateWebhook(ServiceSid string, Sid string, params *UpdateWebhookParams) (*VerifyV2Webhook, error) { - path := "/v2/Services/{ServiceSid}/Webhooks/{Sid}" - path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.EventTypes != nil { - for _, item := range *params.EventTypes { - data.Add("EventTypes", item) - } - } - if params != nil && params.WebhookUrl != nil { - data.Set("WebhookUrl", *params.WebhookUrl) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Version != nil { - data.Set("Version", *params.Version) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VerifyV2Webhook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Services/{ServiceSid}/Webhooks/{Sid}" + path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.EventTypes != nil { + for _, item := range *params.EventTypes { + data.Add("EventTypes", item) + } + } + if params != nil && params.WebhookUrl != nil { + data.Set("WebhookUrl", *params.WebhookUrl) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Version != nil { + data.Set("Version", *params.Version) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VerifyV2Webhook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/verify/v2/templates.go b/rest/verify/v2/templates.go index ef868baca..cbe435f67 100644 --- a/rest/verify/v2/templates.go +++ b/rest/verify/v2/templates.go @@ -19,66 +19,68 @@ import ( "fmt" "net/url" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListVerificationTemplate' type ListVerificationTemplateParams struct { - // String filter used to query templates with a given friendly name. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // String filter used to query templates with a given friendly name. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListVerificationTemplateParams) SetFriendlyName(FriendlyName string) *ListVerificationTemplateParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListVerificationTemplateParams) SetFriendlyName(FriendlyName string) (*ListVerificationTemplateParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListVerificationTemplateParams) SetPageSize(PageSize int) *ListVerificationTemplateParams { - params.PageSize = &PageSize - return params +func (params *ListVerificationTemplateParams) SetPageSize(PageSize int) (*ListVerificationTemplateParams){ + params.PageSize = &PageSize + return params } -func (params *ListVerificationTemplateParams) SetLimit(Limit int) *ListVerificationTemplateParams { - params.Limit = &Limit - return params +func (params *ListVerificationTemplateParams) SetLimit(Limit int) (*ListVerificationTemplateParams){ + params.Limit = &Limit + return params } // Retrieve a single page of VerificationTemplate records from the API. Request is executed immediately. func (c *ApiService) PageVerificationTemplate(params *ListVerificationTemplateParams, pageToken, pageNumber string) (*ListVerificationTemplateResponse, error) { - path := "/v2/Templates" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVerificationTemplateResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v2/Templates" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVerificationTemplateResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists VerificationTemplate records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -119,6 +121,7 @@ func (c *ApiService) StreamVerificationTemplate(params *ListVerificationTemplate return recordChannel, errorChannel } + func (c *ApiService) streamVerificationTemplate(response *ListVerificationTemplateResponse, params *ListVerificationTemplateParams, recordChannel chan VerifyV2VerificationTemplate, errorChannel chan error) { curRecord := 1 @@ -150,19 +153,20 @@ func (c *ApiService) streamVerificationTemplate(response *ListVerificationTempla } func (c *ApiService) getNextListVerificationTemplateResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListVerificationTemplateResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListVerificationTemplateResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/video/v1/README.md b/rest/video/v1/README.md index c86b658ef..75ddbc8ea 100644 --- a/rest/video/v1/README.md +++ b/rest/video/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/video/v1/api_service.go b/rest/video/v1/api_service.go index e5f66e599..02455bd73 100644 --- a/rest/video/v1/api_service.go +++ b/rest/video/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://video.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/video/v1/composition_hooks.go b/rest/video/v1/composition_hooks.go index a7a824e18..fd0add18b 100644 --- a/rest/video/v1/composition_hooks.go +++ b/rest/video/v1/composition_hooks.go @@ -18,265 +18,270 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCompositionHook' type CreateCompositionHookParams struct { - // A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook will never be triggered. - Enabled *bool `json:"Enabled,omitempty"` - // An object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - VideoLayout *interface{} `json:"VideoLayout,omitempty"` - // An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. - AudioSources *[]string `json:"AudioSources,omitempty"` - // An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"` - // A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Resolution *string `json:"Resolution,omitempty"` - // - Format *string `json:"Format,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Trim *bool `json:"Trim,omitempty"` -} - -func (params *CreateCompositionHookParams) SetFriendlyName(FriendlyName string) *CreateCompositionHookParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateCompositionHookParams) SetEnabled(Enabled bool) *CreateCompositionHookParams { - params.Enabled = &Enabled - return params -} -func (params *CreateCompositionHookParams) SetVideoLayout(VideoLayout interface{}) *CreateCompositionHookParams { - params.VideoLayout = &VideoLayout - return params -} -func (params *CreateCompositionHookParams) SetAudioSources(AudioSources []string) *CreateCompositionHookParams { - params.AudioSources = &AudioSources - return params -} -func (params *CreateCompositionHookParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) *CreateCompositionHookParams { - params.AudioSourcesExcluded = &AudioSourcesExcluded - return params -} -func (params *CreateCompositionHookParams) SetResolution(Resolution string) *CreateCompositionHookParams { - params.Resolution = &Resolution - return params -} -func (params *CreateCompositionHookParams) SetFormat(Format string) *CreateCompositionHookParams { - params.Format = &Format - return params -} -func (params *CreateCompositionHookParams) SetStatusCallback(StatusCallback string) *CreateCompositionHookParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateCompositionHookParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateCompositionHookParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateCompositionHookParams) SetTrim(Trim bool) *CreateCompositionHookParams { - params.Trim = &Trim - return params -} - -// + // A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook will never be triggered. + Enabled *bool `json:"Enabled,omitempty"` + // An object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + VideoLayout *interface{} `json:"VideoLayout,omitempty"` + // An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. + AudioSources *[]string `json:"AudioSources,omitempty"` + // An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"` + // A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Resolution *string `json:"Resolution,omitempty"` + // + Format *string `json:"Format,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Trim *bool `json:"Trim,omitempty"` +} + +func (params *CreateCompositionHookParams) SetFriendlyName(FriendlyName string) (*CreateCompositionHookParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateCompositionHookParams) SetEnabled(Enabled bool) (*CreateCompositionHookParams){ + params.Enabled = &Enabled + return params +} +func (params *CreateCompositionHookParams) SetVideoLayout(VideoLayout interface{}) (*CreateCompositionHookParams){ + params.VideoLayout = &VideoLayout + return params +} +func (params *CreateCompositionHookParams) SetAudioSources(AudioSources []string) (*CreateCompositionHookParams){ + params.AudioSources = &AudioSources + return params +} +func (params *CreateCompositionHookParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) (*CreateCompositionHookParams){ + params.AudioSourcesExcluded = &AudioSourcesExcluded + return params +} +func (params *CreateCompositionHookParams) SetResolution(Resolution string) (*CreateCompositionHookParams){ + params.Resolution = &Resolution + return params +} +func (params *CreateCompositionHookParams) SetFormat(Format string) (*CreateCompositionHookParams){ + params.Format = &Format + return params +} +func (params *CreateCompositionHookParams) SetStatusCallback(StatusCallback string) (*CreateCompositionHookParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateCompositionHookParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateCompositionHookParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateCompositionHookParams) SetTrim(Trim bool) (*CreateCompositionHookParams){ + params.Trim = &Trim + return params +} + +// func (c *ApiService) CreateCompositionHook(params *CreateCompositionHookParams) (*VideoV1CompositionHook, error) { - path := "/v1/CompositionHooks" + path := "/v1/CompositionHooks" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.VideoLayout != nil { + v, err := json.Marshal(params.VideoLayout) + + if err != nil { + return nil, err + } + + data.Set("VideoLayout", string(v)) + } + if params != nil && params.AudioSources != nil { + for _, item := range *params.AudioSources { + data.Add("AudioSources", item) + } + } + if params != nil && params.AudioSourcesExcluded != nil { + for _, item := range *params.AudioSourcesExcluded { + data.Add("AudioSourcesExcluded", item) + } + } + if params != nil && params.Resolution != nil { + data.Set("Resolution", *params.Resolution) + } + if params != nil && params.Format != nil { + data.Set("Format", *params.Format) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.Trim != nil { + data.Set("Trim", fmt.Sprint(*params.Trim)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1CompositionHook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// Delete a Recording CompositionHook resource identified by a `CompositionHook SID`. +func (c *ApiService) DeleteCompositionHook(Sid string, ) (error) { + path := "/v1/CompositionHooks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.VideoLayout != nil { - v, err := json.Marshal(params.VideoLayout) + data := url.Values{} + headers := make(map[string]interface{}) - if err != nil { - return nil, err - } - data.Set("VideoLayout", string(v)) - } - if params != nil && params.AudioSources != nil { - for _, item := range *params.AudioSources { - data.Add("AudioSources", item) - } - } - if params != nil && params.AudioSourcesExcluded != nil { - for _, item := range *params.AudioSourcesExcluded { - data.Add("AudioSourcesExcluded", item) - } - } - if params != nil && params.Resolution != nil { - data.Set("Resolution", *params.Resolution) - } - if params != nil && params.Format != nil { - data.Set("Format", *params.Format) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.Trim != nil { - data.Set("Trim", fmt.Sprint(*params.Trim)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - ps := &VideoV1CompositionHook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + return nil } -// Delete a Recording CompositionHook resource identified by a `CompositionHook SID`. -func (c *ApiService) DeleteCompositionHook(Sid string) error { - path := "/v1/CompositionHooks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// Returns a single CompositionHook resource identified by a CompositionHook SID. +func (c *ApiService) FetchCompositionHook(Sid string, ) (*VideoV1CompositionHook, error) { + path := "/v1/CompositionHooks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// Returns a single CompositionHook resource identified by a CompositionHook SID. -func (c *ApiService) FetchCompositionHook(Sid string) (*VideoV1CompositionHook, error) { - path := "/v1/CompositionHooks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &VideoV1CompositionHook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &VideoV1CompositionHook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListCompositionHook' type ListCompositionHookParams struct { - // Read only CompositionHook resources with an `enabled` value that matches this parameter. - Enabled *bool `json:"Enabled,omitempty"` - // Read only CompositionHook resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Read only CompositionHook resources created before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk `*` characters as wildcard match. - FriendlyName *string `json:"FriendlyName,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Read only CompositionHook resources with an `enabled` value that matches this parameter. + Enabled *bool `json:"Enabled,omitempty"` + // Read only CompositionHook resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Read only CompositionHook resources created before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk `*` characters as wildcard match. + FriendlyName *string `json:"FriendlyName,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCompositionHookParams) SetEnabled(Enabled bool) *ListCompositionHookParams { - params.Enabled = &Enabled - return params +func (params *ListCompositionHookParams) SetEnabled(Enabled bool) (*ListCompositionHookParams){ + params.Enabled = &Enabled + return params } -func (params *ListCompositionHookParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListCompositionHookParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListCompositionHookParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListCompositionHookParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListCompositionHookParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListCompositionHookParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListCompositionHookParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListCompositionHookParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListCompositionHookParams) SetFriendlyName(FriendlyName string) *ListCompositionHookParams { - params.FriendlyName = &FriendlyName - return params +func (params *ListCompositionHookParams) SetFriendlyName(FriendlyName string) (*ListCompositionHookParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *ListCompositionHookParams) SetPageSize(PageSize int) *ListCompositionHookParams { - params.PageSize = &PageSize - return params +func (params *ListCompositionHookParams) SetPageSize(PageSize int) (*ListCompositionHookParams){ + params.PageSize = &PageSize + return params } -func (params *ListCompositionHookParams) SetLimit(Limit int) *ListCompositionHookParams { - params.Limit = &Limit - return params +func (params *ListCompositionHookParams) SetLimit(Limit int) (*ListCompositionHookParams){ + params.Limit = &Limit + return params } // Retrieve a single page of CompositionHook records from the API. Request is executed immediately. func (c *ApiService) PageCompositionHook(params *ListCompositionHookParams, pageToken, pageNumber string) (*ListCompositionHookResponse, error) { - path := "/v1/CompositionHooks" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCompositionHookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CompositionHooks" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCompositionHookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists CompositionHook records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -317,6 +322,7 @@ func (c *ApiService) StreamCompositionHook(params *ListCompositionHookParams) (c return recordChannel, errorChannel } + func (c *ApiService) streamCompositionHook(response *ListCompositionHookResponse, params *ListCompositionHookParams, recordChannel chan VideoV1CompositionHook, errorChannel chan error) { curRecord := 1 @@ -348,148 +354,150 @@ func (c *ApiService) streamCompositionHook(response *ListCompositionHookResponse } func (c *ApiService) getNextListCompositionHookResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListCompositionHookResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListCompositionHookResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateCompositionHook' type UpdateCompositionHookParams struct { - // A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook never triggers. - Enabled *bool `json:"Enabled,omitempty"` - // A JSON object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - VideoLayout *interface{} `json:"VideoLayout,omitempty"` - // An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. - AudioSources *[]string `json:"AudioSources,omitempty"` - // An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"` - // Whether to clip the intervals where there is no active media in the compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Trim *bool `json:"Trim,omitempty"` - // - Format *string `json:"Format,omitempty"` - // A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Resolution *string `json:"Resolution,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` -} - -func (params *UpdateCompositionHookParams) SetFriendlyName(FriendlyName string) *UpdateCompositionHookParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateCompositionHookParams) SetEnabled(Enabled bool) *UpdateCompositionHookParams { - params.Enabled = &Enabled - return params -} -func (params *UpdateCompositionHookParams) SetVideoLayout(VideoLayout interface{}) *UpdateCompositionHookParams { - params.VideoLayout = &VideoLayout - return params -} -func (params *UpdateCompositionHookParams) SetAudioSources(AudioSources []string) *UpdateCompositionHookParams { - params.AudioSources = &AudioSources - return params -} -func (params *UpdateCompositionHookParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) *UpdateCompositionHookParams { - params.AudioSourcesExcluded = &AudioSourcesExcluded - return params -} -func (params *UpdateCompositionHookParams) SetTrim(Trim bool) *UpdateCompositionHookParams { - params.Trim = &Trim - return params -} -func (params *UpdateCompositionHookParams) SetFormat(Format string) *UpdateCompositionHookParams { - params.Format = &Format - return params -} -func (params *UpdateCompositionHookParams) SetResolution(Resolution string) *UpdateCompositionHookParams { - params.Resolution = &Resolution - return params -} -func (params *UpdateCompositionHookParams) SetStatusCallback(StatusCallback string) *UpdateCompositionHookParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *UpdateCompositionHookParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateCompositionHookParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} - -// + // A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook never triggers. + Enabled *bool `json:"Enabled,omitempty"` + // A JSON object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + VideoLayout *interface{} `json:"VideoLayout,omitempty"` + // An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. + AudioSources *[]string `json:"AudioSources,omitempty"` + // An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"` + // Whether to clip the intervals where there is no active media in the compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Trim *bool `json:"Trim,omitempty"` + // + Format *string `json:"Format,omitempty"` + // A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Resolution *string `json:"Resolution,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` +} + +func (params *UpdateCompositionHookParams) SetFriendlyName(FriendlyName string) (*UpdateCompositionHookParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateCompositionHookParams) SetEnabled(Enabled bool) (*UpdateCompositionHookParams){ + params.Enabled = &Enabled + return params +} +func (params *UpdateCompositionHookParams) SetVideoLayout(VideoLayout interface{}) (*UpdateCompositionHookParams){ + params.VideoLayout = &VideoLayout + return params +} +func (params *UpdateCompositionHookParams) SetAudioSources(AudioSources []string) (*UpdateCompositionHookParams){ + params.AudioSources = &AudioSources + return params +} +func (params *UpdateCompositionHookParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) (*UpdateCompositionHookParams){ + params.AudioSourcesExcluded = &AudioSourcesExcluded + return params +} +func (params *UpdateCompositionHookParams) SetTrim(Trim bool) (*UpdateCompositionHookParams){ + params.Trim = &Trim + return params +} +func (params *UpdateCompositionHookParams) SetFormat(Format string) (*UpdateCompositionHookParams){ + params.Format = &Format + return params +} +func (params *UpdateCompositionHookParams) SetResolution(Resolution string) (*UpdateCompositionHookParams){ + params.Resolution = &Resolution + return params +} +func (params *UpdateCompositionHookParams) SetStatusCallback(StatusCallback string) (*UpdateCompositionHookParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *UpdateCompositionHookParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateCompositionHookParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} + +// func (c *ApiService) UpdateCompositionHook(Sid string, params *UpdateCompositionHookParams) (*VideoV1CompositionHook, error) { - path := "/v1/CompositionHooks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - if params != nil && params.VideoLayout != nil { - v, err := json.Marshal(params.VideoLayout) - - if err != nil { - return nil, err - } - - data.Set("VideoLayout", string(v)) - } - if params != nil && params.AudioSources != nil { - for _, item := range *params.AudioSources { - data.Add("AudioSources", item) - } - } - if params != nil && params.AudioSourcesExcluded != nil { - for _, item := range *params.AudioSourcesExcluded { - data.Add("AudioSourcesExcluded", item) - } - } - if params != nil && params.Trim != nil { - data.Set("Trim", fmt.Sprint(*params.Trim)) - } - if params != nil && params.Format != nil { - data.Set("Format", *params.Format) - } - if params != nil && params.Resolution != nil { - data.Set("Resolution", *params.Resolution) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VideoV1CompositionHook{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CompositionHooks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + if params != nil && params.VideoLayout != nil { + v, err := json.Marshal(params.VideoLayout) + + if err != nil { + return nil, err + } + + data.Set("VideoLayout", string(v)) + } + if params != nil && params.AudioSources != nil { + for _, item := range *params.AudioSources { + data.Add("AudioSources", item) + } + } + if params != nil && params.AudioSourcesExcluded != nil { + for _, item := range *params.AudioSourcesExcluded { + data.Add("AudioSourcesExcluded", item) + } + } + if params != nil && params.Trim != nil { + data.Set("Trim", fmt.Sprint(*params.Trim)) + } + if params != nil && params.Format != nil { + data.Set("Format", *params.Format) + } + if params != nil && params.Resolution != nil { + data.Set("Resolution", *params.Resolution) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1CompositionHook{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/video/v1/composition_settings_default.go b/rest/video/v1/composition_settings_default.go index cdb7f12fa..2da05128e 100644 --- a/rest/video/v1/composition_settings_default.go +++ b/rest/video/v1/composition_settings_default.go @@ -18,108 +18,114 @@ import ( "encoding/json" "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCompositionSettings' type CreateCompositionSettingsParams struct { - // A descriptive string that you create to describe the resource and show to the user in the console - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the stored Credential resource. - AwsCredentialsSid *string `json:"AwsCredentialsSid,omitempty"` - // The SID of the Public Key resource to use for encryption. - EncryptionKeySid *string `json:"EncryptionKeySid,omitempty"` - // The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. - AwsS3Url *string `json:"AwsS3Url,omitempty"` - // Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. - AwsStorageEnabled *bool `json:"AwsStorageEnabled,omitempty"` - // Whether all compositions should be stored in an encrypted form. The default is `false`. - EncryptionEnabled *bool `json:"EncryptionEnabled,omitempty"` + // A descriptive string that you create to describe the resource and show to the user in the console + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the stored Credential resource. + AwsCredentialsSid *string `json:"AwsCredentialsSid,omitempty"` + // The SID of the Public Key resource to use for encryption. + EncryptionKeySid *string `json:"EncryptionKeySid,omitempty"` + // The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + AwsS3Url *string `json:"AwsS3Url,omitempty"` + // Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. + AwsStorageEnabled *bool `json:"AwsStorageEnabled,omitempty"` + // Whether all compositions should be stored in an encrypted form. The default is `false`. + EncryptionEnabled *bool `json:"EncryptionEnabled,omitempty"` } -func (params *CreateCompositionSettingsParams) SetFriendlyName(FriendlyName string) *CreateCompositionSettingsParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateCompositionSettingsParams) SetFriendlyName(FriendlyName string) (*CreateCompositionSettingsParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateCompositionSettingsParams) SetAwsCredentialsSid(AwsCredentialsSid string) *CreateCompositionSettingsParams { - params.AwsCredentialsSid = &AwsCredentialsSid - return params +func (params *CreateCompositionSettingsParams) SetAwsCredentialsSid(AwsCredentialsSid string) (*CreateCompositionSettingsParams){ + params.AwsCredentialsSid = &AwsCredentialsSid + return params } -func (params *CreateCompositionSettingsParams) SetEncryptionKeySid(EncryptionKeySid string) *CreateCompositionSettingsParams { - params.EncryptionKeySid = &EncryptionKeySid - return params +func (params *CreateCompositionSettingsParams) SetEncryptionKeySid(EncryptionKeySid string) (*CreateCompositionSettingsParams){ + params.EncryptionKeySid = &EncryptionKeySid + return params } -func (params *CreateCompositionSettingsParams) SetAwsS3Url(AwsS3Url string) *CreateCompositionSettingsParams { - params.AwsS3Url = &AwsS3Url - return params +func (params *CreateCompositionSettingsParams) SetAwsS3Url(AwsS3Url string) (*CreateCompositionSettingsParams){ + params.AwsS3Url = &AwsS3Url + return params } -func (params *CreateCompositionSettingsParams) SetAwsStorageEnabled(AwsStorageEnabled bool) *CreateCompositionSettingsParams { - params.AwsStorageEnabled = &AwsStorageEnabled - return params +func (params *CreateCompositionSettingsParams) SetAwsStorageEnabled(AwsStorageEnabled bool) (*CreateCompositionSettingsParams){ + params.AwsStorageEnabled = &AwsStorageEnabled + return params } -func (params *CreateCompositionSettingsParams) SetEncryptionEnabled(EncryptionEnabled bool) *CreateCompositionSettingsParams { - params.EncryptionEnabled = &EncryptionEnabled - return params +func (params *CreateCompositionSettingsParams) SetEncryptionEnabled(EncryptionEnabled bool) (*CreateCompositionSettingsParams){ + params.EncryptionEnabled = &EncryptionEnabled + return params } -// +// func (c *ApiService) CreateCompositionSettings(params *CreateCompositionSettingsParams) (*VideoV1CompositionSettings, error) { - path := "/v1/CompositionSettings/Default" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AwsCredentialsSid != nil { - data.Set("AwsCredentialsSid", *params.AwsCredentialsSid) - } - if params != nil && params.EncryptionKeySid != nil { - data.Set("EncryptionKeySid", *params.EncryptionKeySid) - } - if params != nil && params.AwsS3Url != nil { - data.Set("AwsS3Url", *params.AwsS3Url) - } - if params != nil && params.AwsStorageEnabled != nil { - data.Set("AwsStorageEnabled", fmt.Sprint(*params.AwsStorageEnabled)) - } - if params != nil && params.EncryptionEnabled != nil { - data.Set("EncryptionEnabled", fmt.Sprint(*params.EncryptionEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VideoV1CompositionSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/CompositionSettings/Default" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AwsCredentialsSid != nil { + data.Set("AwsCredentialsSid", *params.AwsCredentialsSid) + } + if params != nil && params.EncryptionKeySid != nil { + data.Set("EncryptionKeySid", *params.EncryptionKeySid) + } + if params != nil && params.AwsS3Url != nil { + data.Set("AwsS3Url", *params.AwsS3Url) + } + if params != nil && params.AwsStorageEnabled != nil { + data.Set("AwsStorageEnabled", fmt.Sprint(*params.AwsStorageEnabled)) + } + if params != nil && params.EncryptionEnabled != nil { + data.Set("EncryptionEnabled", fmt.Sprint(*params.EncryptionEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1CompositionSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// +// func (c *ApiService) FetchCompositionSettings() (*VideoV1CompositionSettings, error) { - path := "/v1/CompositionSettings/Default" + path := "/v1/CompositionSettings/Default" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VideoV1CompositionSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VideoV1CompositionSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/compositions.go b/rest/video/v1/compositions.go index d0dce4ee9..c413564f2 100644 --- a/rest/video/v1/compositions.go +++ b/rest/video/v1/compositions.go @@ -18,256 +18,261 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateComposition' type CreateCompositionParams struct { - // The SID of the Group Room with the media tracks to be used as composition sources. - RoomSid *string `json:"RoomSid,omitempty"` - // An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request - VideoLayout *interface{} `json:"VideoLayout,omitempty"` - // An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request - AudioSources *[]string `json:"AudioSources,omitempty"` - // An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"` - // A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Resolution *string `json:"Resolution,omitempty"` - // - Format *string `json:"Format,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Trim *bool `json:"Trim,omitempty"` + // The SID of the Group Room with the media tracks to be used as composition sources. + RoomSid *string `json:"RoomSid,omitempty"` + // An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request + VideoLayout *interface{} `json:"VideoLayout,omitempty"` + // An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request + AudioSources *[]string `json:"AudioSources,omitempty"` + // An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"` + // A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Resolution *string `json:"Resolution,omitempty"` + // + Format *string `json:"Format,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Trim *bool `json:"Trim,omitempty"` } -func (params *CreateCompositionParams) SetRoomSid(RoomSid string) *CreateCompositionParams { - params.RoomSid = &RoomSid - return params +func (params *CreateCompositionParams) SetRoomSid(RoomSid string) (*CreateCompositionParams){ + params.RoomSid = &RoomSid + return params } -func (params *CreateCompositionParams) SetVideoLayout(VideoLayout interface{}) *CreateCompositionParams { - params.VideoLayout = &VideoLayout - return params +func (params *CreateCompositionParams) SetVideoLayout(VideoLayout interface{}) (*CreateCompositionParams){ + params.VideoLayout = &VideoLayout + return params } -func (params *CreateCompositionParams) SetAudioSources(AudioSources []string) *CreateCompositionParams { - params.AudioSources = &AudioSources - return params +func (params *CreateCompositionParams) SetAudioSources(AudioSources []string) (*CreateCompositionParams){ + params.AudioSources = &AudioSources + return params } -func (params *CreateCompositionParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) *CreateCompositionParams { - params.AudioSourcesExcluded = &AudioSourcesExcluded - return params +func (params *CreateCompositionParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) (*CreateCompositionParams){ + params.AudioSourcesExcluded = &AudioSourcesExcluded + return params } -func (params *CreateCompositionParams) SetResolution(Resolution string) *CreateCompositionParams { - params.Resolution = &Resolution - return params +func (params *CreateCompositionParams) SetResolution(Resolution string) (*CreateCompositionParams){ + params.Resolution = &Resolution + return params } -func (params *CreateCompositionParams) SetFormat(Format string) *CreateCompositionParams { - params.Format = &Format - return params +func (params *CreateCompositionParams) SetFormat(Format string) (*CreateCompositionParams){ + params.Format = &Format + return params } -func (params *CreateCompositionParams) SetStatusCallback(StatusCallback string) *CreateCompositionParams { - params.StatusCallback = &StatusCallback - return params +func (params *CreateCompositionParams) SetStatusCallback(StatusCallback string) (*CreateCompositionParams){ + params.StatusCallback = &StatusCallback + return params } -func (params *CreateCompositionParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateCompositionParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params +func (params *CreateCompositionParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateCompositionParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params } -func (params *CreateCompositionParams) SetTrim(Trim bool) *CreateCompositionParams { - params.Trim = &Trim - return params +func (params *CreateCompositionParams) SetTrim(Trim bool) (*CreateCompositionParams){ + params.Trim = &Trim + return params } -// +// func (c *ApiService) CreateComposition(params *CreateCompositionParams) (*VideoV1Composition, error) { - path := "/v1/Compositions" + path := "/v1/Compositions" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.RoomSid != nil { + data.Set("RoomSid", *params.RoomSid) + } + if params != nil && params.VideoLayout != nil { + v, err := json.Marshal(params.VideoLayout) + + if err != nil { + return nil, err + } + + data.Set("VideoLayout", string(v)) + } + if params != nil && params.AudioSources != nil { + for _, item := range *params.AudioSources { + data.Add("AudioSources", item) + } + } + if params != nil && params.AudioSourcesExcluded != nil { + for _, item := range *params.AudioSourcesExcluded { + data.Add("AudioSourcesExcluded", item) + } + } + if params != nil && params.Resolution != nil { + data.Set("Resolution", *params.Resolution) + } + if params != nil && params.Format != nil { + data.Set("Format", *params.Format) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.Trim != nil { + data.Set("Trim", fmt.Sprint(*params.Trim)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1Composition{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// Delete a Recording Composition resource identified by a Composition SID. +func (c *ApiService) DeleteComposition(Sid string, ) (error) { + path := "/v1/Compositions/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.RoomSid != nil { - data.Set("RoomSid", *params.RoomSid) - } - if params != nil && params.VideoLayout != nil { - v, err := json.Marshal(params.VideoLayout) + data := url.Values{} + headers := make(map[string]interface{}) - if err != nil { - return nil, err - } - data.Set("VideoLayout", string(v)) - } - if params != nil && params.AudioSources != nil { - for _, item := range *params.AudioSources { - data.Add("AudioSources", item) - } - } - if params != nil && params.AudioSourcesExcluded != nil { - for _, item := range *params.AudioSourcesExcluded { - data.Add("AudioSourcesExcluded", item) - } - } - if params != nil && params.Resolution != nil { - data.Set("Resolution", *params.Resolution) - } - if params != nil && params.Format != nil { - data.Set("Format", *params.Format) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.Trim != nil { - data.Set("Trim", fmt.Sprint(*params.Trim)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() - - ps := &VideoV1Composition{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + return nil } -// Delete a Recording Composition resource identified by a Composition SID. -func (c *ApiService) DeleteComposition(Sid string) error { - path := "/v1/Compositions/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// Returns a single Composition resource identified by a Composition SID. +func (c *ApiService) FetchComposition(Sid string, ) (*VideoV1Composition, error) { + path := "/v1/Compositions/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// Returns a single Composition resource identified by a Composition SID. -func (c *ApiService) FetchComposition(Sid string) (*VideoV1Composition, error) { - path := "/v1/Compositions/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &VideoV1Composition{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &VideoV1Composition{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListComposition' type ListCompositionParams struct { - // Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`. - Status *string `json:"Status,omitempty"` - // Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Read only Composition resources created before this ISO 8601 date-time with time zone. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // Read only Composition resources with this Room SID. - RoomSid *string `json:"RoomSid,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`. + Status *string `json:"Status,omitempty"` + // Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Read only Composition resources created before this ISO 8601 date-time with time zone. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // Read only Composition resources with this Room SID. + RoomSid *string `json:"RoomSid,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCompositionParams) SetStatus(Status string) *ListCompositionParams { - params.Status = &Status - return params +func (params *ListCompositionParams) SetStatus(Status string) (*ListCompositionParams){ + params.Status = &Status + return params } -func (params *ListCompositionParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListCompositionParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListCompositionParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListCompositionParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListCompositionParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListCompositionParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListCompositionParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListCompositionParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListCompositionParams) SetRoomSid(RoomSid string) *ListCompositionParams { - params.RoomSid = &RoomSid - return params +func (params *ListCompositionParams) SetRoomSid(RoomSid string) (*ListCompositionParams){ + params.RoomSid = &RoomSid + return params } -func (params *ListCompositionParams) SetPageSize(PageSize int) *ListCompositionParams { - params.PageSize = &PageSize - return params +func (params *ListCompositionParams) SetPageSize(PageSize int) (*ListCompositionParams){ + params.PageSize = &PageSize + return params } -func (params *ListCompositionParams) SetLimit(Limit int) *ListCompositionParams { - params.Limit = &Limit - return params +func (params *ListCompositionParams) SetLimit(Limit int) (*ListCompositionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Composition records from the API. Request is executed immediately. func (c *ApiService) PageComposition(params *ListCompositionParams, pageToken, pageNumber string) (*ListCompositionResponse, error) { - path := "/v1/Compositions" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.RoomSid != nil { - data.Set("RoomSid", *params.RoomSid) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCompositionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Compositions" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.RoomSid != nil { + data.Set("RoomSid", *params.RoomSid) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCompositionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Composition records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -308,6 +313,7 @@ func (c *ApiService) StreamComposition(params *ListCompositionParams) (chan Vide return recordChannel, errorChannel } + func (c *ApiService) streamComposition(response *ListCompositionResponse, params *ListCompositionParams, recordChannel chan VideoV1Composition, errorChannel chan error) { curRecord := 1 @@ -339,19 +345,20 @@ func (c *ApiService) streamComposition(response *ListCompositionResponse, params } func (c *ApiService) getNextListCompositionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCompositionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCompositionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/video/v1/docs/ListCompositionResponseMeta.md b/rest/video/v1/docs/ListCompositionResponseMeta.md index d1b1a753d..54b852310 100644 --- a/rest/video/v1/docs/ListCompositionResponseMeta.md +++ b/rest/video/v1/docs/ListCompositionResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/video/v1/model_list_composition_hook_response.go b/rest/video/v1/model_list_composition_hook_response.go index e7738d159..24b9193c3 100644 --- a/rest/video/v1/model_list_composition_hook_response.go +++ b/rest/video/v1/model_list_composition_hook_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCompositionHookResponse struct for ListCompositionHookResponse type ListCompositionHookResponse struct { - CompositionHooks []VideoV1CompositionHook `json:"composition_hooks,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + CompositionHooks []VideoV1CompositionHook `json:"composition_hooks,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_composition_response.go b/rest/video/v1/model_list_composition_response.go index bb5f5ab44..a5a8d0194 100644 --- a/rest/video/v1/model_list_composition_response.go +++ b/rest/video/v1/model_list_composition_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCompositionResponse struct for ListCompositionResponse type ListCompositionResponse struct { - Compositions []VideoV1Composition `json:"compositions,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Compositions []VideoV1Composition `json:"compositions,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_composition_response_meta.go b/rest/video/v1/model_list_composition_response_meta.go index 06c6c69c9..c869640a8 100644 --- a/rest/video/v1/model_list_composition_response_meta.go +++ b/rest/video/v1/model_list_composition_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCompositionResponseMeta struct for ListCompositionResponseMeta type ListCompositionResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_list_recording_response.go b/rest/video/v1/model_list_recording_response.go index c7dcc775e..87d27b4e7 100644 --- a/rest/video/v1/model_list_recording_response.go +++ b/rest/video/v1/model_list_recording_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRecordingResponse struct for ListRecordingResponse type ListRecordingResponse struct { - Recordings []VideoV1Recording `json:"recordings,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Recordings []VideoV1Recording `json:"recordings,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_room_participant_published_track_response.go b/rest/video/v1/model_list_room_participant_published_track_response.go index 36bdcd567..70b4944ba 100644 --- a/rest/video/v1/model_list_room_participant_published_track_response.go +++ b/rest/video/v1/model_list_room_participant_published_track_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoomParticipantPublishedTrackResponse struct for ListRoomParticipantPublishedTrackResponse type ListRoomParticipantPublishedTrackResponse struct { PublishedTracks []VideoV1RoomParticipantPublishedTrack `json:"published_tracks,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_room_participant_response.go b/rest/video/v1/model_list_room_participant_response.go index 9a519abb4..163fe6801 100644 --- a/rest/video/v1/model_list_room_participant_response.go +++ b/rest/video/v1/model_list_room_participant_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoomParticipantResponse struct for ListRoomParticipantResponse type ListRoomParticipantResponse struct { - Participants []VideoV1RoomParticipant `json:"participants,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Participants []VideoV1RoomParticipant `json:"participants,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_room_participant_subscribed_track_response.go b/rest/video/v1/model_list_room_participant_subscribed_track_response.go index 03c84608b..03c629af9 100644 --- a/rest/video/v1/model_list_room_participant_subscribed_track_response.go +++ b/rest/video/v1/model_list_room_participant_subscribed_track_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoomParticipantSubscribedTrackResponse struct for ListRoomParticipantSubscribedTrackResponse type ListRoomParticipantSubscribedTrackResponse struct { SubscribedTracks []VideoV1RoomParticipantSubscribedTrack `json:"subscribed_tracks,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_room_recording_response.go b/rest/video/v1/model_list_room_recording_response.go index b7e542942..dfd2cd609 100644 --- a/rest/video/v1/model_list_room_recording_response.go +++ b/rest/video/v1/model_list_room_recording_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoomRecordingResponse struct for ListRoomRecordingResponse type ListRoomRecordingResponse struct { - Recordings []VideoV1RoomRecording `json:"recordings,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Recordings []VideoV1RoomRecording `json:"recordings,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_list_room_response.go b/rest/video/v1/model_list_room_response.go index 450db4dac..02a5eabbc 100644 --- a/rest/video/v1/model_list_room_response.go +++ b/rest/video/v1/model_list_room_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRoomResponse struct for ListRoomResponse type ListRoomResponse struct { - Rooms []VideoV1Room `json:"rooms,omitempty"` - Meta ListCompositionResponseMeta `json:"meta,omitempty"` + Rooms []VideoV1Room `json:"rooms,omitempty"` + Meta ListCompositionResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_composition.go b/rest/video/v1/model_video_v1_composition.go index 43f99362b..eec877b76 100644 --- a/rest/video/v1/model_video_v1_composition.go +++ b/rest/video/v1/model_video_v1_composition.go @@ -13,51 +13,53 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1Composition struct for VideoV1Composition type VideoV1Composition struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Composition resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Composition resource. AccountSid *string `json:"account_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Status *string `json:"status,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the composition's media processing task finished, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the composition's media processing task finished, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCompleted *time.Time `json:"date_completed,omitempty"` - // The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateDeleted *time.Time `json:"date_deleted,omitempty"` - // The unique string that we created to identify the Composition resource. + // The unique string that we created to identify the Composition resource. Sid *string `json:"sid,omitempty"` - // The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room. + // The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room. RoomSid *string `json:"room_sid,omitempty"` - // The array of track names to include in the composition. The composition includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. + // The array of track names to include in the composition. The composition includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. AudioSources *[]string `json:"audio_sources,omitempty"` - // The array of track names to exclude from the composition. The composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + // The array of track names to exclude from the composition. The composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. AudioSourcesExcluded *[]string `json:"audio_sources_excluded,omitempty"` - // An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + // An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. VideoLayout *interface{} `json:"video_layout,omitempty"` - // The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. + // The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. Resolution *string `json:"resolution,omitempty"` - // Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Trim *bool `json:"trim,omitempty"` + // Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Trim *bool `json:"trim,omitempty"` Format *string `json:"format,omitempty"` - // The average bit rate of the composition's media. + // The average bit rate of the composition's media. Bitrate *int `json:"bitrate,omitempty"` - // The size of the composed media file in bytes. + // The size of the composed media file in bytes. Size *int64 `json:"size,omitempty"` - // The duration of the composition's media file in seconds. + // The duration of the composition's media file in seconds. Duration *int `json:"duration,omitempty"` - // The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. + // The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. MediaExternalLocation *string `json:"media_external_location,omitempty"` - // The URL called using the `status_callback_method` to send status information on every composition event. + // The URL called using the `status_callback_method` to send status information on every composition event. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. + // The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URL of the media file associated with the composition. + // The URL of the media file associated with the composition. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_composition_hook.go b/rest/video/v1/model_video_v1_composition_hook.go index 3d30e8c4d..7e0560081 100644 --- a/rest/video/v1/model_video_v1_composition_hook.go +++ b/rest/video/v1/model_video_v1_composition_hook.go @@ -13,40 +13,42 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1CompositionHook struct for VideoV1CompositionHook type VideoV1CompositionHook struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionHook resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionHook resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account. + // The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account. FriendlyName *string `json:"friendly_name,omitempty"` - // Whether the CompositionHook is active. When `true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered. + // Whether the CompositionHook is active. When `true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered. Enabled *bool `json:"enabled,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The unique string that we created to identify the CompositionHook resource. + // The unique string that we created to identify the CompositionHook resource. Sid *string `json:"sid,omitempty"` - // The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request + // The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request AudioSources *[]string `json:"audio_sources,omitempty"` - // The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + // The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. AudioSourcesExcluded *[]string `json:"audio_sources_excluded,omitempty"` - // A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request + // A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request VideoLayout *interface{} `json:"video_layout,omitempty"` - // The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. + // The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. Resolution *string `json:"resolution,omitempty"` - // Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - Trim *bool `json:"trim,omitempty"` + // Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + Trim *bool `json:"trim,omitempty"` Format *string `json:"format,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application. + // The URL we call using the `status_callback_method` to send status information to your application. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + // The HTTP method we should use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_composition_settings.go b/rest/video/v1/model_video_v1_composition_settings.go index f5b610cab..b3d37d46f 100644 --- a/rest/video/v1/model_video_v1_composition_settings.go +++ b/rest/video/v1/model_video_v1_composition_settings.go @@ -13,23 +13,28 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VideoV1CompositionSettings struct for VideoV1CompositionSettings type VideoV1CompositionSettings struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource and that will be shown in the console + // The string that you assigned to describe the resource and that will be shown in the console FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the stored Credential resource. + // The SID of the stored Credential resource. AwsCredentialsSid *string `json:"aws_credentials_sid,omitempty"` - // The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + // The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. AwsS3Url *string `json:"aws_s3_url,omitempty"` - // Whether all compositions are written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. + // Whether all compositions are written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. AwsStorageEnabled *bool `json:"aws_storage_enabled,omitempty"` - // The SID of the Public Key resource used for encryption. + // The SID of the Public Key resource used for encryption. EncryptionKeySid *string `json:"encryption_key_sid,omitempty"` - // Whether all compositions are stored in an encrypted form. The default is `false`. + // Whether all compositions are stored in an encrypted form. The default is `false`. EncryptionEnabled *bool `json:"encryption_enabled,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_recording.go b/rest/video/v1/model_video_v1_recording.go index 05bc1f849..edd2491aa 100644 --- a/rest/video/v1/model_video_v1_recording.go +++ b/rest/video/v1/model_video_v1_recording.go @@ -13,43 +13,45 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1Recording struct for VideoV1Recording type VideoV1Recording struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. AccountSid *string `json:"account_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Status *string `json:"status,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The unique string that we created to identify the Recording resource. + // The unique string that we created to identify the Recording resource. Sid *string `json:"sid,omitempty"` - // The SID of the recording source. For a Room Recording, this value is a `track_sid`. + // The SID of the recording source. For a Room Recording, this value is a `track_sid`. SourceSid *string `json:"source_sid,omitempty"` - // The size of the recorded track, in bytes. + // The size of the recorded track, in bytes. Size *int64 `json:"size,omitempty"` - // The absolute URL of the resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the resource. + Url *string `json:"url,omitempty"` Type *string `json:"type,omitempty"` - // The duration of the recording in seconds rounded to the nearest second. Sub-second tracks have a `Duration` property of 1 second - Duration *int `json:"duration,omitempty"` + // The duration of the recording in seconds rounded to the nearest second. Sub-second tracks have a `Duration` property of 1 second + Duration *int `json:"duration,omitempty"` ContainerFormat *string `json:"container_format,omitempty"` - Codec *string `json:"codec,omitempty"` - // A list of SIDs related to the recording. Includes the `room_sid` and `participant_sid`. + Codec *string `json:"codec,omitempty"` + // A list of SIDs related to the recording. Includes the `room_sid` and `participant_sid`. GroupingSids *interface{} `json:"grouping_sids,omitempty"` - // The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. + // The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. TrackName *string `json:"track_name,omitempty"` - // The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. + // The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. Offset *int64 `json:"offset,omitempty"` - // The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. + // The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. MediaExternalLocation *string `json:"media_external_location,omitempty"` - // The URL called using the `status_callback_method` to send status information on every recording event. + // The URL called using the `status_callback_method` to send status information on every recording event. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. + // The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_recording_settings.go b/rest/video/v1/model_video_v1_recording_settings.go index f719386a0..f14ba29c8 100644 --- a/rest/video/v1/model_video_v1_recording_settings.go +++ b/rest/video/v1/model_video_v1_recording_settings.go @@ -13,23 +13,28 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VideoV1RecordingSettings struct for VideoV1RecordingSettings type VideoV1RecordingSettings struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource and show the user in the console + // The string that you assigned to describe the resource and show the user in the console FriendlyName *string `json:"friendly_name,omitempty"` - // The SID of the stored Credential resource. + // The SID of the stored Credential resource. AwsCredentialsSid *string `json:"aws_credentials_sid,omitempty"` - // The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + // The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. AwsS3Url *string `json:"aws_s3_url,omitempty"` - // Whether all recordings are written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. + // Whether all recordings are written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. AwsStorageEnabled *bool `json:"aws_storage_enabled,omitempty"` - // The SID of the Public Key resource used for encryption. + // The SID of the Public Key resource used for encryption. EncryptionKeySid *string `json:"encryption_key_sid,omitempty"` - // Whether all recordings are stored in an encrypted form. The default is `false`. + // Whether all recordings are stored in an encrypted form. The default is `false`. EncryptionEnabled *bool `json:"encryption_enabled,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room.go b/rest/video/v1/model_video_v1_room.go index 220533777..54de4aa90 100644 --- a/rest/video/v1/model_video_v1_room.go +++ b/rest/video/v1/model_video_v1_room.go @@ -13,57 +13,59 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1Room struct for VideoV1Room type VideoV1Room struct { - // The unique string that we created to identify the Room resource. - Sid *string `json:"sid,omitempty"` + // The unique string that we created to identify the Room resource. + Sid *string `json:"sid,omitempty"` Status *string `json:"status,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. AccountSid *string `json:"account_sid,omitempty"` - // Deprecated, now always considered to be true. + // Deprecated, now always considered to be true. EnableTurn *bool `json:"enable_turn,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. + // An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. UniqueName *string `json:"unique_name,omitempty"` - // The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + // The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. StatusCallback *string `json:"status_callback,omitempty"` - // The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + // The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + // The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. EndTime *time.Time `json:"end_time,omitempty"` - // The duration of the room in seconds. - Duration *int `json:"duration,omitempty"` - Type *string `json:"type,omitempty"` - // The maximum number of concurrent Participants allowed in the room. + // The duration of the room in seconds. + Duration *int `json:"duration,omitempty"` + Type *string `json:"type,omitempty"` + // The maximum number of concurrent Participants allowed in the room. MaxParticipants *int `json:"max_participants,omitempty"` - // The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). + // The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). MaxParticipantDuration *int `json:"max_participant_duration,omitempty"` - // The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. + // The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. MaxConcurrentPublishedTracks *int `json:"max_concurrent_published_tracks,omitempty"` - // Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** + // Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** RecordParticipantsOnConnect *bool `json:"record_participants_on_connect,omitempty"` - // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** + // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** VideoCodecs *[]string `json:"video_codecs,omitempty"` - // The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + // The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** MediaRegion *string `json:"media_region,omitempty"` - // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. AudioOnly *bool `json:"audio_only,omitempty"` - // Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. + // Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. EmptyRoomTimeout *int `json:"empty_room_timeout,omitempty"` - // Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. + // Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. UnusedRoomTimeout *int `json:"unused_room_timeout,omitempty"` - // Indicates if this is a large room. + // Indicates if this is a large room. LargeRoom *bool `json:"large_room,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_participant.go b/rest/video/v1/model_video_v1_room_participant.go index a92541285..14f3589a2 100644 --- a/rest/video/v1/model_video_v1_room_participant.go +++ b/rest/video/v1/model_video_v1_room_participant.go @@ -13,34 +13,36 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomParticipant struct for VideoV1RoomParticipant type VideoV1RoomParticipant struct { - // The unique string that we created to identify the RoomParticipant resource. + // The unique string that we created to identify the RoomParticipant resource. Sid *string `json:"sid,omitempty"` - // The SID of the participant's room. + // The SID of the participant's room. RoomSid *string `json:"room_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. AccountSid *string `json:"account_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The application-defined string that uniquely identifies the resource's User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. + Status *string `json:"status,omitempty"` + // The application-defined string that uniquely identifies the resource's User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. Identity *string `json:"identity,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + // The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. StartTime *time.Time `json:"start_time,omitempty"` - // The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + // The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. EndTime *time.Time `json:"end_time,omitempty"` - // The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. + // The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. Duration *int `json:"duration,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_participant_anonymize.go b/rest/video/v1/model_video_v1_room_participant_anonymize.go index c55745a79..cbabd9c31 100644 --- a/rest/video/v1/model_video_v1_room_participant_anonymize.go +++ b/rest/video/v1/model_video_v1_room_participant_anonymize.go @@ -13,32 +13,34 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomParticipantAnonymize struct for VideoV1RoomParticipantAnonymize type VideoV1RoomParticipantAnonymize struct { - // The unique string that we created to identify the RoomParticipant resource. + // The unique string that we created to identify the RoomParticipant resource. Sid *string `json:"sid,omitempty"` - // The SID of the participant's room. + // The SID of the participant's room. RoomSid *string `json:"room_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. AccountSid *string `json:"account_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The SID of the participant. + Status *string `json:"status,omitempty"` + // The SID of the participant. Identity *string `json:"identity,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + // The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. StartTime *time.Time `json:"start_time,omitempty"` - // The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + // The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. EndTime *time.Time `json:"end_time,omitempty"` - // The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. + // The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. Duration *int `json:"duration,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_participant_published_track.go b/rest/video/v1/model_video_v1_room_participant_published_track.go index 6bd99f00a..8fed01b1b 100644 --- a/rest/video/v1/model_video_v1_room_participant_published_track.go +++ b/rest/video/v1/model_video_v1_room_participant_published_track.go @@ -13,28 +13,30 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomParticipantPublishedTrack struct for VideoV1RoomParticipantPublishedTrack type VideoV1RoomParticipantPublishedTrack struct { - // The unique string that we created to identify the RoomParticipantPublishedTrack resource. + // The unique string that we created to identify the RoomParticipantPublishedTrack resource. Sid *string `json:"sid,omitempty"` - // The SID of the Participant resource with the published track. + // The SID of the Participant resource with the published track. ParticipantSid *string `json:"participant_sid,omitempty"` - // The SID of the Room resource where the track is published. + // The SID of the Room resource where the track is published. RoomSid *string `json:"room_sid,omitempty"` - // The track name. Must be no more than 128 characters, and be unique among the participant's published tracks. + // The track name. Must be no more than 128 characters, and be unique among the participant's published tracks. Name *string `json:"name,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Whether the track is enabled. - Enabled *bool `json:"enabled,omitempty"` - Kind *string `json:"kind,omitempty"` - // The absolute URL of the resource. + // Whether the track is enabled. + Enabled *bool `json:"enabled,omitempty"` + Kind *string `json:"kind,omitempty"` + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_participant_subscribe_rule.go b/rest/video/v1/model_video_v1_room_participant_subscribe_rule.go index ecd166920..19251fb82 100644 --- a/rest/video/v1/model_video_v1_room_participant_subscribe_rule.go +++ b/rest/video/v1/model_video_v1_room_participant_subscribe_rule.go @@ -13,21 +13,23 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomParticipantSubscribeRule struct for VideoV1RoomParticipantSubscribeRule type VideoV1RoomParticipantSubscribeRule struct { - // The SID of the Participant resource for the Subscribe Rules. + // The SID of the Participant resource for the Subscribe Rules. ParticipantSid *string `json:"participant_sid,omitempty"` - // The SID of the Room resource for the Subscribe Rules + // The SID of the Room resource for the Subscribe Rules RoomSid *string `json:"room_sid,omitempty"` - // A collection of Subscribe Rules that describe how to include or exclude matching tracks. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. + // A collection of Subscribe Rules that describe how to include or exclude matching tracks. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. Rules *[]VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules `json:"rules,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_participant_subscribed_track.go b/rest/video/v1/model_video_v1_room_participant_subscribed_track.go index ffd3e90ed..8d1297afb 100644 --- a/rest/video/v1/model_video_v1_room_participant_subscribed_track.go +++ b/rest/video/v1/model_video_v1_room_participant_subscribed_track.go @@ -13,30 +13,32 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomParticipantSubscribedTrack struct for VideoV1RoomParticipantSubscribedTrack type VideoV1RoomParticipantSubscribedTrack struct { - // The unique string that we created to identify the RoomParticipantSubscribedTrack resource. + // The unique string that we created to identify the RoomParticipantSubscribedTrack resource. Sid *string `json:"sid,omitempty"` - // The SID of the participant that subscribes to the track. + // The SID of the participant that subscribes to the track. ParticipantSid *string `json:"participant_sid,omitempty"` - // The SID of the participant that publishes the track. + // The SID of the participant that publishes the track. PublisherSid *string `json:"publisher_sid,omitempty"` - // The SID of the room where the track is published. + // The SID of the room where the track is published. RoomSid *string `json:"room_sid,omitempty"` - // The track name. Must have no more than 128 characters and be unique among the participant's published tracks. + // The track name. Must have no more than 128 characters and be unique among the participant's published tracks. Name *string `json:"name,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // Whether the track is enabled. - Enabled *bool `json:"enabled,omitempty"` - Kind *string `json:"kind,omitempty"` - // The absolute URL of the resource. + // Whether the track is enabled. + Enabled *bool `json:"enabled,omitempty"` + Kind *string `json:"kind,omitempty"` + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_recording.go b/rest/video/v1/model_video_v1_room_recording.go index e2923c276..6e3fc9c44 100644 --- a/rest/video/v1/model_video_v1_room_recording.go +++ b/rest/video/v1/model_video_v1_room_recording.go @@ -13,41 +13,43 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomRecording struct for VideoV1RoomRecording type VideoV1RoomRecording struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomRecording resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomRecording resource. AccountSid *string `json:"account_sid,omitempty"` - Status *string `json:"status,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + Status *string `json:"status,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The unique string that we created to identify the RoomRecording resource. + // The unique string that we created to identify the RoomRecording resource. Sid *string `json:"sid,omitempty"` - // The SID of the recording source. For a Room Recording, this value is a `track_sid`. + // The SID of the recording source. For a Room Recording, this value is a `track_sid`. SourceSid *string `json:"source_sid,omitempty"` - // The size of the recorded track in bytes. + // The size of the recorded track in bytes. Size *int64 `json:"size,omitempty"` - // The absolute URL of the resource. - Url *string `json:"url,omitempty"` + // The absolute URL of the resource. + Url *string `json:"url,omitempty"` Type *string `json:"type,omitempty"` - // The duration of the recording rounded to the nearest second. Sub-second duration tracks have a `duration` of 1 second - Duration *int `json:"duration,omitempty"` + // The duration of the recording rounded to the nearest second. Sub-second duration tracks have a `duration` of 1 second + Duration *int `json:"duration,omitempty"` ContainerFormat *string `json:"container_format,omitempty"` - Codec *string `json:"codec,omitempty"` - // A list of SIDs related to the Recording. Includes the `room_sid` and `participant_sid`. + Codec *string `json:"codec,omitempty"` + // A list of SIDs related to the Recording. Includes the `room_sid` and `participant_sid`. GroupingSids *interface{} `json:"grouping_sids,omitempty"` - // The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. + // The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. TrackName *string `json:"track_name,omitempty"` - // The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. + // The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. Offset *int64 `json:"offset,omitempty"` - // The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. + // The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. MediaExternalLocation *string `json:"media_external_location,omitempty"` - // The SID of the Room resource the recording is associated with. + // The SID of the Room resource the recording is associated with. RoomSid *string `json:"room_sid,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_recording_rule.go b/rest/video/v1/model_video_v1_room_recording_rule.go index 5ab878987..ea244a09c 100644 --- a/rest/video/v1/model_video_v1_room_recording_rule.go +++ b/rest/video/v1/model_video_v1_room_recording_rule.go @@ -13,19 +13,21 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VideoV1RoomRecordingRule struct for VideoV1RoomRecordingRule type VideoV1RoomRecordingRule struct { - // The SID of the Room resource for the Recording Rules + // The SID of the Room resource for the Recording Rules RoomSid *string `json:"room_sid,omitempty"` - // A collection of Recording Rules that describe how to include or exclude matching tracks for recording + // A collection of Recording Rules that describe how to include or exclude matching tracks for recording Rules *[]VideoV1RoomRoomRecordingRuleRules `json:"rules,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. DateUpdated *time.Time `json:"date_updated,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_room_participant_room_participant_subscribe_rule_rules.go b/rest/video/v1/model_video_v1_room_room_participant_room_participant_subscribe_rule_rules.go index 7bbe117c9..6ddcdddab 100644 --- a/rest/video/v1/model_video_v1_room_room_participant_room_participant_subscribe_rule_rules.go +++ b/rest/video/v1/model_video_v1_room_room_participant_room_participant_subscribe_rule_rules.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules struct for VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules type VideoV1RoomRoomParticipantRoomParticipantSubscribeRuleRules struct { - Type string `json:"type,omitempty"` - All bool `json:"all,omitempty"` + Type string `json:"type,omitempty"` + All bool `json:"all,omitempty"` Publisher string `json:"publisher,omitempty"` - Track string `json:"track,omitempty"` - Kind string `json:"kind,omitempty"` - Priority string `json:"priority,omitempty"` + Track string `json:"track,omitempty"` + Kind string `json:"kind,omitempty"` + Priority string `json:"priority,omitempty"` } + + diff --git a/rest/video/v1/model_video_v1_room_room_recording_rule_rules.go b/rest/video/v1/model_video_v1_room_room_recording_rule_rules.go index 9a214e36c..c6e1c9c96 100644 --- a/rest/video/v1/model_video_v1_room_room_recording_rule_rules.go +++ b/rest/video/v1/model_video_v1_room_room_recording_rule_rules.go @@ -13,12 +13,17 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VideoV1RoomRoomRecordingRuleRules struct for VideoV1RoomRoomRecordingRuleRules type VideoV1RoomRoomRecordingRuleRules struct { - Type string `json:"type,omitempty"` - All bool `json:"all,omitempty"` + Type string `json:"type,omitempty"` + All bool `json:"all,omitempty"` Publisher string `json:"publisher,omitempty"` - Track string `json:"track,omitempty"` - Kind string `json:"kind,omitempty"` + Track string `json:"track,omitempty"` + Kind string `json:"kind,omitempty"` } + + diff --git a/rest/video/v1/recording_settings_default.go b/rest/video/v1/recording_settings_default.go index 8b675feda..8ff5a818d 100644 --- a/rest/video/v1/recording_settings_default.go +++ b/rest/video/v1/recording_settings_default.go @@ -18,108 +18,114 @@ import ( "encoding/json" "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRecordingSettings' type CreateRecordingSettingsParams struct { - // A descriptive string that you create to describe the resource and be shown to users in the console - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID of the stored Credential resource. - AwsCredentialsSid *string `json:"AwsCredentialsSid,omitempty"` - // The SID of the Public Key resource to use for encryption. - EncryptionKeySid *string `json:"EncryptionKeySid,omitempty"` - // The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. - AwsS3Url *string `json:"AwsS3Url,omitempty"` - // Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. - AwsStorageEnabled *bool `json:"AwsStorageEnabled,omitempty"` - // Whether all recordings should be stored in an encrypted form. The default is `false`. - EncryptionEnabled *bool `json:"EncryptionEnabled,omitempty"` + // A descriptive string that you create to describe the resource and be shown to users in the console + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID of the stored Credential resource. + AwsCredentialsSid *string `json:"AwsCredentialsSid,omitempty"` + // The SID of the Public Key resource to use for encryption. + EncryptionKeySid *string `json:"EncryptionKeySid,omitempty"` + // The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + AwsS3Url *string `json:"AwsS3Url,omitempty"` + // Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. + AwsStorageEnabled *bool `json:"AwsStorageEnabled,omitempty"` + // Whether all recordings should be stored in an encrypted form. The default is `false`. + EncryptionEnabled *bool `json:"EncryptionEnabled,omitempty"` } -func (params *CreateRecordingSettingsParams) SetFriendlyName(FriendlyName string) *CreateRecordingSettingsParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRecordingSettingsParams) SetFriendlyName(FriendlyName string) (*CreateRecordingSettingsParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRecordingSettingsParams) SetAwsCredentialsSid(AwsCredentialsSid string) *CreateRecordingSettingsParams { - params.AwsCredentialsSid = &AwsCredentialsSid - return params +func (params *CreateRecordingSettingsParams) SetAwsCredentialsSid(AwsCredentialsSid string) (*CreateRecordingSettingsParams){ + params.AwsCredentialsSid = &AwsCredentialsSid + return params } -func (params *CreateRecordingSettingsParams) SetEncryptionKeySid(EncryptionKeySid string) *CreateRecordingSettingsParams { - params.EncryptionKeySid = &EncryptionKeySid - return params +func (params *CreateRecordingSettingsParams) SetEncryptionKeySid(EncryptionKeySid string) (*CreateRecordingSettingsParams){ + params.EncryptionKeySid = &EncryptionKeySid + return params } -func (params *CreateRecordingSettingsParams) SetAwsS3Url(AwsS3Url string) *CreateRecordingSettingsParams { - params.AwsS3Url = &AwsS3Url - return params +func (params *CreateRecordingSettingsParams) SetAwsS3Url(AwsS3Url string) (*CreateRecordingSettingsParams){ + params.AwsS3Url = &AwsS3Url + return params } -func (params *CreateRecordingSettingsParams) SetAwsStorageEnabled(AwsStorageEnabled bool) *CreateRecordingSettingsParams { - params.AwsStorageEnabled = &AwsStorageEnabled - return params +func (params *CreateRecordingSettingsParams) SetAwsStorageEnabled(AwsStorageEnabled bool) (*CreateRecordingSettingsParams){ + params.AwsStorageEnabled = &AwsStorageEnabled + return params } -func (params *CreateRecordingSettingsParams) SetEncryptionEnabled(EncryptionEnabled bool) *CreateRecordingSettingsParams { - params.EncryptionEnabled = &EncryptionEnabled - return params +func (params *CreateRecordingSettingsParams) SetEncryptionEnabled(EncryptionEnabled bool) (*CreateRecordingSettingsParams){ + params.EncryptionEnabled = &EncryptionEnabled + return params } -// +// func (c *ApiService) CreateRecordingSettings(params *CreateRecordingSettingsParams) (*VideoV1RecordingSettings, error) { - path := "/v1/RecordingSettings/Default" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.AwsCredentialsSid != nil { - data.Set("AwsCredentialsSid", *params.AwsCredentialsSid) - } - if params != nil && params.EncryptionKeySid != nil { - data.Set("EncryptionKeySid", *params.EncryptionKeySid) - } - if params != nil && params.AwsS3Url != nil { - data.Set("AwsS3Url", *params.AwsS3Url) - } - if params != nil && params.AwsStorageEnabled != nil { - data.Set("AwsStorageEnabled", fmt.Sprint(*params.AwsStorageEnabled)) - } - if params != nil && params.EncryptionEnabled != nil { - data.Set("EncryptionEnabled", fmt.Sprint(*params.EncryptionEnabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VideoV1RecordingSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/RecordingSettings/Default" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.AwsCredentialsSid != nil { + data.Set("AwsCredentialsSid", *params.AwsCredentialsSid) + } + if params != nil && params.EncryptionKeySid != nil { + data.Set("EncryptionKeySid", *params.EncryptionKeySid) + } + if params != nil && params.AwsS3Url != nil { + data.Set("AwsS3Url", *params.AwsS3Url) + } + if params != nil && params.AwsStorageEnabled != nil { + data.Set("AwsStorageEnabled", fmt.Sprint(*params.AwsStorageEnabled)) + } + if params != nil && params.EncryptionEnabled != nil { + data.Set("EncryptionEnabled", fmt.Sprint(*params.EncryptionEnabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1RecordingSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } -// +// func (c *ApiService) FetchRecordingSettings() (*VideoV1RecordingSettings, error) { - path := "/v1/RecordingSettings/Default" + path := "/v1/RecordingSettings/Default" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VideoV1RecordingSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VideoV1RecordingSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/recordings.go b/rest/video/v1/recordings.go index fede4f40f..2bf9bafa6 100644 --- a/rest/video/v1/recordings.go +++ b/rest/video/v1/recordings.go @@ -18,157 +18,161 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a Recording resource identified by a Recording SID. -func (c *ApiService) DeleteRecording(Sid string) error { - path := "/v1/Recordings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteRecording(Sid string, ) (error) { + path := "/v1/Recordings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Returns a single Recording resource identified by a Recording SID. -func (c *ApiService) FetchRecording(Sid string) (*VideoV1Recording, error) { - path := "/v1/Recordings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchRecording(Sid string, ) (*VideoV1Recording, error) { + path := "/v1/Recordings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VideoV1Recording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VideoV1Recording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRecording' type ListRecordingParams struct { - // Read only the recordings that have this status. Can be: `processing`, `completed`, or `deleted`. - Status *string `json:"Status,omitempty"` - // Read only the recordings that have this `source_sid`. - SourceSid *string `json:"SourceSid,omitempty"` - // Read only recordings with this `grouping_sid`, which may include a `participant_sid` and/or a `room_sid`. - GroupingSid *[]string `json:"GroupingSid,omitempty"` - // Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Read only recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or `YYYY-MM-DDThh:mm:ssZ`. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // Read only recordings that have this media type. Can be either `audio` or `video`. - MediaType *string `json:"MediaType,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Read only the recordings that have this status. Can be: `processing`, `completed`, or `deleted`. + Status *string `json:"Status,omitempty"` + // Read only the recordings that have this `source_sid`. + SourceSid *string `json:"SourceSid,omitempty"` + // Read only recordings with this `grouping_sid`, which may include a `participant_sid` and/or a `room_sid`. + GroupingSid *[]string `json:"GroupingSid,omitempty"` + // Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Read only recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or `YYYY-MM-DDThh:mm:ssZ`. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // Read only recordings that have this media type. Can be either `audio` or `video`. + MediaType *string `json:"MediaType,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRecordingParams) SetStatus(Status string) *ListRecordingParams { - params.Status = &Status - return params +func (params *ListRecordingParams) SetStatus(Status string) (*ListRecordingParams){ + params.Status = &Status + return params } -func (params *ListRecordingParams) SetSourceSid(SourceSid string) *ListRecordingParams { - params.SourceSid = &SourceSid - return params +func (params *ListRecordingParams) SetSourceSid(SourceSid string) (*ListRecordingParams){ + params.SourceSid = &SourceSid + return params } -func (params *ListRecordingParams) SetGroupingSid(GroupingSid []string) *ListRecordingParams { - params.GroupingSid = &GroupingSid - return params +func (params *ListRecordingParams) SetGroupingSid(GroupingSid []string) (*ListRecordingParams){ + params.GroupingSid = &GroupingSid + return params } -func (params *ListRecordingParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListRecordingParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListRecordingParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListRecordingParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListRecordingParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListRecordingParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListRecordingParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListRecordingParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListRecordingParams) SetMediaType(MediaType string) *ListRecordingParams { - params.MediaType = &MediaType - return params +func (params *ListRecordingParams) SetMediaType(MediaType string) (*ListRecordingParams){ + params.MediaType = &MediaType + return params } -func (params *ListRecordingParams) SetPageSize(PageSize int) *ListRecordingParams { - params.PageSize = &PageSize - return params +func (params *ListRecordingParams) SetPageSize(PageSize int) (*ListRecordingParams){ + params.PageSize = &PageSize + return params } -func (params *ListRecordingParams) SetLimit(Limit int) *ListRecordingParams { - params.Limit = &Limit - return params +func (params *ListRecordingParams) SetLimit(Limit int) (*ListRecordingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Recording records from the API. Request is executed immediately. func (c *ApiService) PageRecording(params *ListRecordingParams, pageToken, pageNumber string) (*ListRecordingResponse, error) { - path := "/v1/Recordings" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.SourceSid != nil { - data.Set("SourceSid", *params.SourceSid) - } - if params != nil && params.GroupingSid != nil { - for _, item := range *params.GroupingSid { - data.Add("GroupingSid", item) - } - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.MediaType != nil { - data.Set("MediaType", *params.MediaType) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Recordings" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.SourceSid != nil { + data.Set("SourceSid", *params.SourceSid) + } + if params != nil && params.GroupingSid != nil { + for _, item := range *params.GroupingSid { + data.Add("GroupingSid", item) + } + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.MediaType != nil { + data.Set("MediaType", *params.MediaType) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRecordingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Recording records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -209,6 +213,7 @@ func (c *ApiService) StreamRecording(params *ListRecordingParams) (chan VideoV1R return recordChannel, errorChannel } + func (c *ApiService) streamRecording(response *ListRecordingResponse, params *ListRecordingParams, recordChannel chan VideoV1Recording, errorChannel chan error) { curRecord := 1 @@ -240,19 +245,20 @@ func (c *ApiService) streamRecording(response *ListRecordingResponse, params *Li } func (c *ApiService) getNextListRecordingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRecordingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/video/v1/rooms.go b/rest/video/v1/rooms.go index 0ea1b2229..9b59338b5 100644 --- a/rest/video/v1/rooms.go +++ b/rest/video/v1/rooms.go @@ -18,290 +18,293 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRoom' type CreateRoomParams struct { - // Deprecated, now always considered to be true. - EnableTurn *bool `json:"EnableTurn,omitempty"` - // - Type *string `json:"Type,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - UniqueName *string `json:"UniqueName,omitempty"` - // The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - StatusCallback *string `json:"StatusCallback,omitempty"` - // The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. - MaxParticipants *int `json:"MaxParticipants,omitempty"` - // Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - RecordParticipantsOnConnect *bool `json:"RecordParticipantsOnConnect,omitempty"` - // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - VideoCodecs *[]string `json:"VideoCodecs,omitempty"` - // The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** - MediaRegion *string `json:"MediaRegion,omitempty"` - // A collection of Recording Rules that describe how to include or exclude matching tracks for recording - RecordingRules *interface{} `json:"RecordingRules,omitempty"` - // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. - AudioOnly *bool `json:"AudioOnly,omitempty"` - // The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). - MaxParticipantDuration *int `json:"MaxParticipantDuration,omitempty"` - // Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). - EmptyRoomTimeout *int `json:"EmptyRoomTimeout,omitempty"` - // Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). - UnusedRoomTimeout *int `json:"UnusedRoomTimeout,omitempty"` - // When set to true, indicated that this is the large room. - LargeRoom *bool `json:"LargeRoom,omitempty"` -} - -func (params *CreateRoomParams) SetEnableTurn(EnableTurn bool) *CreateRoomParams { - params.EnableTurn = &EnableTurn - return params -} -func (params *CreateRoomParams) SetType(Type string) *CreateRoomParams { - params.Type = &Type - return params -} -func (params *CreateRoomParams) SetUniqueName(UniqueName string) *CreateRoomParams { - params.UniqueName = &UniqueName - return params -} -func (params *CreateRoomParams) SetStatusCallback(StatusCallback string) *CreateRoomParams { - params.StatusCallback = &StatusCallback - return params -} -func (params *CreateRoomParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateRoomParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateRoomParams) SetMaxParticipants(MaxParticipants int) *CreateRoomParams { - params.MaxParticipants = &MaxParticipants - return params -} -func (params *CreateRoomParams) SetRecordParticipantsOnConnect(RecordParticipantsOnConnect bool) *CreateRoomParams { - params.RecordParticipantsOnConnect = &RecordParticipantsOnConnect - return params -} -func (params *CreateRoomParams) SetVideoCodecs(VideoCodecs []string) *CreateRoomParams { - params.VideoCodecs = &VideoCodecs - return params -} -func (params *CreateRoomParams) SetMediaRegion(MediaRegion string) *CreateRoomParams { - params.MediaRegion = &MediaRegion - return params -} -func (params *CreateRoomParams) SetRecordingRules(RecordingRules interface{}) *CreateRoomParams { - params.RecordingRules = &RecordingRules - return params -} -func (params *CreateRoomParams) SetAudioOnly(AudioOnly bool) *CreateRoomParams { - params.AudioOnly = &AudioOnly - return params -} -func (params *CreateRoomParams) SetMaxParticipantDuration(MaxParticipantDuration int) *CreateRoomParams { - params.MaxParticipantDuration = &MaxParticipantDuration - return params -} -func (params *CreateRoomParams) SetEmptyRoomTimeout(EmptyRoomTimeout int) *CreateRoomParams { - params.EmptyRoomTimeout = &EmptyRoomTimeout - return params -} -func (params *CreateRoomParams) SetUnusedRoomTimeout(UnusedRoomTimeout int) *CreateRoomParams { - params.UnusedRoomTimeout = &UnusedRoomTimeout - return params -} -func (params *CreateRoomParams) SetLargeRoom(LargeRoom bool) *CreateRoomParams { - params.LargeRoom = &LargeRoom - return params -} - -// + // Deprecated, now always considered to be true. + EnableTurn *bool `json:"EnableTurn,omitempty"` + // + Type *string `json:"Type,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. + UniqueName *string `json:"UniqueName,omitempty"` + // The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + StatusCallback *string `json:"StatusCallback,omitempty"` + // The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. + MaxParticipants *int `json:"MaxParticipants,omitempty"` + // Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** + RecordParticipantsOnConnect *bool `json:"RecordParticipantsOnConnect,omitempty"` + // An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** + VideoCodecs *[]string `json:"VideoCodecs,omitempty"` + // The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + MediaRegion *string `json:"MediaRegion,omitempty"` + // A collection of Recording Rules that describe how to include or exclude matching tracks for recording + RecordingRules *interface{} `json:"RecordingRules,omitempty"` + // When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + AudioOnly *bool `json:"AudioOnly,omitempty"` + // The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). + MaxParticipantDuration *int `json:"MaxParticipantDuration,omitempty"` + // Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). + EmptyRoomTimeout *int `json:"EmptyRoomTimeout,omitempty"` + // Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). + UnusedRoomTimeout *int `json:"UnusedRoomTimeout,omitempty"` + // When set to true, indicated that this is the large room. + LargeRoom *bool `json:"LargeRoom,omitempty"` +} + +func (params *CreateRoomParams) SetEnableTurn(EnableTurn bool) (*CreateRoomParams){ + params.EnableTurn = &EnableTurn + return params +} +func (params *CreateRoomParams) SetType(Type string) (*CreateRoomParams){ + params.Type = &Type + return params +} +func (params *CreateRoomParams) SetUniqueName(UniqueName string) (*CreateRoomParams){ + params.UniqueName = &UniqueName + return params +} +func (params *CreateRoomParams) SetStatusCallback(StatusCallback string) (*CreateRoomParams){ + params.StatusCallback = &StatusCallback + return params +} +func (params *CreateRoomParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateRoomParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateRoomParams) SetMaxParticipants(MaxParticipants int) (*CreateRoomParams){ + params.MaxParticipants = &MaxParticipants + return params +} +func (params *CreateRoomParams) SetRecordParticipantsOnConnect(RecordParticipantsOnConnect bool) (*CreateRoomParams){ + params.RecordParticipantsOnConnect = &RecordParticipantsOnConnect + return params +} +func (params *CreateRoomParams) SetVideoCodecs(VideoCodecs []string) (*CreateRoomParams){ + params.VideoCodecs = &VideoCodecs + return params +} +func (params *CreateRoomParams) SetMediaRegion(MediaRegion string) (*CreateRoomParams){ + params.MediaRegion = &MediaRegion + return params +} +func (params *CreateRoomParams) SetRecordingRules(RecordingRules interface{}) (*CreateRoomParams){ + params.RecordingRules = &RecordingRules + return params +} +func (params *CreateRoomParams) SetAudioOnly(AudioOnly bool) (*CreateRoomParams){ + params.AudioOnly = &AudioOnly + return params +} +func (params *CreateRoomParams) SetMaxParticipantDuration(MaxParticipantDuration int) (*CreateRoomParams){ + params.MaxParticipantDuration = &MaxParticipantDuration + return params +} +func (params *CreateRoomParams) SetEmptyRoomTimeout(EmptyRoomTimeout int) (*CreateRoomParams){ + params.EmptyRoomTimeout = &EmptyRoomTimeout + return params +} +func (params *CreateRoomParams) SetUnusedRoomTimeout(UnusedRoomTimeout int) (*CreateRoomParams){ + params.UnusedRoomTimeout = &UnusedRoomTimeout + return params +} +func (params *CreateRoomParams) SetLargeRoom(LargeRoom bool) (*CreateRoomParams){ + params.LargeRoom = &LargeRoom + return params +} + +// func (c *ApiService) CreateRoom(params *CreateRoomParams) (*VideoV1Room, error) { - path := "/v1/Rooms" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.EnableTurn != nil { - data.Set("EnableTurn", fmt.Sprint(*params.EnableTurn)) - } - if params != nil && params.Type != nil { - data.Set("Type", *params.Type) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.StatusCallback != nil { - data.Set("StatusCallback", *params.StatusCallback) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.MaxParticipants != nil { - data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) - } - if params != nil && params.RecordParticipantsOnConnect != nil { - data.Set("RecordParticipantsOnConnect", fmt.Sprint(*params.RecordParticipantsOnConnect)) - } - if params != nil && params.VideoCodecs != nil { - for _, item := range *params.VideoCodecs { - data.Add("VideoCodecs", item) - } - } - if params != nil && params.MediaRegion != nil { - data.Set("MediaRegion", *params.MediaRegion) - } - if params != nil && params.RecordingRules != nil { - v, err := json.Marshal(params.RecordingRules) - - if err != nil { - return nil, err - } - - data.Set("RecordingRules", string(v)) - } - if params != nil && params.AudioOnly != nil { - data.Set("AudioOnly", fmt.Sprint(*params.AudioOnly)) - } - if params != nil && params.MaxParticipantDuration != nil { - data.Set("MaxParticipantDuration", fmt.Sprint(*params.MaxParticipantDuration)) - } - if params != nil && params.EmptyRoomTimeout != nil { - data.Set("EmptyRoomTimeout", fmt.Sprint(*params.EmptyRoomTimeout)) - } - if params != nil && params.UnusedRoomTimeout != nil { - data.Set("UnusedRoomTimeout", fmt.Sprint(*params.UnusedRoomTimeout)) - } - if params != nil && params.LargeRoom != nil { - data.Set("LargeRoom", fmt.Sprint(*params.LargeRoom)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VideoV1Room{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err -} - -// -func (c *ApiService) FetchRoom(Sid string) (*VideoV1Room, error) { - path := "/v1/Rooms/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VideoV1Room{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Rooms" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.EnableTurn != nil { + data.Set("EnableTurn", fmt.Sprint(*params.EnableTurn)) + } + if params != nil && params.Type != nil { + data.Set("Type", *params.Type) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.StatusCallback != nil { + data.Set("StatusCallback", *params.StatusCallback) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.MaxParticipants != nil { + data.Set("MaxParticipants", fmt.Sprint(*params.MaxParticipants)) + } + if params != nil && params.RecordParticipantsOnConnect != nil { + data.Set("RecordParticipantsOnConnect", fmt.Sprint(*params.RecordParticipantsOnConnect)) + } + if params != nil && params.VideoCodecs != nil { + for _, item := range *params.VideoCodecs { + data.Add("VideoCodecs", item) + } + } + if params != nil && params.MediaRegion != nil { + data.Set("MediaRegion", *params.MediaRegion) + } + if params != nil && params.RecordingRules != nil { + v, err := json.Marshal(params.RecordingRules) + + if err != nil { + return nil, err + } + + data.Set("RecordingRules", string(v)) + } + if params != nil && params.AudioOnly != nil { + data.Set("AudioOnly", fmt.Sprint(*params.AudioOnly)) + } + if params != nil && params.MaxParticipantDuration != nil { + data.Set("MaxParticipantDuration", fmt.Sprint(*params.MaxParticipantDuration)) + } + if params != nil && params.EmptyRoomTimeout != nil { + data.Set("EmptyRoomTimeout", fmt.Sprint(*params.EmptyRoomTimeout)) + } + if params != nil && params.UnusedRoomTimeout != nil { + data.Set("UnusedRoomTimeout", fmt.Sprint(*params.UnusedRoomTimeout)) + } + if params != nil && params.LargeRoom != nil { + data.Set("LargeRoom", fmt.Sprint(*params.LargeRoom)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1Room{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} + +// +func (c *ApiService) FetchRoom(Sid string, ) (*VideoV1Room, error) { + path := "/v1/Rooms/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1Room{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRoom' type ListRoomParams struct { - // Read only the rooms with this status. Can be: `in-progress` (default) or `completed` - Status *string `json:"Status,omitempty"` - // Read only rooms with the this `unique_name`. - UniqueName *string `json:"UniqueName,omitempty"` - // Read only rooms that started on or after this date, given as `YYYY-MM-DD`. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Read only rooms that started before this date, given as `YYYY-MM-DD`. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Read only the rooms with this status. Can be: `in-progress` (default) or `completed` + Status *string `json:"Status,omitempty"` + // Read only rooms with the this `unique_name`. + UniqueName *string `json:"UniqueName,omitempty"` + // Read only rooms that started on or after this date, given as `YYYY-MM-DD`. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Read only rooms that started before this date, given as `YYYY-MM-DD`. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoomParams) SetStatus(Status string) *ListRoomParams { - params.Status = &Status - return params +func (params *ListRoomParams) SetStatus(Status string) (*ListRoomParams){ + params.Status = &Status + return params } -func (params *ListRoomParams) SetUniqueName(UniqueName string) *ListRoomParams { - params.UniqueName = &UniqueName - return params +func (params *ListRoomParams) SetUniqueName(UniqueName string) (*ListRoomParams){ + params.UniqueName = &UniqueName + return params } -func (params *ListRoomParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListRoomParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListRoomParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListRoomParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListRoomParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListRoomParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListRoomParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListRoomParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListRoomParams) SetPageSize(PageSize int) *ListRoomParams { - params.PageSize = &PageSize - return params +func (params *ListRoomParams) SetPageSize(PageSize int) (*ListRoomParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoomParams) SetLimit(Limit int) *ListRoomParams { - params.Limit = &Limit - return params +func (params *ListRoomParams) SetLimit(Limit int) (*ListRoomParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Room records from the API. Request is executed immediately. func (c *ApiService) PageRoom(params *ListRoomParams, pageToken, pageNumber string) (*ListRoomResponse, error) { - path := "/v1/Rooms" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Rooms" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Room records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -342,6 +345,7 @@ func (c *ApiService) StreamRoom(params *ListRoomParams) (chan VideoV1Room, chan return recordChannel, errorChannel } + func (c *ApiService) streamRoom(response *ListRoomResponse, params *ListRoomParams, recordChannel chan VideoV1Room, errorChannel chan error) { curRecord := 1 @@ -373,57 +377,59 @@ func (c *ApiService) streamRoom(response *ListRoomResponse, params *ListRoomPara } func (c *ApiService) getNextListRoomResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoomResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListRoomResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRoom' type UpdateRoomParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateRoomParams) SetStatus(Status string) *UpdateRoomParams { - params.Status = &Status - return params +func (params *UpdateRoomParams) SetStatus(Status string) (*UpdateRoomParams){ + params.Status = &Status + return params } -// +// func (c *ApiService) UpdateRoom(Sid string, params *UpdateRoomParams) (*VideoV1Room, error) { - path := "/v1/Rooms/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Rooms/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VideoV1Room{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VideoV1Room{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/rooms_participants.go b/rest/video/v1/rooms_participants.go index af815d01e..b76f9f7e9 100644 --- a/rest/video/v1/rooms_participants.go +++ b/rest/video/v1/rooms_participants.go @@ -18,122 +18,123 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) FetchRoomParticipant(RoomSid string, Sid string) (*VideoV1RoomParticipant, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) FetchRoomParticipant(RoomSid string, Sid string, ) (*VideoV1RoomParticipant, error) { + path := "/v1/Rooms/{RoomSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + data := url.Values{} + headers := make(map[string]interface{}) - defer resp.Body.Close() - ps := &VideoV1RoomParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VideoV1RoomParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRoomParticipant' type ListRoomParticipantParams struct { - // Read only the participants with this status. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. - Status *string `json:"Status,omitempty"` - // Read only the Participants with this [User](https://www.twilio.com/docs/chat/rest/user-resource) `identity` value. - Identity *string `json:"Identity,omitempty"` - // Read only Participants that started after this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Read only Participants that started before this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Read only the participants with this status. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. + Status *string `json:"Status,omitempty"` + // Read only the Participants with this [User](https://www.twilio.com/docs/chat/rest/user-resource) `identity` value. + Identity *string `json:"Identity,omitempty"` + // Read only Participants that started after this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Read only Participants that started before this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoomParticipantParams) SetStatus(Status string) *ListRoomParticipantParams { - params.Status = &Status - return params +func (params *ListRoomParticipantParams) SetStatus(Status string) (*ListRoomParticipantParams){ + params.Status = &Status + return params } -func (params *ListRoomParticipantParams) SetIdentity(Identity string) *ListRoomParticipantParams { - params.Identity = &Identity - return params +func (params *ListRoomParticipantParams) SetIdentity(Identity string) (*ListRoomParticipantParams){ + params.Identity = &Identity + return params } -func (params *ListRoomParticipantParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListRoomParticipantParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListRoomParticipantParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListRoomParticipantParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListRoomParticipantParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListRoomParticipantParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListRoomParticipantParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListRoomParticipantParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListRoomParticipantParams) SetPageSize(PageSize int) *ListRoomParticipantParams { - params.PageSize = &PageSize - return params +func (params *ListRoomParticipantParams) SetPageSize(PageSize int) (*ListRoomParticipantParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoomParticipantParams) SetLimit(Limit int) *ListRoomParticipantParams { - params.Limit = &Limit - return params +func (params *ListRoomParticipantParams) SetLimit(Limit int) (*ListRoomParticipantParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RoomParticipant records from the API. Request is executed immediately. func (c *ApiService) PageRoomParticipant(RoomSid string, params *ListRoomParticipantParams, pageToken, pageNumber string) (*ListRoomParticipantResponse, error) { - path := "/v1/Rooms/{RoomSid}/Participants" - - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Identity != nil { - data.Set("Identity", *params.Identity) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Rooms/{RoomSid}/Participants" + + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Identity != nil { + data.Set("Identity", *params.Identity) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists RoomParticipant records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -174,6 +175,7 @@ func (c *ApiService) StreamRoomParticipant(RoomSid string, params *ListRoomParti return recordChannel, errorChannel } + func (c *ApiService) streamRoomParticipant(response *ListRoomParticipantResponse, params *ListRoomParticipantParams, recordChannel chan VideoV1RoomParticipant, errorChannel chan error) { curRecord := 1 @@ -205,58 +207,60 @@ func (c *ApiService) streamRoomParticipant(response *ListRoomParticipantResponse } func (c *ApiService) getNextListRoomParticipantResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomParticipantResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomParticipantResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRoomParticipant' type UpdateRoomParticipantParams struct { - // - Status *string `json:"Status,omitempty"` + // + Status *string `json:"Status,omitempty"` } -func (params *UpdateRoomParticipantParams) SetStatus(Status string) *UpdateRoomParticipantParams { - params.Status = &Status - return params +func (params *UpdateRoomParticipantParams) SetStatus(Status string) (*UpdateRoomParticipantParams){ + params.Status = &Status + return params } -// +// func (c *ApiService) UpdateRoomParticipant(RoomSid string, Sid string, params *UpdateRoomParticipantParams) (*VideoV1RoomParticipant, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{Sid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/Rooms/{RoomSid}/Participants/{Sid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VideoV1RoomParticipant{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VideoV1RoomParticipant{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/rooms_participants_anonymize.go b/rest/video/v1/rooms_participants_anonymize.go index 509352a4d..ddfd7f082 100644 --- a/rest/video/v1/rooms_participants_anonymize.go +++ b/rest/video/v1/rooms_participants_anonymize.go @@ -16,30 +16,35 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) UpdateRoomParticipantAnonymize(RoomSid string, Sid string) (*VideoV1RoomParticipantAnonymize, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{Sid}/Anonymize" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) UpdateRoomParticipantAnonymize(RoomSid string, Sid string, ) (*VideoV1RoomParticipantAnonymize, error) { + path := "/v1/Rooms/{RoomSid}/Participants/{Sid}/Anonymize" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VideoV1RoomParticipantAnonymize{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VideoV1RoomParticipantAnonymize{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/rooms_participants_published_tracks.go b/rest/video/v1/rooms_participants_published_tracks.go index 940564dc0..dfd3b56bf 100644 --- a/rest/video/v1/rooms_participants_published_tracks.go +++ b/rest/video/v1/rooms_participants_published_tracks.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Returns a single Track resource represented by TrackName or SID. -func (c *ApiService) FetchRoomParticipantPublishedTrack(RoomSid string, ParticipantSid string, Sid string) (*VideoV1RoomParticipantPublishedTrack, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/PublishedTracks/{Sid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchRoomParticipantPublishedTrack(RoomSid string, ParticipantSid string, Sid string, ) (*VideoV1RoomParticipantPublishedTrack, error) { + path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/PublishedTracks/{Sid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VideoV1RoomParticipantPublishedTrack{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VideoV1RoomParticipantPublishedTrack{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRoomParticipantPublishedTrack' type ListRoomParticipantPublishedTrackParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoomParticipantPublishedTrackParams) SetPageSize(PageSize int) *ListRoomParticipantPublishedTrackParams { - params.PageSize = &PageSize - return params +func (params *ListRoomParticipantPublishedTrackParams) SetPageSize(PageSize int) (*ListRoomParticipantPublishedTrackParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoomParticipantPublishedTrackParams) SetLimit(Limit int) *ListRoomParticipantPublishedTrackParams { - params.Limit = &Limit - return params +func (params *ListRoomParticipantPublishedTrackParams) SetLimit(Limit int) (*ListRoomParticipantPublishedTrackParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RoomParticipantPublishedTrack records from the API. Request is executed immediately. func (c *ApiService) PageRoomParticipantPublishedTrack(RoomSid string, ParticipantSid string, params *ListRoomParticipantPublishedTrackParams, pageToken, pageNumber string) (*ListRoomParticipantPublishedTrackResponse, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/PublishedTracks" + path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/PublishedTracks" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoomParticipantPublishedTrackResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoomParticipantPublishedTrackResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RoomParticipantPublishedTrack records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamRoomParticipantPublishedTrack(RoomSid string, Partici return recordChannel, errorChannel } + func (c *ApiService) streamRoomParticipantPublishedTrack(response *ListRoomParticipantPublishedTrackResponse, params *ListRoomParticipantPublishedTrackParams, recordChannel chan VideoV1RoomParticipantPublishedTrack, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamRoomParticipantPublishedTrack(response *ListRoomParti } func (c *ApiService) getNextListRoomParticipantPublishedTrackResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomParticipantPublishedTrackResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomParticipantPublishedTrackResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/video/v1/rooms_participants_subscribe_rules.go b/rest/video/v1/rooms_participants_subscribe_rules.go index 551ff66a2..f442d467b 100644 --- a/rest/video/v1/rooms_participants_subscribe_rules.go +++ b/rest/video/v1/rooms_participants_subscribe_rules.go @@ -16,75 +16,81 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Returns a list of Subscribe Rules for the Participant. -func (c *ApiService) FetchRoomParticipantSubscribeRule(RoomSid string, ParticipantSid string) (*VideoV1RoomParticipantSubscribeRule, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribeRules" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) +func (c *ApiService) FetchRoomParticipantSubscribeRule(RoomSid string, ParticipantSid string, ) (*VideoV1RoomParticipantSubscribeRule, error) { + path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribeRules" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VideoV1RoomParticipantSubscribeRule{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &VideoV1RoomParticipantSubscribeRule{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateRoomParticipantSubscribeRule' type UpdateRoomParticipantSubscribeRuleParams struct { - // A JSON-encoded array of subscribe rules. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. - Rules *interface{} `json:"Rules,omitempty"` + // A JSON-encoded array of subscribe rules. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. + Rules *interface{} `json:"Rules,omitempty"` } -func (params *UpdateRoomParticipantSubscribeRuleParams) SetRules(Rules interface{}) *UpdateRoomParticipantSubscribeRuleParams { - params.Rules = &Rules - return params +func (params *UpdateRoomParticipantSubscribeRuleParams) SetRules(Rules interface{}) (*UpdateRoomParticipantSubscribeRuleParams){ + params.Rules = &Rules + return params } // Update the Subscribe Rules for the Participant func (c *ApiService) UpdateRoomParticipantSubscribeRule(RoomSid string, ParticipantSid string, params *UpdateRoomParticipantSubscribeRuleParams) (*VideoV1RoomParticipantSubscribeRule, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribeRules" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribeRules" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Rules != nil { + v, err := json.Marshal(params.Rules) - if params != nil && params.Rules != nil { - v, err := json.Marshal(params.Rules) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Rules", string(v)) + } - data.Set("Rules", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VideoV1RoomParticipantSubscribeRule{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VideoV1RoomParticipantSubscribeRule{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/rooms_participants_subscribed_tracks.go b/rest/video/v1/rooms_participants_subscribed_tracks.go index fa5525002..7f95508e3 100644 --- a/rest/video/v1/rooms_participants_subscribed_tracks.go +++ b/rest/video/v1/rooms_participants_subscribed_tracks.go @@ -18,87 +18,89 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Returns a single Track resource represented by `track_sid`. Note: This is one resource with the Video API that requires a SID, be Track Name on the subscriber side is not guaranteed to be unique. -func (c *ApiService) FetchRoomParticipantSubscribedTrack(RoomSid string, ParticipantSid string, Sid string) (*VideoV1RoomParticipantSubscribedTrack, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribedTracks/{Sid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchRoomParticipantSubscribedTrack(RoomSid string, ParticipantSid string, Sid string, ) (*VideoV1RoomParticipantSubscribedTrack, error) { + path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribedTracks/{Sid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VideoV1RoomParticipantSubscribedTrack{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VideoV1RoomParticipantSubscribedTrack{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRoomParticipantSubscribedTrack' type ListRoomParticipantSubscribedTrackParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoomParticipantSubscribedTrackParams) SetPageSize(PageSize int) *ListRoomParticipantSubscribedTrackParams { - params.PageSize = &PageSize - return params +func (params *ListRoomParticipantSubscribedTrackParams) SetPageSize(PageSize int) (*ListRoomParticipantSubscribedTrackParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoomParticipantSubscribedTrackParams) SetLimit(Limit int) *ListRoomParticipantSubscribedTrackParams { - params.Limit = &Limit - return params +func (params *ListRoomParticipantSubscribedTrackParams) SetLimit(Limit int) (*ListRoomParticipantSubscribedTrackParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RoomParticipantSubscribedTrack records from the API. Request is executed immediately. func (c *ApiService) PageRoomParticipantSubscribedTrack(RoomSid string, ParticipantSid string, params *ListRoomParticipantSubscribedTrackParams, pageToken, pageNumber string) (*ListRoomParticipantSubscribedTrackResponse, error) { - path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribedTracks" + path := "/v1/Rooms/{RoomSid}/Participants/{ParticipantSid}/SubscribedTracks" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"ParticipantSid"+"}", ParticipantSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRoomParticipantSubscribedTrackResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRoomParticipantSubscribedTrackResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RoomParticipantSubscribedTrack records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -139,6 +141,7 @@ func (c *ApiService) StreamRoomParticipantSubscribedTrack(RoomSid string, Partic return recordChannel, errorChannel } + func (c *ApiService) streamRoomParticipantSubscribedTrack(response *ListRoomParticipantSubscribedTrackResponse, params *ListRoomParticipantSubscribedTrackParams, recordChannel chan VideoV1RoomParticipantSubscribedTrack, errorChannel chan error) { curRecord := 1 @@ -170,19 +173,20 @@ func (c *ApiService) streamRoomParticipantSubscribedTrack(response *ListRoomPart } func (c *ApiService) getNextListRoomParticipantSubscribedTrackResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomParticipantSubscribedTrackResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomParticipantSubscribedTrackResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/video/v1/rooms_recording_rules.go b/rest/video/v1/rooms_recording_rules.go index 2553d3a4b..17d2a189f 100644 --- a/rest/video/v1/rooms_recording_rules.go +++ b/rest/video/v1/rooms_recording_rules.go @@ -16,73 +16,79 @@ package openapi import ( "encoding/json" + "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Returns a list of Recording Rules for the Room. -func (c *ApiService) FetchRoomRecordingRule(RoomSid string) (*VideoV1RoomRecordingRule, error) { - path := "/v1/Rooms/{RoomSid}/RecordingRules" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) +func (c *ApiService) FetchRoomRecordingRule(RoomSid string, ) (*VideoV1RoomRecordingRule, error) { + path := "/v1/Rooms/{RoomSid}/RecordingRules" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VideoV1RoomRecordingRule{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() - return ps, err + ps := &VideoV1RoomRecordingRule{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'UpdateRoomRecordingRule' type UpdateRoomRecordingRuleParams struct { - // A JSON-encoded array of recording rules. - Rules *interface{} `json:"Rules,omitempty"` + // A JSON-encoded array of recording rules. + Rules *interface{} `json:"Rules,omitempty"` } -func (params *UpdateRoomRecordingRuleParams) SetRules(Rules interface{}) *UpdateRoomRecordingRuleParams { - params.Rules = &Rules - return params +func (params *UpdateRoomRecordingRuleParams) SetRules(Rules interface{}) (*UpdateRoomRecordingRuleParams){ + params.Rules = &Rules + return params } // Update the Recording Rules for the Room func (c *ApiService) UpdateRoomRecordingRule(RoomSid string, params *UpdateRoomRecordingRuleParams) (*VideoV1RoomRecordingRule, error) { - path := "/v1/Rooms/{RoomSid}/RecordingRules" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path := "/v1/Rooms/{RoomSid}/RecordingRules" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.Rules != nil { + v, err := json.Marshal(params.Rules) - if params != nil && params.Rules != nil { - v, err := json.Marshal(params.Rules) + if err != nil { + return nil, err + } - if err != nil { - return nil, err - } + data.Set("Rules", string(v)) + } - data.Set("Rules", string(v)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VideoV1RoomRecordingRule{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VideoV1RoomRecordingRule{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/video/v1/rooms_recordings.go b/rest/video/v1/rooms_recordings.go index 37b72820c..48b33396e 100644 --- a/rest/video/v1/rooms_recordings.go +++ b/rest/video/v1/rooms_recordings.go @@ -18,141 +18,144 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) -// -func (c *ApiService) DeleteRoomRecording(RoomSid string, Sid string) error { - path := "/v1/Rooms/{RoomSid}/Recordings/{Sid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteRoomRecording(RoomSid string, Sid string, ) (error) { + path := "/v1/Rooms/{RoomSid}/Recordings/{Sid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchRoomRecording(RoomSid string, Sid string) (*VideoV1RoomRecording, error) { - path := "/v1/Rooms/{RoomSid}/Recordings/{Sid}" - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchRoomRecording(RoomSid string, Sid string, ) (*VideoV1RoomRecording, error) { + path := "/v1/Rooms/{RoomSid}/Recordings/{Sid}" + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VideoV1RoomRecording{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VideoV1RoomRecording{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListRoomRecording' type ListRoomRecordingParams struct { - // Read only the recordings with this status. Can be: `processing`, `completed`, or `deleted`. - Status *string `json:"Status,omitempty"` - // Read only the recordings that have this `source_sid`. - SourceSid *string `json:"SourceSid,omitempty"` - // Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. - DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` - // Read only Recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. - DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Read only the recordings with this status. Can be: `processing`, `completed`, or `deleted`. + Status *string `json:"Status,omitempty"` + // Read only the recordings that have this `source_sid`. + SourceSid *string `json:"SourceSid,omitempty"` + // Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. + DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"` + // Read only Recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. + DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRoomRecordingParams) SetStatus(Status string) *ListRoomRecordingParams { - params.Status = &Status - return params +func (params *ListRoomRecordingParams) SetStatus(Status string) (*ListRoomRecordingParams){ + params.Status = &Status + return params } -func (params *ListRoomRecordingParams) SetSourceSid(SourceSid string) *ListRoomRecordingParams { - params.SourceSid = &SourceSid - return params +func (params *ListRoomRecordingParams) SetSourceSid(SourceSid string) (*ListRoomRecordingParams){ + params.SourceSid = &SourceSid + return params } -func (params *ListRoomRecordingParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListRoomRecordingParams { - params.DateCreatedAfter = &DateCreatedAfter - return params +func (params *ListRoomRecordingParams) SetDateCreatedAfter(DateCreatedAfter time.Time) (*ListRoomRecordingParams){ + params.DateCreatedAfter = &DateCreatedAfter + return params } -func (params *ListRoomRecordingParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListRoomRecordingParams { - params.DateCreatedBefore = &DateCreatedBefore - return params +func (params *ListRoomRecordingParams) SetDateCreatedBefore(DateCreatedBefore time.Time) (*ListRoomRecordingParams){ + params.DateCreatedBefore = &DateCreatedBefore + return params } -func (params *ListRoomRecordingParams) SetPageSize(PageSize int) *ListRoomRecordingParams { - params.PageSize = &PageSize - return params +func (params *ListRoomRecordingParams) SetPageSize(PageSize int) (*ListRoomRecordingParams){ + params.PageSize = &PageSize + return params } -func (params *ListRoomRecordingParams) SetLimit(Limit int) *ListRoomRecordingParams { - params.Limit = &Limit - return params +func (params *ListRoomRecordingParams) SetLimit(Limit int) (*ListRoomRecordingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RoomRecording records from the API. Request is executed immediately. func (c *ApiService) PageRoomRecording(RoomSid string, params *ListRoomRecordingParams, pageToken, pageNumber string) (*ListRoomRecordingResponse, error) { - path := "/v1/Rooms/{RoomSid}/Recordings" - - path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.SourceSid != nil { - data.Set("SourceSid", *params.SourceSid) - } - if params != nil && params.DateCreatedAfter != nil { - data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) - } - if params != nil && params.DateCreatedBefore != nil { - data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Rooms/{RoomSid}/Recordings" + + path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.SourceSid != nil { + data.Set("SourceSid", *params.SourceSid) + } + if params != nil && params.DateCreatedAfter != nil { + data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339))) + } + if params != nil && params.DateCreatedBefore != nil { + data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339))) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomRecordingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists RoomRecording records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -193,6 +196,7 @@ func (c *ApiService) StreamRoomRecording(RoomSid string, params *ListRoomRecordi return recordChannel, errorChannel } + func (c *ApiService) streamRoomRecording(response *ListRoomRecordingResponse, params *ListRoomRecordingParams, recordChannel chan VideoV1RoomRecording, errorChannel chan error) { curRecord := 1 @@ -224,19 +228,20 @@ func (c *ApiService) streamRoomRecording(response *ListRoomRecordingResponse, pa } func (c *ApiService) getNextListRoomRecordingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRoomRecordingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRoomRecordingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/voice/v1/README.md b/rest/voice/v1/README.md index 8b2db519f..c6796474a 100644 --- a/rest/voice/v1/README.md +++ b/rest/voice/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/voice/v1/api_service.go b/rest/voice/v1/api_service.go index f8b84c0a6..1da6a4756 100644 --- a/rest/voice/v1/api_service.go +++ b/rest/voice/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://voice.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/voice/v1/archives_calls.go b/rest/voice/v1/archives_calls.go index 2749cb824..f72918453 100644 --- a/rest/voice/v1/archives_calls.go +++ b/rest/voice/v1/archives_calls.go @@ -15,26 +15,31 @@ package openapi import ( + "encoding/json" "fmt" "net/url" - "strings" + + "github.com/twilio/twilio-go/client" ) + // Delete an archived call record from Bulk Export. Note: this does not also delete the record from the Voice API. -func (c *ApiService) DeleteArchivedCall(Date string, Sid string) error { - path := "/v1/Archives/{Date}/Calls/{Sid}" - path = strings.Replace(path, "{"+"Date"+"}", fmt.Sprint(Date), -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteArchivedCall(Date string, Sid string, ) (error) { + path := "/v1/Archives/{Date}/Calls/{Sid}" + path = strings.Replace(path, "{"+"Date"+"}", fmt.Sprint(Date), -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - defer resp.Body.Close() + defer resp.Body.Close() - return nil + return nil } diff --git a/rest/voice/v1/byoc_trunks.go b/rest/voice/v1/byoc_trunks.go index 8bc50ff79..91af54bd5 100644 --- a/rest/voice/v1/byoc_trunks.go +++ b/rest/voice/v1/byoc_trunks.go @@ -18,218 +18,224 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateByocTrunk' type CreateByocTrunkParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we should call when the BYOC Trunk receives a call. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call to pass status parameters (such as call ended) to your application. - StatusCallbackUrl *string `json:"StatusCallbackUrl,omitempty"` - // The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. - CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` - // The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. - ConnectionPolicySid *string `json:"ConnectionPolicySid,omitempty"` - // The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \\\"call back\\\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \\\"sip.twilio.com\\\". - FromDomainSid *string `json:"FromDomainSid,omitempty"` -} - -func (params *CreateByocTrunkParams) SetFriendlyName(FriendlyName string) *CreateByocTrunkParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *CreateByocTrunkParams) SetVoiceUrl(VoiceUrl string) *CreateByocTrunkParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *CreateByocTrunkParams) SetVoiceMethod(VoiceMethod string) *CreateByocTrunkParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *CreateByocTrunkParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *CreateByocTrunkParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *CreateByocTrunkParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *CreateByocTrunkParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *CreateByocTrunkParams) SetStatusCallbackUrl(StatusCallbackUrl string) *CreateByocTrunkParams { - params.StatusCallbackUrl = &StatusCallbackUrl - return params -} -func (params *CreateByocTrunkParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateByocTrunkParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *CreateByocTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) *CreateByocTrunkParams { - params.CnamLookupEnabled = &CnamLookupEnabled - return params -} -func (params *CreateByocTrunkParams) SetConnectionPolicySid(ConnectionPolicySid string) *CreateByocTrunkParams { - params.ConnectionPolicySid = &ConnectionPolicySid - return params -} -func (params *CreateByocTrunkParams) SetFromDomainSid(FromDomainSid string) *CreateByocTrunkParams { - params.FromDomainSid = &FromDomainSid - return params -} - -// + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we should call when the BYOC Trunk receives a call. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call to pass status parameters (such as call ended) to your application. + StatusCallbackUrl *string `json:"StatusCallbackUrl,omitempty"` + // The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` + // The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. + ConnectionPolicySid *string `json:"ConnectionPolicySid,omitempty"` + // The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \\\"call back\\\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \\\"sip.twilio.com\\\". + FromDomainSid *string `json:"FromDomainSid,omitempty"` +} + +func (params *CreateByocTrunkParams) SetFriendlyName(FriendlyName string) (*CreateByocTrunkParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *CreateByocTrunkParams) SetVoiceUrl(VoiceUrl string) (*CreateByocTrunkParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *CreateByocTrunkParams) SetVoiceMethod(VoiceMethod string) (*CreateByocTrunkParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *CreateByocTrunkParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*CreateByocTrunkParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *CreateByocTrunkParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*CreateByocTrunkParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *CreateByocTrunkParams) SetStatusCallbackUrl(StatusCallbackUrl string) (*CreateByocTrunkParams){ + params.StatusCallbackUrl = &StatusCallbackUrl + return params +} +func (params *CreateByocTrunkParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*CreateByocTrunkParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *CreateByocTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) (*CreateByocTrunkParams){ + params.CnamLookupEnabled = &CnamLookupEnabled + return params +} +func (params *CreateByocTrunkParams) SetConnectionPolicySid(ConnectionPolicySid string) (*CreateByocTrunkParams){ + params.ConnectionPolicySid = &ConnectionPolicySid + return params +} +func (params *CreateByocTrunkParams) SetFromDomainSid(FromDomainSid string) (*CreateByocTrunkParams){ + params.FromDomainSid = &FromDomainSid + return params +} + +// func (c *ApiService) CreateByocTrunk(params *CreateByocTrunkParams) (*VoiceV1ByocTrunk, error) { - path := "/v1/ByocTrunks" + path := "/v1/ByocTrunks" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.StatusCallbackUrl != nil { + data.Set("StatusCallbackUrl", *params.StatusCallbackUrl) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.CnamLookupEnabled != nil { + data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) + } + if params != nil && params.ConnectionPolicySid != nil { + data.Set("ConnectionPolicySid", *params.ConnectionPolicySid) + } + if params != nil && params.FromDomainSid != nil { + data.Set("FromDomainSid", *params.FromDomainSid) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.StatusCallbackUrl != nil { - data.Set("StatusCallbackUrl", *params.StatusCallbackUrl) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.CnamLookupEnabled != nil { - data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) - } - if params != nil && params.ConnectionPolicySid != nil { - data.Set("ConnectionPolicySid", *params.ConnectionPolicySid) - } - if params != nil && params.FromDomainSid != nil { - data.Set("FromDomainSid", *params.FromDomainSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1ByocTrunk{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1ByocTrunk{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteByocTrunk(Sid string) error { - path := "/v1/ByocTrunks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteByocTrunk(Sid string, ) (error) { + path := "/v1/ByocTrunks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchByocTrunk(Sid string) (*VoiceV1ByocTrunk, error) { - path := "/v1/ByocTrunks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchByocTrunk(Sid string, ) (*VoiceV1ByocTrunk, error) { + path := "/v1/ByocTrunks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VoiceV1ByocTrunk{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VoiceV1ByocTrunk{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListByocTrunk' type ListByocTrunkParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListByocTrunkParams) SetPageSize(PageSize int) *ListByocTrunkParams { - params.PageSize = &PageSize - return params +func (params *ListByocTrunkParams) SetPageSize(PageSize int) (*ListByocTrunkParams){ + params.PageSize = &PageSize + return params } -func (params *ListByocTrunkParams) SetLimit(Limit int) *ListByocTrunkParams { - params.Limit = &Limit - return params +func (params *ListByocTrunkParams) SetLimit(Limit int) (*ListByocTrunkParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ByocTrunk records from the API. Request is executed immediately. func (c *ApiService) PageByocTrunk(params *ListByocTrunkParams, pageToken, pageNumber string) (*ListByocTrunkResponse, error) { - path := "/v1/ByocTrunks" + path := "/v1/ByocTrunks" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListByocTrunkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListByocTrunkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ByocTrunk records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -270,6 +276,7 @@ func (c *ApiService) StreamByocTrunk(params *ListByocTrunkParams) (chan VoiceV1B return recordChannel, errorChannel } + func (c *ApiService) streamByocTrunk(response *ListByocTrunkResponse, params *ListByocTrunkParams, recordChannel chan VoiceV1ByocTrunk, errorChannel chan error) { curRecord := 1 @@ -301,138 +308,140 @@ func (c *ApiService) streamByocTrunk(response *ListByocTrunkResponse, params *Li } func (c *ApiService) getNextListByocTrunkResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListByocTrunkResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListByocTrunkResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateByocTrunk' type UpdateByocTrunkParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The URL we should call when the BYOC Trunk receives a call. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // The HTTP method we should use to call `voice_url` - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // The URL that we should call to pass status parameters (such as call ended) to your application. - StatusCallbackUrl *string `json:"StatusCallbackUrl,omitempty"` - // The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. - StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` - // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. - CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` - // The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. - ConnectionPolicySid *string `json:"ConnectionPolicySid,omitempty"` - // The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \\\"call back\\\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \\\"sip.twilio.com\\\". - FromDomainSid *string `json:"FromDomainSid,omitempty"` -} - -func (params *UpdateByocTrunkParams) SetFriendlyName(FriendlyName string) *UpdateByocTrunkParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateByocTrunkParams) SetVoiceUrl(VoiceUrl string) *UpdateByocTrunkParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *UpdateByocTrunkParams) SetVoiceMethod(VoiceMethod string) *UpdateByocTrunkParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *UpdateByocTrunkParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *UpdateByocTrunkParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *UpdateByocTrunkParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *UpdateByocTrunkParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *UpdateByocTrunkParams) SetStatusCallbackUrl(StatusCallbackUrl string) *UpdateByocTrunkParams { - params.StatusCallbackUrl = &StatusCallbackUrl - return params -} -func (params *UpdateByocTrunkParams) SetStatusCallbackMethod(StatusCallbackMethod string) *UpdateByocTrunkParams { - params.StatusCallbackMethod = &StatusCallbackMethod - return params -} -func (params *UpdateByocTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) *UpdateByocTrunkParams { - params.CnamLookupEnabled = &CnamLookupEnabled - return params -} -func (params *UpdateByocTrunkParams) SetConnectionPolicySid(ConnectionPolicySid string) *UpdateByocTrunkParams { - params.ConnectionPolicySid = &ConnectionPolicySid - return params -} -func (params *UpdateByocTrunkParams) SetFromDomainSid(FromDomainSid string) *UpdateByocTrunkParams { - params.FromDomainSid = &FromDomainSid - return params -} - -// + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The URL we should call when the BYOC Trunk receives a call. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // The HTTP method we should use to call `voice_url` + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // The URL that we should call to pass status parameters (such as call ended) to your application. + StatusCallbackUrl *string `json:"StatusCallbackUrl,omitempty"` + // The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. + StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"` + // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + CnamLookupEnabled *bool `json:"CnamLookupEnabled,omitempty"` + // The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. + ConnectionPolicySid *string `json:"ConnectionPolicySid,omitempty"` + // The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \\\"call back\\\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \\\"sip.twilio.com\\\". + FromDomainSid *string `json:"FromDomainSid,omitempty"` +} + +func (params *UpdateByocTrunkParams) SetFriendlyName(FriendlyName string) (*UpdateByocTrunkParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateByocTrunkParams) SetVoiceUrl(VoiceUrl string) (*UpdateByocTrunkParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *UpdateByocTrunkParams) SetVoiceMethod(VoiceMethod string) (*UpdateByocTrunkParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *UpdateByocTrunkParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*UpdateByocTrunkParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *UpdateByocTrunkParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*UpdateByocTrunkParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *UpdateByocTrunkParams) SetStatusCallbackUrl(StatusCallbackUrl string) (*UpdateByocTrunkParams){ + params.StatusCallbackUrl = &StatusCallbackUrl + return params +} +func (params *UpdateByocTrunkParams) SetStatusCallbackMethod(StatusCallbackMethod string) (*UpdateByocTrunkParams){ + params.StatusCallbackMethod = &StatusCallbackMethod + return params +} +func (params *UpdateByocTrunkParams) SetCnamLookupEnabled(CnamLookupEnabled bool) (*UpdateByocTrunkParams){ + params.CnamLookupEnabled = &CnamLookupEnabled + return params +} +func (params *UpdateByocTrunkParams) SetConnectionPolicySid(ConnectionPolicySid string) (*UpdateByocTrunkParams){ + params.ConnectionPolicySid = &ConnectionPolicySid + return params +} +func (params *UpdateByocTrunkParams) SetFromDomainSid(FromDomainSid string) (*UpdateByocTrunkParams){ + params.FromDomainSid = &FromDomainSid + return params +} + +// func (c *ApiService) UpdateByocTrunk(Sid string, params *UpdateByocTrunkParams) (*VoiceV1ByocTrunk, error) { - path := "/v1/ByocTrunks/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.StatusCallbackUrl != nil { - data.Set("StatusCallbackUrl", *params.StatusCallbackUrl) - } - if params != nil && params.StatusCallbackMethod != nil { - data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) - } - if params != nil && params.CnamLookupEnabled != nil { - data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) - } - if params != nil && params.ConnectionPolicySid != nil { - data.Set("ConnectionPolicySid", *params.ConnectionPolicySid) - } - if params != nil && params.FromDomainSid != nil { - data.Set("FromDomainSid", *params.FromDomainSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VoiceV1ByocTrunk{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/ByocTrunks/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.StatusCallbackUrl != nil { + data.Set("StatusCallbackUrl", *params.StatusCallbackUrl) + } + if params != nil && params.StatusCallbackMethod != nil { + data.Set("StatusCallbackMethod", *params.StatusCallbackMethod) + } + if params != nil && params.CnamLookupEnabled != nil { + data.Set("CnamLookupEnabled", fmt.Sprint(*params.CnamLookupEnabled)) + } + if params != nil && params.ConnectionPolicySid != nil { + data.Set("ConnectionPolicySid", *params.ConnectionPolicySid) + } + if params != nil && params.FromDomainSid != nil { + data.Set("FromDomainSid", *params.FromDomainSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VoiceV1ByocTrunk{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/voice/v1/connection_policies.go b/rest/voice/v1/connection_policies.go index 24eda12dd..307fb9a97 100644 --- a/rest/voice/v1/connection_policies.go +++ b/rest/voice/v1/connection_policies.go @@ -18,137 +18,143 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConnectionPolicy' type CreateConnectionPolicyParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *CreateConnectionPolicyParams) SetFriendlyName(FriendlyName string) *CreateConnectionPolicyParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateConnectionPolicyParams) SetFriendlyName(FriendlyName string) (*CreateConnectionPolicyParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) CreateConnectionPolicy(params *CreateConnectionPolicyParams) (*VoiceV1ConnectionPolicy, error) { - path := "/v1/ConnectionPolicies" + path := "/v1/ConnectionPolicies" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1ConnectionPolicy{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1ConnectionPolicy{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteConnectionPolicy(Sid string) error { - path := "/v1/ConnectionPolicies/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteConnectionPolicy(Sid string, ) (error) { + path := "/v1/ConnectionPolicies/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchConnectionPolicy(Sid string) (*VoiceV1ConnectionPolicy, error) { - path := "/v1/ConnectionPolicies/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchConnectionPolicy(Sid string, ) (*VoiceV1ConnectionPolicy, error) { + path := "/v1/ConnectionPolicies/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VoiceV1ConnectionPolicy{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() - return ps, err + ps := &VoiceV1ConnectionPolicy{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListConnectionPolicy' type ListConnectionPolicyParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConnectionPolicyParams) SetPageSize(PageSize int) *ListConnectionPolicyParams { - params.PageSize = &PageSize - return params +func (params *ListConnectionPolicyParams) SetPageSize(PageSize int) (*ListConnectionPolicyParams){ + params.PageSize = &PageSize + return params } -func (params *ListConnectionPolicyParams) SetLimit(Limit int) *ListConnectionPolicyParams { - params.Limit = &Limit - return params +func (params *ListConnectionPolicyParams) SetLimit(Limit int) (*ListConnectionPolicyParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConnectionPolicy records from the API. Request is executed immediately. func (c *ApiService) PageConnectionPolicy(params *ListConnectionPolicyParams, pageToken, pageNumber string) (*ListConnectionPolicyResponse, error) { - path := "/v1/ConnectionPolicies" + path := "/v1/ConnectionPolicies" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConnectionPolicyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConnectionPolicyResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConnectionPolicy records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -189,6 +195,7 @@ func (c *ApiService) StreamConnectionPolicy(params *ListConnectionPolicyParams) return recordChannel, errorChannel } + func (c *ApiService) streamConnectionPolicy(response *ListConnectionPolicyResponse, params *ListConnectionPolicyParams, recordChannel chan VoiceV1ConnectionPolicy, errorChannel chan error) { curRecord := 1 @@ -220,57 +227,59 @@ func (c *ApiService) streamConnectionPolicy(response *ListConnectionPolicyRespon } func (c *ApiService) getNextListConnectionPolicyResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConnectionPolicyResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConnectionPolicyResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConnectionPolicy' type UpdateConnectionPolicyParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateConnectionPolicyParams) SetFriendlyName(FriendlyName string) *UpdateConnectionPolicyParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateConnectionPolicyParams) SetFriendlyName(FriendlyName string) (*UpdateConnectionPolicyParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateConnectionPolicy(Sid string, params *UpdateConnectionPolicyParams) (*VoiceV1ConnectionPolicy, error) { - path := "/v1/ConnectionPolicies/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/ConnectionPolicies/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VoiceV1ConnectionPolicy{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VoiceV1ConnectionPolicy{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/voice/v1/connection_policies_targets.go b/rest/voice/v1/connection_policies_targets.go index 015b0c972..6d5a1ad20 100644 --- a/rest/voice/v1/connection_policies_targets.go +++ b/rest/voice/v1/connection_policies_targets.go @@ -18,178 +18,183 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateConnectionPolicyTarget' type CreateConnectionPolicyTargetParams struct { - // The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. - Target *string `json:"Target,omitempty"` - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. - Priority *int `json:"Priority,omitempty"` - // The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. - Weight *int `json:"Weight,omitempty"` - // Whether the Target is enabled. The default is `true`. - Enabled *bool `json:"Enabled,omitempty"` + // The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. + Target *string `json:"Target,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. + Priority *int `json:"Priority,omitempty"` + // The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. + Weight *int `json:"Weight,omitempty"` + // Whether the Target is enabled. The default is `true`. + Enabled *bool `json:"Enabled,omitempty"` } -func (params *CreateConnectionPolicyTargetParams) SetTarget(Target string) *CreateConnectionPolicyTargetParams { - params.Target = &Target - return params +func (params *CreateConnectionPolicyTargetParams) SetTarget(Target string) (*CreateConnectionPolicyTargetParams){ + params.Target = &Target + return params } -func (params *CreateConnectionPolicyTargetParams) SetFriendlyName(FriendlyName string) *CreateConnectionPolicyTargetParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateConnectionPolicyTargetParams) SetFriendlyName(FriendlyName string) (*CreateConnectionPolicyTargetParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateConnectionPolicyTargetParams) SetPriority(Priority int) *CreateConnectionPolicyTargetParams { - params.Priority = &Priority - return params +func (params *CreateConnectionPolicyTargetParams) SetPriority(Priority int) (*CreateConnectionPolicyTargetParams){ + params.Priority = &Priority + return params } -func (params *CreateConnectionPolicyTargetParams) SetWeight(Weight int) *CreateConnectionPolicyTargetParams { - params.Weight = &Weight - return params +func (params *CreateConnectionPolicyTargetParams) SetWeight(Weight int) (*CreateConnectionPolicyTargetParams){ + params.Weight = &Weight + return params } -func (params *CreateConnectionPolicyTargetParams) SetEnabled(Enabled bool) *CreateConnectionPolicyTargetParams { - params.Enabled = &Enabled - return params +func (params *CreateConnectionPolicyTargetParams) SetEnabled(Enabled bool) (*CreateConnectionPolicyTargetParams){ + params.Enabled = &Enabled + return params } -// +// func (c *ApiService) CreateConnectionPolicyTarget(ConnectionPolicySid string, params *CreateConnectionPolicyTargetParams) (*VoiceV1ConnectionPolicyTarget, error) { - path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets" - path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Target != nil { - data.Set("Target", *params.Target) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.Weight != nil { - data.Set("Weight", fmt.Sprint(*params.Weight)) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } + path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets" + path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Target != nil { + data.Set("Target", *params.Target) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.Weight != nil { + data.Set("Weight", fmt.Sprint(*params.Weight)) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VoiceV1ConnectionPolicyTarget{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteConnectionPolicyTarget(ConnectionPolicySid string, Sid string, ) (error) { + path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}" + path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &VoiceV1ConnectionPolicyTarget{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteConnectionPolicyTarget(ConnectionPolicySid string, Sid string) error { - path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}" - path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchConnectionPolicyTarget(ConnectionPolicySid string, Sid string, ) (*VoiceV1ConnectionPolicyTarget, error) { + path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}" + path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchConnectionPolicyTarget(ConnectionPolicySid string, Sid string) (*VoiceV1ConnectionPolicyTarget, error) { - path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}" - path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1ConnectionPolicyTarget{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1ConnectionPolicyTarget{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListConnectionPolicyTarget' type ListConnectionPolicyTargetParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListConnectionPolicyTargetParams) SetPageSize(PageSize int) *ListConnectionPolicyTargetParams { - params.PageSize = &PageSize - return params +func (params *ListConnectionPolicyTargetParams) SetPageSize(PageSize int) (*ListConnectionPolicyTargetParams){ + params.PageSize = &PageSize + return params } -func (params *ListConnectionPolicyTargetParams) SetLimit(Limit int) *ListConnectionPolicyTargetParams { - params.Limit = &Limit - return params +func (params *ListConnectionPolicyTargetParams) SetLimit(Limit int) (*ListConnectionPolicyTargetParams){ + params.Limit = &Limit + return params } // Retrieve a single page of ConnectionPolicyTarget records from the API. Request is executed immediately. func (c *ApiService) PageConnectionPolicyTarget(ConnectionPolicySid string, params *ListConnectionPolicyTargetParams, pageToken, pageNumber string) (*ListConnectionPolicyTargetResponse, error) { - path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets" + path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets" - path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) + path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListConnectionPolicyTargetResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListConnectionPolicyTargetResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists ConnectionPolicyTarget records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -230,6 +235,7 @@ func (c *ApiService) StreamConnectionPolicyTarget(ConnectionPolicySid string, pa return recordChannel, errorChannel } + func (c *ApiService) streamConnectionPolicyTarget(response *ListConnectionPolicyTargetResponse, params *ListConnectionPolicyTargetParams, recordChannel chan VoiceV1ConnectionPolicyTarget, errorChannel chan error) { curRecord := 1 @@ -261,94 +267,96 @@ func (c *ApiService) streamConnectionPolicyTarget(response *ListConnectionPolicy } func (c *ApiService) getNextListConnectionPolicyTargetResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListConnectionPolicyTargetResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListConnectionPolicyTargetResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateConnectionPolicyTarget' type UpdateConnectionPolicyTargetParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. - Target *string `json:"Target,omitempty"` - // The relative importance of the target. Can be an integer from 0 to 65535, inclusive. The lowest number represents the most important target. - Priority *int `json:"Priority,omitempty"` - // The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive. Targets with higher values receive more load than those with lower ones with the same priority. - Weight *int `json:"Weight,omitempty"` - // Whether the Target is enabled. - Enabled *bool `json:"Enabled,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. + Target *string `json:"Target,omitempty"` + // The relative importance of the target. Can be an integer from 0 to 65535, inclusive. The lowest number represents the most important target. + Priority *int `json:"Priority,omitempty"` + // The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive. Targets with higher values receive more load than those with lower ones with the same priority. + Weight *int `json:"Weight,omitempty"` + // Whether the Target is enabled. + Enabled *bool `json:"Enabled,omitempty"` } -func (params *UpdateConnectionPolicyTargetParams) SetFriendlyName(FriendlyName string) *UpdateConnectionPolicyTargetParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateConnectionPolicyTargetParams) SetFriendlyName(FriendlyName string) (*UpdateConnectionPolicyTargetParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *UpdateConnectionPolicyTargetParams) SetTarget(Target string) *UpdateConnectionPolicyTargetParams { - params.Target = &Target - return params +func (params *UpdateConnectionPolicyTargetParams) SetTarget(Target string) (*UpdateConnectionPolicyTargetParams){ + params.Target = &Target + return params } -func (params *UpdateConnectionPolicyTargetParams) SetPriority(Priority int) *UpdateConnectionPolicyTargetParams { - params.Priority = &Priority - return params +func (params *UpdateConnectionPolicyTargetParams) SetPriority(Priority int) (*UpdateConnectionPolicyTargetParams){ + params.Priority = &Priority + return params } -func (params *UpdateConnectionPolicyTargetParams) SetWeight(Weight int) *UpdateConnectionPolicyTargetParams { - params.Weight = &Weight - return params +func (params *UpdateConnectionPolicyTargetParams) SetWeight(Weight int) (*UpdateConnectionPolicyTargetParams){ + params.Weight = &Weight + return params } -func (params *UpdateConnectionPolicyTargetParams) SetEnabled(Enabled bool) *UpdateConnectionPolicyTargetParams { - params.Enabled = &Enabled - return params +func (params *UpdateConnectionPolicyTargetParams) SetEnabled(Enabled bool) (*UpdateConnectionPolicyTargetParams){ + params.Enabled = &Enabled + return params } -// +// func (c *ApiService) UpdateConnectionPolicyTarget(ConnectionPolicySid string, Sid string, params *UpdateConnectionPolicyTargetParams) (*VoiceV1ConnectionPolicyTarget, error) { - path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}" - path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.Target != nil { - data.Set("Target", *params.Target) - } - if params != nil && params.Priority != nil { - data.Set("Priority", fmt.Sprint(*params.Priority)) - } - if params != nil && params.Weight != nil { - data.Set("Weight", fmt.Sprint(*params.Weight)) - } - if params != nil && params.Enabled != nil { - data.Set("Enabled", fmt.Sprint(*params.Enabled)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &VoiceV1ConnectionPolicyTarget{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/ConnectionPolicies/{ConnectionPolicySid}/Targets/{Sid}" + path = strings.Replace(path, "{"+"ConnectionPolicySid"+"}", ConnectionPolicySid, -1) + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.Target != nil { + data.Set("Target", *params.Target) + } + if params != nil && params.Priority != nil { + data.Set("Priority", fmt.Sprint(*params.Priority)) + } + if params != nil && params.Weight != nil { + data.Set("Weight", fmt.Sprint(*params.Weight)) + } + if params != nil && params.Enabled != nil { + data.Set("Enabled", fmt.Sprint(*params.Enabled)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VoiceV1ConnectionPolicyTarget{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/voice/v1/dialing_permissions_bulk_country_updates.go b/rest/voice/v1/dialing_permissions_bulk_country_updates.go index 7c8a3ddc8..58e8244ad 100644 --- a/rest/voice/v1/dialing_permissions_bulk_country_updates.go +++ b/rest/voice/v1/dialing_permissions_bulk_country_updates.go @@ -16,42 +16,47 @@ package openapi import ( "encoding/json" + "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateDialingPermissionsCountryBulkUpdate' type CreateDialingPermissionsCountryBulkUpdateParams struct { - // URL encoded JSON array of update objects. example : `[ { \\\"iso_code\\\": \\\"GB\\\", \\\"low_risk_numbers_enabled\\\": \\\"true\\\", \\\"high_risk_special_numbers_enabled\\\":\\\"true\\\", \\\"high_risk_tollfraud_numbers_enabled\\\": \\\"false\\\" } ]` - UpdateRequest *string `json:"UpdateRequest,omitempty"` + // URL encoded JSON array of update objects. example : `[ { \\\"iso_code\\\": \\\"GB\\\", \\\"low_risk_numbers_enabled\\\": \\\"true\\\", \\\"high_risk_special_numbers_enabled\\\":\\\"true\\\", \\\"high_risk_tollfraud_numbers_enabled\\\": \\\"false\\\" } ]` + UpdateRequest *string `json:"UpdateRequest,omitempty"` } -func (params *CreateDialingPermissionsCountryBulkUpdateParams) SetUpdateRequest(UpdateRequest string) *CreateDialingPermissionsCountryBulkUpdateParams { - params.UpdateRequest = &UpdateRequest - return params +func (params *CreateDialingPermissionsCountryBulkUpdateParams) SetUpdateRequest(UpdateRequest string) (*CreateDialingPermissionsCountryBulkUpdateParams){ + params.UpdateRequest = &UpdateRequest + return params } // Create a bulk update request to change voice dialing country permissions of one or more countries identified by the corresponding [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) func (c *ApiService) CreateDialingPermissionsCountryBulkUpdate(params *CreateDialingPermissionsCountryBulkUpdateParams) (*VoiceV1DialingPermissionsCountryBulkUpdate, error) { - path := "/v1/DialingPermissions/BulkCountryUpdates" + path := "/v1/DialingPermissions/BulkCountryUpdates" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.UpdateRequest != nil { + data.Set("UpdateRequest", *params.UpdateRequest) + } - if params != nil && params.UpdateRequest != nil { - data.Set("UpdateRequest", *params.UpdateRequest) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1DialingPermissionsCountryBulkUpdate{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1DialingPermissionsCountryBulkUpdate{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/voice/v1/dialing_permissions_countries.go b/rest/voice/v1/dialing_permissions_countries.go index be09fb584..d0da9deb4 100644 --- a/rest/voice/v1/dialing_permissions_countries.go +++ b/rest/voice/v1/dialing_permissions_countries.go @@ -18,136 +18,139 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Retrieve voice dialing country permissions identified by the given ISO country code -func (c *ApiService) FetchDialingPermissionsCountry(IsoCode string) (*VoiceV1DialingPermissionsCountryInstance, error) { - path := "/v1/DialingPermissions/Countries/{IsoCode}" - path = strings.Replace(path, "{"+"IsoCode"+"}", IsoCode, -1) +func (c *ApiService) FetchDialingPermissionsCountry(IsoCode string, ) (*VoiceV1DialingPermissionsCountryInstance, error) { + path := "/v1/DialingPermissions/Countries/{IsoCode}" + path = strings.Replace(path, "{"+"IsoCode"+"}", IsoCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VoiceV1DialingPermissionsCountryInstance{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VoiceV1DialingPermissionsCountryInstance{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListDialingPermissionsCountry' type ListDialingPermissionsCountryParams struct { - // Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) - IsoCode *string `json:"IsoCode,omitempty"` - // Filter to retrieve the country permissions by specifying the continent - Continent *string `json:"Continent,omitempty"` - // Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) - CountryCode *string `json:"CountryCode,omitempty"` - // Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`. - LowRiskNumbersEnabled *bool `json:"LowRiskNumbersEnabled,omitempty"` - // Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false` - HighRiskSpecialNumbersEnabled *bool `json:"HighRiskSpecialNumbersEnabled,omitempty"` - // Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers enabled. Can be: `true` or `false`. - HighRiskTollfraudNumbersEnabled *bool `json:"HighRiskTollfraudNumbersEnabled,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + IsoCode *string `json:"IsoCode,omitempty"` + // Filter to retrieve the country permissions by specifying the continent + Continent *string `json:"Continent,omitempty"` + // Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) + CountryCode *string `json:"CountryCode,omitempty"` + // Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`. + LowRiskNumbersEnabled *bool `json:"LowRiskNumbersEnabled,omitempty"` + // Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false` + HighRiskSpecialNumbersEnabled *bool `json:"HighRiskSpecialNumbersEnabled,omitempty"` + // Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers enabled. Can be: `true` or `false`. + HighRiskTollfraudNumbersEnabled *bool `json:"HighRiskTollfraudNumbersEnabled,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDialingPermissionsCountryParams) SetIsoCode(IsoCode string) *ListDialingPermissionsCountryParams { - params.IsoCode = &IsoCode - return params +func (params *ListDialingPermissionsCountryParams) SetIsoCode(IsoCode string) (*ListDialingPermissionsCountryParams){ + params.IsoCode = &IsoCode + return params } -func (params *ListDialingPermissionsCountryParams) SetContinent(Continent string) *ListDialingPermissionsCountryParams { - params.Continent = &Continent - return params +func (params *ListDialingPermissionsCountryParams) SetContinent(Continent string) (*ListDialingPermissionsCountryParams){ + params.Continent = &Continent + return params } -func (params *ListDialingPermissionsCountryParams) SetCountryCode(CountryCode string) *ListDialingPermissionsCountryParams { - params.CountryCode = &CountryCode - return params +func (params *ListDialingPermissionsCountryParams) SetCountryCode(CountryCode string) (*ListDialingPermissionsCountryParams){ + params.CountryCode = &CountryCode + return params } -func (params *ListDialingPermissionsCountryParams) SetLowRiskNumbersEnabled(LowRiskNumbersEnabled bool) *ListDialingPermissionsCountryParams { - params.LowRiskNumbersEnabled = &LowRiskNumbersEnabled - return params +func (params *ListDialingPermissionsCountryParams) SetLowRiskNumbersEnabled(LowRiskNumbersEnabled bool) (*ListDialingPermissionsCountryParams){ + params.LowRiskNumbersEnabled = &LowRiskNumbersEnabled + return params } -func (params *ListDialingPermissionsCountryParams) SetHighRiskSpecialNumbersEnabled(HighRiskSpecialNumbersEnabled bool) *ListDialingPermissionsCountryParams { - params.HighRiskSpecialNumbersEnabled = &HighRiskSpecialNumbersEnabled - return params +func (params *ListDialingPermissionsCountryParams) SetHighRiskSpecialNumbersEnabled(HighRiskSpecialNumbersEnabled bool) (*ListDialingPermissionsCountryParams){ + params.HighRiskSpecialNumbersEnabled = &HighRiskSpecialNumbersEnabled + return params } -func (params *ListDialingPermissionsCountryParams) SetHighRiskTollfraudNumbersEnabled(HighRiskTollfraudNumbersEnabled bool) *ListDialingPermissionsCountryParams { - params.HighRiskTollfraudNumbersEnabled = &HighRiskTollfraudNumbersEnabled - return params +func (params *ListDialingPermissionsCountryParams) SetHighRiskTollfraudNumbersEnabled(HighRiskTollfraudNumbersEnabled bool) (*ListDialingPermissionsCountryParams){ + params.HighRiskTollfraudNumbersEnabled = &HighRiskTollfraudNumbersEnabled + return params } -func (params *ListDialingPermissionsCountryParams) SetPageSize(PageSize int) *ListDialingPermissionsCountryParams { - params.PageSize = &PageSize - return params +func (params *ListDialingPermissionsCountryParams) SetPageSize(PageSize int) (*ListDialingPermissionsCountryParams){ + params.PageSize = &PageSize + return params } -func (params *ListDialingPermissionsCountryParams) SetLimit(Limit int) *ListDialingPermissionsCountryParams { - params.Limit = &Limit - return params +func (params *ListDialingPermissionsCountryParams) SetLimit(Limit int) (*ListDialingPermissionsCountryParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DialingPermissionsCountry records from the API. Request is executed immediately. func (c *ApiService) PageDialingPermissionsCountry(params *ListDialingPermissionsCountryParams, pageToken, pageNumber string) (*ListDialingPermissionsCountryResponse, error) { - path := "/v1/DialingPermissions/Countries" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.IsoCode != nil { - data.Set("IsoCode", *params.IsoCode) - } - if params != nil && params.Continent != nil { - data.Set("Continent", *params.Continent) - } - if params != nil && params.CountryCode != nil { - data.Set("CountryCode", *params.CountryCode) - } - if params != nil && params.LowRiskNumbersEnabled != nil { - data.Set("LowRiskNumbersEnabled", fmt.Sprint(*params.LowRiskNumbersEnabled)) - } - if params != nil && params.HighRiskSpecialNumbersEnabled != nil { - data.Set("HighRiskSpecialNumbersEnabled", fmt.Sprint(*params.HighRiskSpecialNumbersEnabled)) - } - if params != nil && params.HighRiskTollfraudNumbersEnabled != nil { - data.Set("HighRiskTollfraudNumbersEnabled", fmt.Sprint(*params.HighRiskTollfraudNumbersEnabled)) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDialingPermissionsCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/DialingPermissions/Countries" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.IsoCode != nil { + data.Set("IsoCode", *params.IsoCode) + } + if params != nil && params.Continent != nil { + data.Set("Continent", *params.Continent) + } + if params != nil && params.CountryCode != nil { + data.Set("CountryCode", *params.CountryCode) + } + if params != nil && params.LowRiskNumbersEnabled != nil { + data.Set("LowRiskNumbersEnabled", fmt.Sprint(*params.LowRiskNumbersEnabled)) + } + if params != nil && params.HighRiskSpecialNumbersEnabled != nil { + data.Set("HighRiskSpecialNumbersEnabled", fmt.Sprint(*params.HighRiskSpecialNumbersEnabled)) + } + if params != nil && params.HighRiskTollfraudNumbersEnabled != nil { + data.Set("HighRiskTollfraudNumbersEnabled", fmt.Sprint(*params.HighRiskTollfraudNumbersEnabled)) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDialingPermissionsCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists DialingPermissionsCountry records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -188,6 +191,7 @@ func (c *ApiService) StreamDialingPermissionsCountry(params *ListDialingPermissi return recordChannel, errorChannel } + func (c *ApiService) streamDialingPermissionsCountry(response *ListDialingPermissionsCountryResponse, params *ListDialingPermissionsCountryParams, recordChannel chan VoiceV1DialingPermissionsCountry, errorChannel chan error) { curRecord := 1 @@ -219,19 +223,20 @@ func (c *ApiService) streamDialingPermissionsCountry(response *ListDialingPermis } func (c *ApiService) getNextListDialingPermissionsCountryResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDialingPermissionsCountryResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDialingPermissionsCountryResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/voice/v1/dialing_permissions_countries_high_risk_special_prefixes.go b/rest/voice/v1/dialing_permissions_countries_high_risk_special_prefixes.go index db256ce6d..29da8f4dd 100644 --- a/rest/voice/v1/dialing_permissions_countries_high_risk_special_prefixes.go +++ b/rest/voice/v1/dialing_permissions_countries_high_risk_special_prefixes.go @@ -18,61 +18,61 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListDialingPermissionsHrsPrefixes' type ListDialingPermissionsHrsPrefixesParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDialingPermissionsHrsPrefixesParams) SetPageSize(PageSize int) *ListDialingPermissionsHrsPrefixesParams { - params.PageSize = &PageSize - return params +func (params *ListDialingPermissionsHrsPrefixesParams) SetPageSize(PageSize int) (*ListDialingPermissionsHrsPrefixesParams){ + params.PageSize = &PageSize + return params } -func (params *ListDialingPermissionsHrsPrefixesParams) SetLimit(Limit int) *ListDialingPermissionsHrsPrefixesParams { - params.Limit = &Limit - return params +func (params *ListDialingPermissionsHrsPrefixesParams) SetLimit(Limit int) (*ListDialingPermissionsHrsPrefixesParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DialingPermissionsHrsPrefixes records from the API. Request is executed immediately. func (c *ApiService) PageDialingPermissionsHrsPrefixes(IsoCode string, params *ListDialingPermissionsHrsPrefixesParams, pageToken, pageNumber string) (*ListDialingPermissionsHrsPrefixesResponse, error) { - path := "/v1/DialingPermissions/Countries/{IsoCode}/HighRiskSpecialPrefixes" + path := "/v1/DialingPermissions/Countries/{IsoCode}/HighRiskSpecialPrefixes" - path = strings.Replace(path, "{"+"IsoCode"+"}", IsoCode, -1) + path = strings.Replace(path, "{"+"IsoCode"+"}", IsoCode, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDialingPermissionsHrsPrefixesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDialingPermissionsHrsPrefixesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists DialingPermissionsHrsPrefixes records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -113,6 +113,7 @@ func (c *ApiService) StreamDialingPermissionsHrsPrefixes(IsoCode string, params return recordChannel, errorChannel } + func (c *ApiService) streamDialingPermissionsHrsPrefixes(response *ListDialingPermissionsHrsPrefixesResponse, params *ListDialingPermissionsHrsPrefixesParams, recordChannel chan VoiceV1DialingPermissionsHrsPrefixes, errorChannel chan error) { curRecord := 1 @@ -144,19 +145,20 @@ func (c *ApiService) streamDialingPermissionsHrsPrefixes(response *ListDialingPe } func (c *ApiService) getNextListDialingPermissionsHrsPrefixesResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDialingPermissionsHrsPrefixesResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDialingPermissionsHrsPrefixesResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/voice/v1/docs/ListByocTrunkResponseMeta.md b/rest/voice/v1/docs/ListByocTrunkResponseMeta.md index 667b85c77..475eded29 100644 --- a/rest/voice/v1/docs/ListByocTrunkResponseMeta.md +++ b/rest/voice/v1/docs/ListByocTrunkResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/voice/v1/ip_records.go b/rest/voice/v1/ip_records.go index 93ed82dde..4d9310b18 100644 --- a/rest/voice/v1/ip_records.go +++ b/rest/voice/v1/ip_records.go @@ -18,155 +18,161 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateIpRecord' type CreateIpRecordParams struct { - // An IP address in dotted decimal notation, IPv4 only. - IpAddress *string `json:"IpAddress,omitempty"` - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` - // An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. - CidrPrefixLength *int `json:"CidrPrefixLength,omitempty"` + // An IP address in dotted decimal notation, IPv4 only. + IpAddress *string `json:"IpAddress,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` + // An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. + CidrPrefixLength *int `json:"CidrPrefixLength,omitempty"` } -func (params *CreateIpRecordParams) SetIpAddress(IpAddress string) *CreateIpRecordParams { - params.IpAddress = &IpAddress - return params +func (params *CreateIpRecordParams) SetIpAddress(IpAddress string) (*CreateIpRecordParams){ + params.IpAddress = &IpAddress + return params } -func (params *CreateIpRecordParams) SetFriendlyName(FriendlyName string) *CreateIpRecordParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateIpRecordParams) SetFriendlyName(FriendlyName string) (*CreateIpRecordParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateIpRecordParams) SetCidrPrefixLength(CidrPrefixLength int) *CreateIpRecordParams { - params.CidrPrefixLength = &CidrPrefixLength - return params +func (params *CreateIpRecordParams) SetCidrPrefixLength(CidrPrefixLength int) (*CreateIpRecordParams){ + params.CidrPrefixLength = &CidrPrefixLength + return params } -// +// func (c *ApiService) CreateIpRecord(params *CreateIpRecordParams) (*VoiceV1IpRecord, error) { - path := "/v1/IpRecords" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.IpAddress != nil { - data.Set("IpAddress", *params.IpAddress) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.CidrPrefixLength != nil { - data.Set("CidrPrefixLength", fmt.Sprint(*params.CidrPrefixLength)) - } + path := "/v1/IpRecords" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.IpAddress != nil { + data.Set("IpAddress", *params.IpAddress) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.CidrPrefixLength != nil { + data.Set("CidrPrefixLength", fmt.Sprint(*params.CidrPrefixLength)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &VoiceV1IpRecord{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } +// +func (c *ApiService) DeleteIpRecord(Sid string, ) (error) { + path := "/v1/IpRecords/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - ps := &VoiceV1IpRecord{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, err -} -// -func (c *ApiService) DeleteIpRecord(Sid string) error { - path := "/v1/IpRecords/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - data := url.Values{} - headers := make(map[string]interface{}) + defer resp.Body.Close() - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } + return nil +} - defer resp.Body.Close() +// +func (c *ApiService) FetchIpRecord(Sid string, ) (*VoiceV1IpRecord, error) { + path := "/v1/IpRecords/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - return nil -} + data := url.Values{} + headers := make(map[string]interface{}) -// -func (c *ApiService) FetchIpRecord(Sid string) (*VoiceV1IpRecord, error) { - path := "/v1/IpRecords/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1IpRecord{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1IpRecord{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListIpRecord' type ListIpRecordParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListIpRecordParams) SetPageSize(PageSize int) *ListIpRecordParams { - params.PageSize = &PageSize - return params +func (params *ListIpRecordParams) SetPageSize(PageSize int) (*ListIpRecordParams){ + params.PageSize = &PageSize + return params } -func (params *ListIpRecordParams) SetLimit(Limit int) *ListIpRecordParams { - params.Limit = &Limit - return params +func (params *ListIpRecordParams) SetLimit(Limit int) (*ListIpRecordParams){ + params.Limit = &Limit + return params } // Retrieve a single page of IpRecord records from the API. Request is executed immediately. func (c *ApiService) PageIpRecord(params *ListIpRecordParams, pageToken, pageNumber string) (*ListIpRecordResponse, error) { - path := "/v1/IpRecords" + path := "/v1/IpRecords" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListIpRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListIpRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists IpRecord records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -207,6 +213,7 @@ func (c *ApiService) StreamIpRecord(params *ListIpRecordParams) (chan VoiceV1IpR return recordChannel, errorChannel } + func (c *ApiService) streamIpRecord(response *ListIpRecordResponse, params *ListIpRecordParams, recordChannel chan VoiceV1IpRecord, errorChannel chan error) { curRecord := 1 @@ -238,57 +245,59 @@ func (c *ApiService) streamIpRecord(response *ListIpRecordResponse, params *List } func (c *ApiService) getNextListIpRecordResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListIpRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListIpRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateIpRecord' type UpdateIpRecordParams struct { - // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - FriendlyName *string `json:"FriendlyName,omitempty"` + // A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateIpRecordParams) SetFriendlyName(FriendlyName string) *UpdateIpRecordParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateIpRecordParams) SetFriendlyName(FriendlyName string) (*UpdateIpRecordParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateIpRecord(Sid string, params *UpdateIpRecordParams) (*VoiceV1IpRecord, error) { - path := "/v1/IpRecords/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/IpRecords/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VoiceV1IpRecord{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VoiceV1IpRecord{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/voice/v1/model_list_byoc_trunk_response.go b/rest/voice/v1/model_list_byoc_trunk_response.go index e2f01fafb..751bd12a8 100644 --- a/rest/voice/v1/model_list_byoc_trunk_response.go +++ b/rest/voice/v1/model_list_byoc_trunk_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListByocTrunkResponse struct for ListByocTrunkResponse type ListByocTrunkResponse struct { - ByocTrunks []VoiceV1ByocTrunk `json:"byoc_trunks,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + ByocTrunks []VoiceV1ByocTrunk `json:"byoc_trunks,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_list_byoc_trunk_response_meta.go b/rest/voice/v1/model_list_byoc_trunk_response_meta.go index a87c8964a..2a1ac9688 100644 --- a/rest/voice/v1/model_list_byoc_trunk_response_meta.go +++ b/rest/voice/v1/model_list_byoc_trunk_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListByocTrunkResponseMeta struct for ListByocTrunkResponseMeta type ListByocTrunkResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/model_list_connection_policy_response.go b/rest/voice/v1/model_list_connection_policy_response.go index 472c2caa3..ba460cff9 100644 --- a/rest/voice/v1/model_list_connection_policy_response.go +++ b/rest/voice/v1/model_list_connection_policy_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConnectionPolicyResponse struct for ListConnectionPolicyResponse type ListConnectionPolicyResponse struct { ConnectionPolicies []VoiceV1ConnectionPolicy `json:"connection_policies,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_list_connection_policy_target_response.go b/rest/voice/v1/model_list_connection_policy_target_response.go index 1071581c2..cbefe7ffa 100644 --- a/rest/voice/v1/model_list_connection_policy_target_response.go +++ b/rest/voice/v1/model_list_connection_policy_target_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListConnectionPolicyTargetResponse struct for ListConnectionPolicyTargetResponse type ListConnectionPolicyTargetResponse struct { Targets []VoiceV1ConnectionPolicyTarget `json:"targets,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_list_dialing_permissions_country_response.go b/rest/voice/v1/model_list_dialing_permissions_country_response.go index ec9859493..ff26173d8 100644 --- a/rest/voice/v1/model_list_dialing_permissions_country_response.go +++ b/rest/voice/v1/model_list_dialing_permissions_country_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDialingPermissionsCountryResponse struct for ListDialingPermissionsCountryResponse type ListDialingPermissionsCountryResponse struct { Content []VoiceV1DialingPermissionsCountry `json:"content,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_list_dialing_permissions_hrs_prefixes_response.go b/rest/voice/v1/model_list_dialing_permissions_hrs_prefixes_response.go index 7e8ab1e39..899c01f75 100644 --- a/rest/voice/v1/model_list_dialing_permissions_hrs_prefixes_response.go +++ b/rest/voice/v1/model_list_dialing_permissions_hrs_prefixes_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDialingPermissionsHrsPrefixesResponse struct for ListDialingPermissionsHrsPrefixesResponse type ListDialingPermissionsHrsPrefixesResponse struct { Content []VoiceV1DialingPermissionsHrsPrefixes `json:"content,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_list_ip_record_response.go b/rest/voice/v1/model_list_ip_record_response.go index 7369c1302..18bea41ad 100644 --- a/rest/voice/v1/model_list_ip_record_response.go +++ b/rest/voice/v1/model_list_ip_record_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListIpRecordResponse struct for ListIpRecordResponse type ListIpRecordResponse struct { - IpRecords []VoiceV1IpRecord `json:"ip_records,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + IpRecords []VoiceV1IpRecord `json:"ip_records,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_list_source_ip_mapping_response.go b/rest/voice/v1/model_list_source_ip_mapping_response.go index 45299e24a..9493fc94d 100644 --- a/rest/voice/v1/model_list_source_ip_mapping_response.go +++ b/rest/voice/v1/model_list_source_ip_mapping_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSourceIpMappingResponse struct for ListSourceIpMappingResponse type ListSourceIpMappingResponse struct { - SourceIpMappings []VoiceV1SourceIpMapping `json:"source_ip_mappings,omitempty"` - Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` + SourceIpMappings []VoiceV1SourceIpMapping `json:"source_ip_mappings,omitempty"` + Meta ListByocTrunkResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_archived_call.go b/rest/voice/v1/model_voice_v1_archived_call.go index c37e9c12f..f29f53a47 100644 --- a/rest/voice/v1/model_voice_v1_archived_call.go +++ b/rest/voice/v1/model_voice_v1_archived_call.go @@ -13,13 +13,18 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VoiceV1ArchivedCall struct for VoiceV1ArchivedCall type VoiceV1ArchivedCall struct { - // The date + // The date Date *string `json:"date,omitempty"` - // The call sid + // The call sid Sid *string `json:"sid,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_byoc_trunk.go b/rest/voice/v1/model_voice_v1_byoc_trunk.go index bcf19fba2..0a6498f7e 100644 --- a/rest/voice/v1/model_voice_v1_byoc_trunk.go +++ b/rest/voice/v1/model_voice_v1_byoc_trunk.go @@ -13,41 +13,43 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VoiceV1ByocTrunk struct for VoiceV1ByocTrunk type VoiceV1ByocTrunk struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that that we created to identify the BYOC Trunk resource. + // The unique string that that we created to identify the BYOC Trunk resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The URL we call using the `voice_method` when the BYOC Trunk receives a call. + // The URL we call using the `voice_method` when the BYOC Trunk receives a call. VoiceUrl *string `json:"voice_url,omitempty"` - // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. + // The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + // The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // The URL that we call to pass status parameters (such as call ended) to your application. + // The URL that we call to pass status parameters (such as call ended) to your application. StatusCallbackUrl *string `json:"status_callback_url,omitempty"` - // The HTTP method we use to call `status_callback_url`. Either `GET` or `POST`. + // The HTTP method we use to call `status_callback_url`. Either `GET` or `POST`. StatusCallbackMethod *string `json:"status_callback_method,omitempty"` - // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + // Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. CnamLookupEnabled *bool `json:"cnam_lookup_enabled,omitempty"` - // The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. + // The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. ConnectionPolicySid *string `json:"connection_policy_sid,omitempty"` - // The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\". + // The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\". FromDomainSid *string `json:"from_domain_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_connection_policy.go b/rest/voice/v1/model_voice_v1_connection_policy.go index 6150d6b59..18abb98f8 100644 --- a/rest/voice/v1/model_voice_v1_connection_policy.go +++ b/rest/voice/v1/model_voice_v1_connection_policy.go @@ -13,25 +13,27 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VoiceV1ConnectionPolicy struct for VoiceV1ConnectionPolicy type VoiceV1ConnectionPolicy struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Connection Policy resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Connection Policy resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the Connection Policy resource. + // The unique string that we created to identify the Connection Policy resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related resources. + // The URLs of related resources. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_connection_policy_target.go b/rest/voice/v1/model_voice_v1_connection_policy_target.go index 1e527caa7..1dc8f4f0f 100644 --- a/rest/voice/v1/model_voice_v1_connection_policy_target.go +++ b/rest/voice/v1/model_voice_v1_connection_policy_target.go @@ -13,33 +13,35 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VoiceV1ConnectionPolicyTarget struct for VoiceV1ConnectionPolicyTarget type VoiceV1ConnectionPolicyTarget struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Target resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Target resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the Connection Policy that owns the Target. + // The SID of the Connection Policy that owns the Target. ConnectionPolicySid *string `json:"connection_policy_sid,omitempty"` - // The unique string that we created to identify the Target resource. + // The unique string that we created to identify the Target resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. + // The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. Target *string `json:"target,omitempty"` - // The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. + // The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. Priority *int `json:"priority,omitempty"` - // The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. + // The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. Weight *int `json:"weight,omitempty"` - // Whether the target is enabled. The default is `true`. + // Whether the target is enabled. The default is `true`. Enabled *bool `json:"enabled,omitempty"` - // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_dialing_permissions_country.go b/rest/voice/v1/model_voice_v1_dialing_permissions_country.go index 7129dcb4f..2f29e0f47 100644 --- a/rest/voice/v1/model_voice_v1_dialing_permissions_country.go +++ b/rest/voice/v1/model_voice_v1_dialing_permissions_country.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VoiceV1DialingPermissionsCountry struct for VoiceV1DialingPermissionsCountry type VoiceV1DialingPermissionsCountry struct { - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCode *string `json:"iso_code,omitempty"` - // The name of the country. + // The name of the country. Name *string `json:"name,omitempty"` - // The name of the continent in which the country is located. + // The name of the continent in which the country is located. Continent *string `json:"continent,omitempty"` - // The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) + // The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) CountryCodes *[]string `json:"country_codes,omitempty"` - // Whether dialing to low-risk numbers is enabled. + // Whether dialing to low-risk numbers is enabled. LowRiskNumbersEnabled *bool `json:"low_risk_numbers_enabled,omitempty"` - // Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others + // Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others HighRiskSpecialNumbersEnabled *bool `json:"high_risk_special_numbers_enabled,omitempty"` - // Whether dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently + // Whether dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently HighRiskTollfraudNumbersEnabled *bool `json:"high_risk_tollfraud_numbers_enabled,omitempty"` - // The absolute URL of this resource. + // The absolute URL of this resource. Url *string `json:"url,omitempty"` - // A list of URLs related to this resource. + // A list of URLs related to this resource. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_dialing_permissions_country_bulk_update.go b/rest/voice/v1/model_voice_v1_dialing_permissions_country_bulk_update.go index dc3f40138..99f36643b 100644 --- a/rest/voice/v1/model_voice_v1_dialing_permissions_country_bulk_update.go +++ b/rest/voice/v1/model_voice_v1_dialing_permissions_country_bulk_update.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VoiceV1DialingPermissionsCountryBulkUpdate struct for VoiceV1DialingPermissionsCountryBulkUpdate type VoiceV1DialingPermissionsCountryBulkUpdate struct { - // The number of countries updated + // The number of countries updated UpdateCount *int `json:"update_count,omitempty"` - // A bulk update request to change voice dialing country permissions stored as a URL-encoded, JSON array of update objects. For example : `[ { \"iso_code\": \"GB\", \"low_risk_numbers_enabled\": \"true\", \"high_risk_special_numbers_enabled\":\"true\", \"high_risk_tollfraud_numbers_enabled\": \"false\" } ]` + // A bulk update request to change voice dialing country permissions stored as a URL-encoded, JSON array of update objects. For example : `[ { \"iso_code\": \"GB\", \"low_risk_numbers_enabled\": \"true\", \"high_risk_special_numbers_enabled\":\"true\", \"high_risk_tollfraud_numbers_enabled\": \"false\" } ]` UpdateRequest *string `json:"update_request,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_dialing_permissions_country_instance.go b/rest/voice/v1/model_voice_v1_dialing_permissions_country_instance.go index ff61c475d..d0e98f0aa 100644 --- a/rest/voice/v1/model_voice_v1_dialing_permissions_country_instance.go +++ b/rest/voice/v1/model_voice_v1_dialing_permissions_country_instance.go @@ -13,25 +13,30 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VoiceV1DialingPermissionsCountryInstance struct for VoiceV1DialingPermissionsCountryInstance type VoiceV1DialingPermissionsCountryInstance struct { - // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). IsoCode *string `json:"iso_code,omitempty"` - // The name of the country. + // The name of the country. Name *string `json:"name,omitempty"` - // The name of the continent in which the country is located. + // The name of the continent in which the country is located. Continent *string `json:"continent,omitempty"` - // The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) + // The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) CountryCodes *[]string `json:"country_codes,omitempty"` - // Whether dialing to low-risk numbers is enabled. + // Whether dialing to low-risk numbers is enabled. LowRiskNumbersEnabled *bool `json:"low_risk_numbers_enabled,omitempty"` - // Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others + // Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others HighRiskSpecialNumbersEnabled *bool `json:"high_risk_special_numbers_enabled,omitempty"` - // Whether dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently + // Whether dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently HighRiskTollfraudNumbersEnabled *bool `json:"high_risk_tollfraud_numbers_enabled,omitempty"` - // The absolute URL of this resource. + // The absolute URL of this resource. Url *string `json:"url,omitempty"` - // A list of URLs related to this resource. + // A list of URLs related to this resource. Links *map[string]interface{} `json:"links,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_dialing_permissions_hrs_prefixes.go b/rest/voice/v1/model_voice_v1_dialing_permissions_hrs_prefixes.go index 5a4794a89..346c81b65 100644 --- a/rest/voice/v1/model_voice_v1_dialing_permissions_hrs_prefixes.go +++ b/rest/voice/v1/model_voice_v1_dialing_permissions_hrs_prefixes.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VoiceV1DialingPermissionsHrsPrefixes struct for VoiceV1DialingPermissionsHrsPrefixes type VoiceV1DialingPermissionsHrsPrefixes struct { - // A prefix is a contiguous number range for a block of E.164 numbers that includes the E.164 assigned country code. For example, a North American Numbering Plan prefix like `+1510720` written like `+1(510) 720` matches all numbers inclusive from `+1(510) 720-0000` to `+1(510) 720-9999`. + // A prefix is a contiguous number range for a block of E.164 numbers that includes the E.164 assigned country code. For example, a North American Numbering Plan prefix like `+1510720` written like `+1(510) 720` matches all numbers inclusive from `+1(510) 720-0000` to `+1(510) 720-9999`. Prefix *string `json:"prefix,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_dialing_permissions_settings.go b/rest/voice/v1/model_voice_v1_dialing_permissions_settings.go index 913b92ad6..ea0d15273 100644 --- a/rest/voice/v1/model_voice_v1_dialing_permissions_settings.go +++ b/rest/voice/v1/model_voice_v1_dialing_permissions_settings.go @@ -13,11 +13,16 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // VoiceV1DialingPermissionsSettings struct for VoiceV1DialingPermissionsSettings type VoiceV1DialingPermissionsSettings struct { - // `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`. + // `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`. DialingPermissionsInheritance *bool `json:"dialing_permissions_inheritance,omitempty"` - // The absolute URL of this resource. + // The absolute URL of this resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_ip_record.go b/rest/voice/v1/model_voice_v1_ip_record.go index 904a0580d..696d35353 100644 --- a/rest/voice/v1/model_voice_v1_ip_record.go +++ b/rest/voice/v1/model_voice_v1_ip_record.go @@ -13,27 +13,29 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VoiceV1IpRecord struct for VoiceV1IpRecord type VoiceV1IpRecord struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Record resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Record resource. AccountSid *string `json:"account_sid,omitempty"` - // The unique string that we created to identify the IP Record resource. + // The unique string that we created to identify the IP Record resource. Sid *string `json:"sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // An IP address in dotted decimal notation, IPv4 only. + // An IP address in dotted decimal notation, IPv4 only. IpAddress *string `json:"ip_address,omitempty"` - // An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. + // An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. CidrPrefixLength *int `json:"cidr_prefix_length,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/model_voice_v1_source_ip_mapping.go b/rest/voice/v1/model_voice_v1_source_ip_mapping.go index 826c2f7de..79a44cfb6 100644 --- a/rest/voice/v1/model_voice_v1_source_ip_mapping.go +++ b/rest/voice/v1/model_voice_v1_source_ip_mapping.go @@ -13,23 +13,25 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // VoiceV1SourceIpMapping struct for VoiceV1SourceIpMapping type VoiceV1SourceIpMapping struct { - // The unique string that we created to identify the IP Record resource. + // The unique string that we created to identify the IP Record resource. Sid *string `json:"sid,omitempty"` - // The Twilio-provided string that uniquely identifies the IP Record resource to map from. + // The Twilio-provided string that uniquely identifies the IP Record resource to map from. IpRecordSid *string `json:"ip_record_sid,omitempty"` - // The SID of the SIP Domain that the IP Record is mapped to. + // The SID of the SIP Domain that the IP Record is mapped to. SipDomainSid *string `json:"sip_domain_sid,omitempty"` - // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + // The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/voice/v1/settings.go b/rest/voice/v1/settings.go index 2906226fc..7ddd83c55 100644 --- a/rest/voice/v1/settings.go +++ b/rest/voice/v1/settings.go @@ -18,63 +18,69 @@ import ( "encoding/json" "fmt" "net/url" + + "github.com/twilio/twilio-go/client" ) + // Retrieve voice dialing permissions inheritance for the sub-account func (c *ApiService) FetchDialingPermissionsSettings() (*VoiceV1DialingPermissionsSettings, error) { - path := "/v1/Settings" + path := "/v1/Settings" + + data := url.Values{} + headers := make(map[string]interface{}) + - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1DialingPermissionsSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1DialingPermissionsSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'UpdateDialingPermissionsSettings' type UpdateDialingPermissionsSettingsParams struct { - // `true` for the sub-account to inherit voice dialing permissions from the Master Project; otherwise `false`. - DialingPermissionsInheritance *bool `json:"DialingPermissionsInheritance,omitempty"` + // `true` for the sub-account to inherit voice dialing permissions from the Master Project; otherwise `false`. + DialingPermissionsInheritance *bool `json:"DialingPermissionsInheritance,omitempty"` } -func (params *UpdateDialingPermissionsSettingsParams) SetDialingPermissionsInheritance(DialingPermissionsInheritance bool) *UpdateDialingPermissionsSettingsParams { - params.DialingPermissionsInheritance = &DialingPermissionsInheritance - return params +func (params *UpdateDialingPermissionsSettingsParams) SetDialingPermissionsInheritance(DialingPermissionsInheritance bool) (*UpdateDialingPermissionsSettingsParams){ + params.DialingPermissionsInheritance = &DialingPermissionsInheritance + return params } // Update voice dialing permissions inheritance for the sub-account func (c *ApiService) UpdateDialingPermissionsSettings(params *UpdateDialingPermissionsSettingsParams) (*VoiceV1DialingPermissionsSettings, error) { - path := "/v1/Settings" + path := "/v1/Settings" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.DialingPermissionsInheritance != nil { + data.Set("DialingPermissionsInheritance", fmt.Sprint(*params.DialingPermissionsInheritance)) + } - if params != nil && params.DialingPermissionsInheritance != nil { - data.Set("DialingPermissionsInheritance", fmt.Sprint(*params.DialingPermissionsInheritance)) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1DialingPermissionsSettings{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1DialingPermissionsSettings{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/voice/v1/source_ip_mappings.go b/rest/voice/v1/source_ip_mappings.go index 083da2e12..fa87e21e0 100644 --- a/rest/voice/v1/source_ip_mappings.go +++ b/rest/voice/v1/source_ip_mappings.go @@ -18,146 +18,152 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateSourceIpMapping' type CreateSourceIpMappingParams struct { - // The Twilio-provided string that uniquely identifies the IP Record resource to map from. - IpRecordSid *string `json:"IpRecordSid,omitempty"` - // The SID of the SIP Domain that the IP Record should be mapped to. - SipDomainSid *string `json:"SipDomainSid,omitempty"` + // The Twilio-provided string that uniquely identifies the IP Record resource to map from. + IpRecordSid *string `json:"IpRecordSid,omitempty"` + // The SID of the SIP Domain that the IP Record should be mapped to. + SipDomainSid *string `json:"SipDomainSid,omitempty"` } -func (params *CreateSourceIpMappingParams) SetIpRecordSid(IpRecordSid string) *CreateSourceIpMappingParams { - params.IpRecordSid = &IpRecordSid - return params +func (params *CreateSourceIpMappingParams) SetIpRecordSid(IpRecordSid string) (*CreateSourceIpMappingParams){ + params.IpRecordSid = &IpRecordSid + return params } -func (params *CreateSourceIpMappingParams) SetSipDomainSid(SipDomainSid string) *CreateSourceIpMappingParams { - params.SipDomainSid = &SipDomainSid - return params +func (params *CreateSourceIpMappingParams) SetSipDomainSid(SipDomainSid string) (*CreateSourceIpMappingParams){ + params.SipDomainSid = &SipDomainSid + return params } -// +// func (c *ApiService) CreateSourceIpMapping(params *CreateSourceIpMappingParams) (*VoiceV1SourceIpMapping, error) { - path := "/v1/SourceIpMappings" + path := "/v1/SourceIpMappings" + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) + if params != nil && params.IpRecordSid != nil { + data.Set("IpRecordSid", *params.IpRecordSid) + } + if params != nil && params.SipDomainSid != nil { + data.Set("SipDomainSid", *params.SipDomainSid) + } - if params != nil && params.IpRecordSid != nil { - data.Set("IpRecordSid", *params.IpRecordSid) - } - if params != nil && params.SipDomainSid != nil { - data.Set("SipDomainSid", *params.SipDomainSid) - } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &VoiceV1SourceIpMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &VoiceV1SourceIpMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } -// -func (c *ApiService) DeleteSourceIpMapping(Sid string) error { - path := "/v1/SourceIpMappings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) DeleteSourceIpMapping(Sid string, ) (error) { + path := "/v1/SourceIpMappings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) - data := url.Values{} - headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return nil + defer resp.Body.Close() + + return nil } -// -func (c *ApiService) FetchSourceIpMapping(Sid string) (*VoiceV1SourceIpMapping, error) { - path := "/v1/SourceIpMappings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +// +func (c *ApiService) FetchSourceIpMapping(Sid string, ) (*VoiceV1SourceIpMapping, error) { + path := "/v1/SourceIpMappings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &VoiceV1SourceIpMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - return ps, err + defer resp.Body.Close() + + ps := &VoiceV1SourceIpMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Optional parameters for the method 'ListSourceIpMapping' type ListSourceIpMappingParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListSourceIpMappingParams) SetPageSize(PageSize int) *ListSourceIpMappingParams { - params.PageSize = &PageSize - return params +func (params *ListSourceIpMappingParams) SetPageSize(PageSize int) (*ListSourceIpMappingParams){ + params.PageSize = &PageSize + return params } -func (params *ListSourceIpMappingParams) SetLimit(Limit int) *ListSourceIpMappingParams { - params.Limit = &Limit - return params +func (params *ListSourceIpMappingParams) SetLimit(Limit int) (*ListSourceIpMappingParams){ + params.Limit = &Limit + return params } // Retrieve a single page of SourceIpMapping records from the API. Request is executed immediately. func (c *ApiService) PageSourceIpMapping(params *ListSourceIpMappingParams, pageToken, pageNumber string) (*ListSourceIpMappingResponse, error) { - path := "/v1/SourceIpMappings" + path := "/v1/SourceIpMappings" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSourceIpMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListSourceIpMappingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists SourceIpMapping records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -198,6 +204,7 @@ func (c *ApiService) StreamSourceIpMapping(params *ListSourceIpMappingParams) (c return recordChannel, errorChannel } + func (c *ApiService) streamSourceIpMapping(response *ListSourceIpMappingResponse, params *ListSourceIpMappingParams, recordChannel chan VoiceV1SourceIpMapping, errorChannel chan error) { curRecord := 1 @@ -229,57 +236,59 @@ func (c *ApiService) streamSourceIpMapping(response *ListSourceIpMappingResponse } func (c *ApiService) getNextListSourceIpMappingResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSourceIpMappingResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSourceIpMappingResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSourceIpMapping' type UpdateSourceIpMappingParams struct { - // The SID of the SIP Domain that the IP Record should be mapped to. - SipDomainSid *string `json:"SipDomainSid,omitempty"` + // The SID of the SIP Domain that the IP Record should be mapped to. + SipDomainSid *string `json:"SipDomainSid,omitempty"` } -func (params *UpdateSourceIpMappingParams) SetSipDomainSid(SipDomainSid string) *UpdateSourceIpMappingParams { - params.SipDomainSid = &SipDomainSid - return params +func (params *UpdateSourceIpMappingParams) SetSipDomainSid(SipDomainSid string) (*UpdateSourceIpMappingParams){ + params.SipDomainSid = &SipDomainSid + return params } -// +// func (c *ApiService) UpdateSourceIpMapping(Sid string, params *UpdateSourceIpMappingParams) (*VoiceV1SourceIpMapping, error) { - path := "/v1/SourceIpMappings/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/SourceIpMappings/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.SipDomainSid != nil { - data.Set("SipDomainSid", *params.SipDomainSid) - } + if params != nil && params.SipDomainSid != nil { + data.Set("SipDomainSid", *params.SipDomainSid) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &VoiceV1SourceIpMapping{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &VoiceV1SourceIpMapping{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/wireless/v1/README.md b/rest/wireless/v1/README.md index 5576f6009..175b6fb77 100644 --- a/rest/wireless/v1/README.md +++ b/rest/wireless/v1/README.md @@ -5,7 +5,7 @@ This is the public Twilio REST API. ## Overview This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project from the OpenAPI specs located at [twilio/twilio-oai](https://github.com/twilio/twilio-oai/tree/main/spec). By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. -- API version: 1.51.1 +- API version: 1.0.0 - Package version: 1.0.0 - Build package: com.twilio.oai.TwilioGoGenerator For more information, please visit [https://support.twilio.com](https://support.twilio.com) diff --git a/rest/wireless/v1/api_service.go b/rest/wireless/v1/api_service.go index 6c75acb40..fb915e2cc 100644 --- a/rest/wireless/v1/api_service.go +++ b/rest/wireless/v1/api_service.go @@ -15,7 +15,7 @@ package openapi import ( - twilio "github.com/twilio/twilio-go/client" + twilio "github.com/twilio/twilio-go/client" ) type ApiService struct { @@ -24,12 +24,12 @@ type ApiService struct { } func NewApiService(requestHandler *twilio.RequestHandler) *ApiService { - return &ApiService{ + return &ApiService { requestHandler: requestHandler, baseURL: "https://wireless.twilio.com", } } func NewApiServiceWithClient(client twilio.BaseClient) *ApiService { - return NewApiService(twilio.NewRequestHandler(client)) + return NewApiService(twilio.NewRequestHandler(client)) } diff --git a/rest/wireless/v1/commands.go b/rest/wireless/v1/commands.go index 92c40607f..73be2b6ce 100644 --- a/rest/wireless/v1/commands.go +++ b/rest/wireless/v1/commands.go @@ -18,227 +18,233 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateCommand' type CreateCommandParams struct { - // The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode. - Command *string `json:"Command,omitempty"` - // The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to send the Command to. - Sim *string `json:"Sim,omitempty"` - // The HTTP method we use to call `callback_url`. Can be: `POST` or `GET`, and the default is `POST`. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // The URL we call using the `callback_url` when the Command has finished sending, whether the command was delivered or it failed. - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // - CommandMode *string `json:"CommandMode,omitempty"` - // Whether to include the SID of the command in the message body. Can be: `none`, `start`, or `end`, and the default behavior is `none`. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value of `start` will prepend the message with the Command SID, and `end` will append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included. - IncludeSid *string `json:"IncludeSid,omitempty"` - // Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to 'delivered' once the server has received a delivery receipt from the device. The default value is `true`. - DeliveryReceiptRequested *bool `json:"DeliveryReceiptRequested,omitempty"` + // The message body of the Command. Can be plain text in text mode or a Base64 encoded byte string in binary mode. + Command *string `json:"Command,omitempty"` + // The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to send the Command to. + Sim *string `json:"Sim,omitempty"` + // The HTTP method we use to call `callback_url`. Can be: `POST` or `GET`, and the default is `POST`. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // The URL we call using the `callback_url` when the Command has finished sending, whether the command was delivered or it failed. + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // + CommandMode *string `json:"CommandMode,omitempty"` + // Whether to include the SID of the command in the message body. Can be: `none`, `start`, or `end`, and the default behavior is `none`. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value of `start` will prepend the message with the Command SID, and `end` will append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included. + IncludeSid *string `json:"IncludeSid,omitempty"` + // Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to 'delivered' once the server has received a delivery receipt from the device. The default value is `true`. + DeliveryReceiptRequested *bool `json:"DeliveryReceiptRequested,omitempty"` } -func (params *CreateCommandParams) SetCommand(Command string) *CreateCommandParams { - params.Command = &Command - return params +func (params *CreateCommandParams) SetCommand(Command string) (*CreateCommandParams){ + params.Command = &Command + return params } -func (params *CreateCommandParams) SetSim(Sim string) *CreateCommandParams { - params.Sim = &Sim - return params +func (params *CreateCommandParams) SetSim(Sim string) (*CreateCommandParams){ + params.Sim = &Sim + return params } -func (params *CreateCommandParams) SetCallbackMethod(CallbackMethod string) *CreateCommandParams { - params.CallbackMethod = &CallbackMethod - return params +func (params *CreateCommandParams) SetCallbackMethod(CallbackMethod string) (*CreateCommandParams){ + params.CallbackMethod = &CallbackMethod + return params } -func (params *CreateCommandParams) SetCallbackUrl(CallbackUrl string) *CreateCommandParams { - params.CallbackUrl = &CallbackUrl - return params +func (params *CreateCommandParams) SetCallbackUrl(CallbackUrl string) (*CreateCommandParams){ + params.CallbackUrl = &CallbackUrl + return params } -func (params *CreateCommandParams) SetCommandMode(CommandMode string) *CreateCommandParams { - params.CommandMode = &CommandMode - return params +func (params *CreateCommandParams) SetCommandMode(CommandMode string) (*CreateCommandParams){ + params.CommandMode = &CommandMode + return params } -func (params *CreateCommandParams) SetIncludeSid(IncludeSid string) *CreateCommandParams { - params.IncludeSid = &IncludeSid - return params +func (params *CreateCommandParams) SetIncludeSid(IncludeSid string) (*CreateCommandParams){ + params.IncludeSid = &IncludeSid + return params } -func (params *CreateCommandParams) SetDeliveryReceiptRequested(DeliveryReceiptRequested bool) *CreateCommandParams { - params.DeliveryReceiptRequested = &DeliveryReceiptRequested - return params +func (params *CreateCommandParams) SetDeliveryReceiptRequested(DeliveryReceiptRequested bool) (*CreateCommandParams){ + params.DeliveryReceiptRequested = &DeliveryReceiptRequested + return params } // Send a Command to a Sim. func (c *ApiService) CreateCommand(params *CreateCommandParams) (*WirelessV1Command, error) { - path := "/v1/Commands" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Command != nil { - data.Set("Command", *params.Command) - } - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.CommandMode != nil { - data.Set("CommandMode", *params.CommandMode) - } - if params != nil && params.IncludeSid != nil { - data.Set("IncludeSid", *params.IncludeSid) - } - if params != nil && params.DeliveryReceiptRequested != nil { - data.Set("DeliveryReceiptRequested", fmt.Sprint(*params.DeliveryReceiptRequested)) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &WirelessV1Command{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Commands" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Command != nil { + data.Set("Command", *params.Command) + } + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.CommandMode != nil { + data.Set("CommandMode", *params.CommandMode) + } + if params != nil && params.IncludeSid != nil { + data.Set("IncludeSid", *params.IncludeSid) + } + if params != nil && params.DeliveryReceiptRequested != nil { + data.Set("DeliveryReceiptRequested", fmt.Sprint(*params.DeliveryReceiptRequested)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &WirelessV1Command{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Delete a Command instance from your account. -func (c *ApiService) DeleteCommand(Sid string) error { - path := "/v1/Commands/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteCommand(Sid string, ) (error) { + path := "/v1/Commands/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a Command instance from your account. -func (c *ApiService) FetchCommand(Sid string) (*WirelessV1Command, error) { - path := "/v1/Commands/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchCommand(Sid string, ) (*WirelessV1Command, error) { + path := "/v1/Commands/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &WirelessV1Command{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &WirelessV1Command{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListCommand' type ListCommandParams struct { - // The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. - Sim *string `json:"Sim,omitempty"` - // The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. - Status *string `json:"Status,omitempty"` - // Only return Commands with this direction value. - Direction *string `json:"Direction,omitempty"` - // Only return Commands with this transport value. Can be: `sms` or `ip`. - Transport *string `json:"Transport,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/iot/wireless/api/sim-resource) to read. + Sim *string `json:"Sim,omitempty"` + // The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. + Status *string `json:"Status,omitempty"` + // Only return Commands with this direction value. + Direction *string `json:"Direction,omitempty"` + // Only return Commands with this transport value. Can be: `sms` or `ip`. + Transport *string `json:"Transport,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListCommandParams) SetSim(Sim string) *ListCommandParams { - params.Sim = &Sim - return params +func (params *ListCommandParams) SetSim(Sim string) (*ListCommandParams){ + params.Sim = &Sim + return params } -func (params *ListCommandParams) SetStatus(Status string) *ListCommandParams { - params.Status = &Status - return params +func (params *ListCommandParams) SetStatus(Status string) (*ListCommandParams){ + params.Status = &Status + return params } -func (params *ListCommandParams) SetDirection(Direction string) *ListCommandParams { - params.Direction = &Direction - return params +func (params *ListCommandParams) SetDirection(Direction string) (*ListCommandParams){ + params.Direction = &Direction + return params } -func (params *ListCommandParams) SetTransport(Transport string) *ListCommandParams { - params.Transport = &Transport - return params +func (params *ListCommandParams) SetTransport(Transport string) (*ListCommandParams){ + params.Transport = &Transport + return params } -func (params *ListCommandParams) SetPageSize(PageSize int) *ListCommandParams { - params.PageSize = &PageSize - return params +func (params *ListCommandParams) SetPageSize(PageSize int) (*ListCommandParams){ + params.PageSize = &PageSize + return params } -func (params *ListCommandParams) SetLimit(Limit int) *ListCommandParams { - params.Limit = &Limit - return params +func (params *ListCommandParams) SetLimit(Limit int) (*ListCommandParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Command records from the API. Request is executed immediately. func (c *ApiService) PageCommand(params *ListCommandParams, pageToken, pageNumber string) (*ListCommandResponse, error) { - path := "/v1/Commands" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Sim != nil { - data.Set("Sim", *params.Sim) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Direction != nil { - data.Set("Direction", *params.Direction) - } - if params != nil && params.Transport != nil { - data.Set("Transport", *params.Transport) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCommandResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Commands" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Sim != nil { + data.Set("Sim", *params.Sim) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Direction != nil { + data.Set("Direction", *params.Direction) + } + if params != nil && params.Transport != nil { + data.Set("Transport", *params.Transport) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCommandResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Command records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -279,6 +285,7 @@ func (c *ApiService) StreamCommand(params *ListCommandParams) (chan WirelessV1Co return recordChannel, errorChannel } + func (c *ApiService) streamCommand(response *ListCommandResponse, params *ListCommandParams, recordChannel chan WirelessV1Command, errorChannel chan error) { curRecord := 1 @@ -310,19 +317,20 @@ func (c *ApiService) streamCommand(response *ListCommandResponse, params *ListCo } func (c *ApiService) getNextListCommandResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListCommandResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListCommandResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/wireless/v1/docs/ListAccountUsageRecordResponseMeta.md b/rest/wireless/v1/docs/ListAccountUsageRecordResponseMeta.md index e734ccacc..84a867933 100644 --- a/rest/wireless/v1/docs/ListAccountUsageRecordResponseMeta.md +++ b/rest/wireless/v1/docs/ListAccountUsageRecordResponseMeta.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **FirstPageUrl** | **string** | |[optional] +**Key** | **string** | |[optional] **NextPageUrl** | Pointer to **string** | | **Page** | **int** | |[optional] **PageSize** | **int** | |[optional] **PreviousPageUrl** | Pointer to **string** | | **Url** | **string** | |[optional] -**Key** | **string** | |[optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/rest/wireless/v1/model_list_account_usage_record_response.go b/rest/wireless/v1/model_list_account_usage_record_response.go index 225126cd4..1f97f95d0 100644 --- a/rest/wireless/v1/model_list_account_usage_record_response.go +++ b/rest/wireless/v1/model_list_account_usage_record_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAccountUsageRecordResponse struct for ListAccountUsageRecordResponse type ListAccountUsageRecordResponse struct { - UsageRecords []WirelessV1AccountUsageRecord `json:"usage_records,omitempty"` - Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` + UsageRecords []WirelessV1AccountUsageRecord `json:"usage_records,omitempty"` + Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/wireless/v1/model_list_account_usage_record_response_meta.go b/rest/wireless/v1/model_list_account_usage_record_response_meta.go index 41221e5fe..230f75007 100644 --- a/rest/wireless/v1/model_list_account_usage_record_response_meta.go +++ b/rest/wireless/v1/model_list_account_usage_record_response_meta.go @@ -13,14 +13,19 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListAccountUsageRecordResponseMeta struct for ListAccountUsageRecordResponseMeta type ListAccountUsageRecordResponseMeta struct { - FirstPageUrl string `json:"first_page_url,omitempty"` - NextPageUrl *string `json:"next_page_url,omitempty"` - Page int `json:"page,omitempty"` - PageSize int `json:"page_size,omitempty"` + FirstPageUrl string `json:"first_page_url,omitempty"` + Key string `json:"key,omitempty"` + NextPageUrl *string `json:"next_page_url,omitempty"` + Page int `json:"page,omitempty"` + PageSize int `json:"page_size,omitempty"` PreviousPageUrl *string `json:"previous_page_url,omitempty"` - Url string `json:"url,omitempty"` - Key string `json:"key,omitempty"` + Url string `json:"url,omitempty"` } + + diff --git a/rest/wireless/v1/model_list_command_response.go b/rest/wireless/v1/model_list_command_response.go index 0b2ece5cd..796a2630d 100644 --- a/rest/wireless/v1/model_list_command_response.go +++ b/rest/wireless/v1/model_list_command_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListCommandResponse struct for ListCommandResponse type ListCommandResponse struct { - Commands []WirelessV1Command `json:"commands,omitempty"` - Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` + Commands []WirelessV1Command `json:"commands,omitempty"` + Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/wireless/v1/model_list_data_session_response.go b/rest/wireless/v1/model_list_data_session_response.go index 5e1607820..39a9bc5c3 100644 --- a/rest/wireless/v1/model_list_data_session_response.go +++ b/rest/wireless/v1/model_list_data_session_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListDataSessionResponse struct for ListDataSessionResponse type ListDataSessionResponse struct { - DataSessions []WirelessV1DataSession `json:"data_sessions,omitempty"` - Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` + DataSessions []WirelessV1DataSession `json:"data_sessions,omitempty"` + Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/wireless/v1/model_list_rate_plan_response.go b/rest/wireless/v1/model_list_rate_plan_response.go index 1cb4b79f7..f308dc2f0 100644 --- a/rest/wireless/v1/model_list_rate_plan_response.go +++ b/rest/wireless/v1/model_list_rate_plan_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListRatePlanResponse struct for ListRatePlanResponse type ListRatePlanResponse struct { - RatePlans []WirelessV1RatePlan `json:"rate_plans,omitempty"` - Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` + RatePlans []WirelessV1RatePlan `json:"rate_plans,omitempty"` + Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/wireless/v1/model_list_sim_response.go b/rest/wireless/v1/model_list_sim_response.go index 379fc233d..c4da88d7e 100644 --- a/rest/wireless/v1/model_list_sim_response.go +++ b/rest/wireless/v1/model_list_sim_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListSimResponse struct for ListSimResponse type ListSimResponse struct { - Sims []WirelessV1Sim `json:"sims,omitempty"` + Sims []WirelessV1Sim `json:"sims,omitempty"` Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/wireless/v1/model_list_usage_record_response.go b/rest/wireless/v1/model_list_usage_record_response.go index 56855b144..a9982a76c 100644 --- a/rest/wireless/v1/model_list_usage_record_response.go +++ b/rest/wireless/v1/model_list_usage_record_response.go @@ -13,9 +13,14 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // ListUsageRecordResponse struct for ListUsageRecordResponse type ListUsageRecordResponse struct { - UsageRecords []WirelessV1UsageRecord `json:"usage_records,omitempty"` - Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` + UsageRecords []WirelessV1UsageRecord `json:"usage_records,omitempty"` + Meta ListAccountUsageRecordResponseMeta `json:"meta,omitempty"` } + + diff --git a/rest/wireless/v1/model_wireless_v1_account_usage_record.go b/rest/wireless/v1/model_wireless_v1_account_usage_record.go index 0c5734321..7a0a7ec72 100644 --- a/rest/wireless/v1/model_wireless_v1_account_usage_record.go +++ b/rest/wireless/v1/model_wireless_v1_account_usage_record.go @@ -13,15 +13,20 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // WirelessV1AccountUsageRecord struct for WirelessV1AccountUsageRecord type WirelessV1AccountUsageRecord struct { - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AccountUsageRecord resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AccountUsageRecord resource. AccountSid *string `json:"account_sid,omitempty"` - // The time period for which usage is reported. Contains `start` and `end` properties that describe the period using GMT date-time values specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The time period for which usage is reported. Contains `start` and `end` properties that describe the period using GMT date-time values specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Period *interface{} `json:"period,omitempty"` - // An object that describes the aggregated Commands usage for all SIMs during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#commands-usage-object). + // An object that describes the aggregated Commands usage for all SIMs during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#commands-usage-object). Commands *interface{} `json:"commands,omitempty"` - // An object that describes the aggregated Data usage for all SIMs over the period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#data-usage-object). + // An object that describes the aggregated Data usage for all SIMs over the period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/account-usagerecord-resource#data-usage-object). Data *interface{} `json:"data,omitempty"` } + + diff --git a/rest/wireless/v1/model_wireless_v1_command.go b/rest/wireless/v1/model_wireless_v1_command.go index 32d78ee71..2e6d61996 100644 --- a/rest/wireless/v1/model_wireless_v1_command.go +++ b/rest/wireless/v1/model_wireless_v1_command.go @@ -13,31 +13,33 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // WirelessV1Command struct for WirelessV1Command type WirelessV1Command struct { - // The unique string that we created to identify the Command resource. + // The unique string that we created to identify the Command resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Command resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Command resource. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Command was sent to or from. + // The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Command was sent to or from. SimSid *string `json:"sim_sid,omitempty"` - // The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64. - Command *string `json:"command,omitempty"` + // The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64. + Command *string `json:"command,omitempty"` CommandMode *string `json:"command_mode,omitempty"` - Transport *string `json:"transport,omitempty"` - // Whether to request a delivery receipt. - DeliveryReceiptRequested *bool `json:"delivery_receipt_requested,omitempty"` - Status *string `json:"status,omitempty"` - Direction *string `json:"direction,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + Transport *string `json:"transport,omitempty"` + // Whether to request a delivery receipt. + DeliveryReceiptRequested *bool `json:"delivery_receipt_requested,omitempty"` + Status *string `json:"status,omitempty"` + Direction *string `json:"direction,omitempty"` + // The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/wireless/v1/model_wireless_v1_data_session.go b/rest/wireless/v1/model_wireless_v1_data_session.go index 487f10e4b..dfe53177f 100644 --- a/rest/wireless/v1/model_wireless_v1_data_session.go +++ b/rest/wireless/v1/model_wireless_v1_data_session.go @@ -13,43 +13,45 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // WirelessV1DataSession struct for WirelessV1DataSession type WirelessV1DataSession struct { - // The unique string that we created to identify the DataSession resource. + // The unique string that we created to identify the DataSession resource. Sid *string `json:"sid,omitempty"` - // The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Data Session is for. + // The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that the Data Session is for. SimSid *string `json:"sim_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DataSession resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DataSession resource. AccountSid *string `json:"account_sid,omitempty"` - // The generation of wireless technology that the device was using. + // The generation of wireless technology that the device was using. RadioLink *string `json:"radio_link,omitempty"` - // The 'mobile country code' is the unique ID of the home country where the Data Session took place. See: [MCC/MNC lookup](http://mcc-mnc.com/). + // The 'mobile country code' is the unique ID of the home country where the Data Session took place. See: [MCC/MNC lookup](http://mcc-mnc.com/). OperatorMcc *string `json:"operator_mcc,omitempty"` - // The 'mobile network code' is the unique ID specific to the mobile operator network where the Data Session took place. + // The 'mobile network code' is the unique ID specific to the mobile operator network where the Data Session took place. OperatorMnc *string `json:"operator_mnc,omitempty"` - // The three letter country code representing where the device's Data Session took place. This is determined by looking up the `operator_mcc`. + // The three letter country code representing where the device's Data Session took place. This is determined by looking up the `operator_mcc`. OperatorCountry *string `json:"operator_country,omitempty"` - // The friendly name of the mobile operator network that the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource)-connected device is attached to. This is determined by looking up the `operator_mnc`. + // The friendly name of the mobile operator network that the [SIM](https://www.twilio.com/docs/iot/wireless/api/sim-resource)-connected device is attached to. This is determined by looking up the `operator_mnc`. OperatorName *string `json:"operator_name,omitempty"` - // The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated. + // The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated. CellId *string `json:"cell_id,omitempty"` - // An object that describes the estimated location in latitude and longitude where the device's Data Session took place. The location is derived from the `cell_id` when the Data Session was last updated. See [Cell Location Estimate Object](https://www.twilio.com/docs/iot/wireless/api/datasession-resource#cell-location-estimate-object). + // An object that describes the estimated location in latitude and longitude where the device's Data Session took place. The location is derived from the `cell_id` when the Data Session was last updated. See [Cell Location Estimate Object](https://www.twilio.com/docs/iot/wireless/api/datasession-resource#cell-location-estimate-object). CellLocationEstimate *interface{} `json:"cell_location_estimate,omitempty"` - // The number of packets uploaded by the device between the `start` time and when the Data Session was last updated. + // The number of packets uploaded by the device between the `start` time and when the Data Session was last updated. PacketsUploaded *int `json:"packets_uploaded,omitempty"` - // The number of packets downloaded by the device between the `start` time and when the Data Session was last updated. + // The number of packets downloaded by the device between the `start` time and when the Data Session was last updated. PacketsDownloaded *int `json:"packets_downloaded,omitempty"` - // The date that the resource was last updated, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date that the resource was last updated, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. LastUpdated *time.Time `json:"last_updated,omitempty"` - // The date that the Data Session started, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date that the Data Session started, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Start *time.Time `json:"start,omitempty"` - // The date that the record ended, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date that the record ended, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. End *time.Time `json:"end,omitempty"` - // The 'international mobile equipment identity' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula. + // The 'international mobile equipment identity' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula. Imei *string `json:"imei,omitempty"` } + + diff --git a/rest/wireless/v1/model_wireless_v1_rate_plan.go b/rest/wireless/v1/model_wireless_v1_rate_plan.go index 2ed408f40..d8429b22b 100644 --- a/rest/wireless/v1/model_wireless_v1_rate_plan.go +++ b/rest/wireless/v1/model_wireless_v1_rate_plan.go @@ -13,43 +13,45 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // WirelessV1RatePlan struct for WirelessV1RatePlan type WirelessV1RatePlan struct { - // The unique string that we created to identify the RatePlan resource. + // The unique string that we created to identify the RatePlan resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RatePlan resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RatePlan resource. AccountSid *string `json:"account_sid,omitempty"` - // The string that you assigned to describe the resource. + // The string that you assigned to describe the resource. FriendlyName *string `json:"friendly_name,omitempty"` - // Whether SIMs can use GPRS/3G/4G/LTE data connectivity. + // Whether SIMs can use GPRS/3G/4G/LTE data connectivity. DataEnabled *bool `json:"data_enabled,omitempty"` - // The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). + // The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). DataMetering *string `json:"data_metering,omitempty"` - // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. + // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. DataLimit *int `json:"data_limit,omitempty"` - // Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). + // Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). MessagingEnabled *bool `json:"messaging_enabled,omitempty"` - // Deprecated. Whether SIMs can make and receive voice calls. + // Deprecated. Whether SIMs can make and receive voice calls. VoiceEnabled *bool `json:"voice_enabled,omitempty"` - // Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). + // Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). NationalRoamingEnabled *bool `json:"national_roaming_enabled,omitempty"` - // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. + // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. NationalRoamingDataLimit *int `json:"national_roaming_data_limit,omitempty"` - // The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. + // The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. InternationalRoaming *[]string `json:"international_roaming,omitempty"` - // The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + // The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. InternationalRoamingDataLimit *int `json:"international_roaming_data_limit,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` } + + diff --git a/rest/wireless/v1/model_wireless_v1_sim.go b/rest/wireless/v1/model_wireless_v1_sim.go index da7366b3a..c395c883c 100644 --- a/rest/wireless/v1/model_wireless_v1_sim.go +++ b/rest/wireless/v1/model_wireless_v1_sim.go @@ -13,57 +13,59 @@ */ package openapi - import ( + "encoding/json" + "github.com/twilio/twilio-go/client" "time" ) - // WirelessV1Sim struct for WirelessV1Sim type WirelessV1Sim struct { - // The unique string that we created to identify the Sim resource. + // The unique string that we created to identify the Sim resource. Sid *string `json:"sid,omitempty"` - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. UniqueName *string `json:"unique_name,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource belongs. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource belongs. AccountSid *string `json:"account_sid,omitempty"` - // The SID of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource is assigned. + // The SID of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource is assigned. RatePlanSid *string `json:"rate_plan_sid,omitempty"` - // The string that you assigned to describe the Sim resource. + // The string that you assigned to describe the Sim resource. FriendlyName *string `json:"friendly_name,omitempty"` - // The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. + // The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. Iccid *string `json:"iccid,omitempty"` - // Deprecated. - EId *string `json:"e_id,omitempty"` - Status *string `json:"status,omitempty"` + // Deprecated. + EId *string `json:"e_id,omitempty"` + Status *string `json:"status,omitempty"` ResetStatus *string `json:"reset_status,omitempty"` - // The URL we call using the `commands_callback_method` when the SIM originates a machine-to-machine [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + // The URL we call using the `commands_callback_method` when the SIM originates a machine-to-machine [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. CommandsCallbackUrl *string `json:"commands_callback_url,omitempty"` - // The HTTP method we use to call `commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`. + // The HTTP method we use to call `commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`. CommandsCallbackMethod *string `json:"commands_callback_method,omitempty"` - // Deprecated. + // Deprecated. SmsFallbackMethod *string `json:"sms_fallback_method,omitempty"` - // Deprecated. + // Deprecated. SmsFallbackUrl *string `json:"sms_fallback_url,omitempty"` - // Deprecated. + // Deprecated. SmsMethod *string `json:"sms_method,omitempty"` - // Deprecated. + // Deprecated. SmsUrl *string `json:"sms_url,omitempty"` - // Deprecated. The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. + // Deprecated. The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. VoiceFallbackMethod *string `json:"voice_fallback_method,omitempty"` - // Deprecated. The URL we call using the `voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`. + // Deprecated. The URL we call using the `voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`. VoiceFallbackUrl *string `json:"voice_fallback_url,omitempty"` - // Deprecated. The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. Default is `POST`. + // Deprecated. The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. Default is `POST`. VoiceMethod *string `json:"voice_method,omitempty"` - // Deprecated. The URL we call using the `voice_method` when the SIM-connected device makes a voice call. + // Deprecated. The URL we call using the `voice_method` when the SIM-connected device makes a voice call. VoiceUrl *string `json:"voice_url,omitempty"` - // The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateCreated *time.Time `json:"date_created,omitempty"` - // The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateUpdated *time.Time `json:"date_updated,omitempty"` - // The absolute URL of the resource. + // The absolute URL of the resource. Url *string `json:"url,omitempty"` - // The URLs of related subresources. + // The URLs of related subresources. Links *map[string]interface{} `json:"links,omitempty"` - // Deprecated. + // Deprecated. IpAddress *string `json:"ip_address,omitempty"` } + + diff --git a/rest/wireless/v1/model_wireless_v1_usage_record.go b/rest/wireless/v1/model_wireless_v1_usage_record.go index cb4db64ef..4cfb0a485 100644 --- a/rest/wireless/v1/model_wireless_v1_usage_record.go +++ b/rest/wireless/v1/model_wireless_v1_usage_record.go @@ -13,17 +13,22 @@ */ package openapi - +import ( + "encoding/json" + "github.com/twilio/twilio-go/client" +) // WirelessV1UsageRecord struct for WirelessV1UsageRecord type WirelessV1UsageRecord struct { - // The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that this Usage Record is for. + // The SID of the [Sim resource](https://www.twilio.com/docs/iot/wireless/api/sim-resource) that this Usage Record is for. SimSid *string `json:"sim_sid,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resource. + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resource. AccountSid *string `json:"account_sid,omitempty"` - // The time period for which the usage is reported. Contains `start` and `end` datetime values given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + // The time period for which the usage is reported. Contains `start` and `end` datetime values given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Period *interface{} `json:"period,omitempty"` - // An object that describes the SIM's usage of Commands during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#commands-usage-object). + // An object that describes the SIM's usage of Commands during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#commands-usage-object). Commands *interface{} `json:"commands,omitempty"` - // An object that describes the SIM's data usage during the specified period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#data-usage-object). + // An object that describes the SIM's data usage during the specified period. See [Data Usage Object](https://www.twilio.com/docs/iot/wireless/api/sim-usagerecord-resource#data-usage-object). Data *interface{} `json:"data,omitempty"` } + + diff --git a/rest/wireless/v1/rate_plans.go b/rest/wireless/v1/rate_plans.go index a115db739..0e698fc56 100644 --- a/rest/wireless/v1/rate_plans.go +++ b/rest/wireless/v1/rate_plans.go @@ -18,229 +18,235 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'CreateRatePlan' type CreateRatePlanParams struct { - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // A descriptive string that you create to describe the resource. It does not have to be unique. - FriendlyName *string `json:"FriendlyName,omitempty"` - // Whether SIMs can use GPRS/3G/4G/LTE data connectivity. - DataEnabled *bool `json:"DataEnabled,omitempty"` - // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB and the default value is `1000`. - DataLimit *int `json:"DataLimit,omitempty"` - // The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). - DataMetering *string `json:"DataMetering,omitempty"` - // Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). - MessagingEnabled *bool `json:"MessagingEnabled,omitempty"` - // Deprecated. - VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` - // Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). - NationalRoamingEnabled *bool `json:"NationalRoamingEnabled,omitempty"` - // The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. - InternationalRoaming *[]string `json:"InternationalRoaming,omitempty"` - // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. - NationalRoamingDataLimit *int `json:"NationalRoamingDataLimit,omitempty"` - // The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. - InternationalRoamingDataLimit *int `json:"InternationalRoamingDataLimit,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // A descriptive string that you create to describe the resource. It does not have to be unique. + FriendlyName *string `json:"FriendlyName,omitempty"` + // Whether SIMs can use GPRS/3G/4G/LTE data connectivity. + DataEnabled *bool `json:"DataEnabled,omitempty"` + // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB and the default value is `1000`. + DataLimit *int `json:"DataLimit,omitempty"` + // The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#payg-vs-quota-data-plans). + DataMetering *string `json:"DataMetering,omitempty"` + // Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/iot/wireless/api/command-resource). + MessagingEnabled *bool `json:"MessagingEnabled,omitempty"` + // Deprecated. + VoiceEnabled *bool `json:"VoiceEnabled,omitempty"` + // Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming). + NationalRoamingEnabled *bool `json:"NationalRoamingEnabled,omitempty"` + // The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. + InternationalRoaming *[]string `json:"InternationalRoaming,omitempty"` + // The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource#national-roaming) for more info. + NationalRoamingDataLimit *int `json:"NationalRoamingDataLimit,omitempty"` + // The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + InternationalRoamingDataLimit *int `json:"InternationalRoamingDataLimit,omitempty"` } -func (params *CreateRatePlanParams) SetUniqueName(UniqueName string) *CreateRatePlanParams { - params.UniqueName = &UniqueName - return params +func (params *CreateRatePlanParams) SetUniqueName(UniqueName string) (*CreateRatePlanParams){ + params.UniqueName = &UniqueName + return params } -func (params *CreateRatePlanParams) SetFriendlyName(FriendlyName string) *CreateRatePlanParams { - params.FriendlyName = &FriendlyName - return params +func (params *CreateRatePlanParams) SetFriendlyName(FriendlyName string) (*CreateRatePlanParams){ + params.FriendlyName = &FriendlyName + return params } -func (params *CreateRatePlanParams) SetDataEnabled(DataEnabled bool) *CreateRatePlanParams { - params.DataEnabled = &DataEnabled - return params +func (params *CreateRatePlanParams) SetDataEnabled(DataEnabled bool) (*CreateRatePlanParams){ + params.DataEnabled = &DataEnabled + return params } -func (params *CreateRatePlanParams) SetDataLimit(DataLimit int) *CreateRatePlanParams { - params.DataLimit = &DataLimit - return params +func (params *CreateRatePlanParams) SetDataLimit(DataLimit int) (*CreateRatePlanParams){ + params.DataLimit = &DataLimit + return params } -func (params *CreateRatePlanParams) SetDataMetering(DataMetering string) *CreateRatePlanParams { - params.DataMetering = &DataMetering - return params +func (params *CreateRatePlanParams) SetDataMetering(DataMetering string) (*CreateRatePlanParams){ + params.DataMetering = &DataMetering + return params } -func (params *CreateRatePlanParams) SetMessagingEnabled(MessagingEnabled bool) *CreateRatePlanParams { - params.MessagingEnabled = &MessagingEnabled - return params +func (params *CreateRatePlanParams) SetMessagingEnabled(MessagingEnabled bool) (*CreateRatePlanParams){ + params.MessagingEnabled = &MessagingEnabled + return params } -func (params *CreateRatePlanParams) SetVoiceEnabled(VoiceEnabled bool) *CreateRatePlanParams { - params.VoiceEnabled = &VoiceEnabled - return params +func (params *CreateRatePlanParams) SetVoiceEnabled(VoiceEnabled bool) (*CreateRatePlanParams){ + params.VoiceEnabled = &VoiceEnabled + return params } -func (params *CreateRatePlanParams) SetNationalRoamingEnabled(NationalRoamingEnabled bool) *CreateRatePlanParams { - params.NationalRoamingEnabled = &NationalRoamingEnabled - return params +func (params *CreateRatePlanParams) SetNationalRoamingEnabled(NationalRoamingEnabled bool) (*CreateRatePlanParams){ + params.NationalRoamingEnabled = &NationalRoamingEnabled + return params } -func (params *CreateRatePlanParams) SetInternationalRoaming(InternationalRoaming []string) *CreateRatePlanParams { - params.InternationalRoaming = &InternationalRoaming - return params +func (params *CreateRatePlanParams) SetInternationalRoaming(InternationalRoaming []string) (*CreateRatePlanParams){ + params.InternationalRoaming = &InternationalRoaming + return params } -func (params *CreateRatePlanParams) SetNationalRoamingDataLimit(NationalRoamingDataLimit int) *CreateRatePlanParams { - params.NationalRoamingDataLimit = &NationalRoamingDataLimit - return params +func (params *CreateRatePlanParams) SetNationalRoamingDataLimit(NationalRoamingDataLimit int) (*CreateRatePlanParams){ + params.NationalRoamingDataLimit = &NationalRoamingDataLimit + return params } -func (params *CreateRatePlanParams) SetInternationalRoamingDataLimit(InternationalRoamingDataLimit int) *CreateRatePlanParams { - params.InternationalRoamingDataLimit = &InternationalRoamingDataLimit - return params +func (params *CreateRatePlanParams) SetInternationalRoamingDataLimit(InternationalRoamingDataLimit int) (*CreateRatePlanParams){ + params.InternationalRoamingDataLimit = &InternationalRoamingDataLimit + return params } -// +// func (c *ApiService) CreateRatePlan(params *CreateRatePlanParams) (*WirelessV1RatePlan, error) { - path := "/v1/RatePlans" + path := "/v1/RatePlans" + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.DataEnabled != nil { + data.Set("DataEnabled", fmt.Sprint(*params.DataEnabled)) + } + if params != nil && params.DataLimit != nil { + data.Set("DataLimit", fmt.Sprint(*params.DataLimit)) + } + if params != nil && params.DataMetering != nil { + data.Set("DataMetering", *params.DataMetering) + } + if params != nil && params.MessagingEnabled != nil { + data.Set("MessagingEnabled", fmt.Sprint(*params.MessagingEnabled)) + } + if params != nil && params.VoiceEnabled != nil { + data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) + } + if params != nil && params.NationalRoamingEnabled != nil { + data.Set("NationalRoamingEnabled", fmt.Sprint(*params.NationalRoamingEnabled)) + } + if params != nil && params.InternationalRoaming != nil { + for _, item := range *params.InternationalRoaming { + data.Add("InternationalRoaming", item) + } + } + if params != nil && params.NationalRoamingDataLimit != nil { + data.Set("NationalRoamingDataLimit", fmt.Sprint(*params.NationalRoamingDataLimit)) + } + if params != nil && params.InternationalRoamingDataLimit != nil { + data.Set("InternationalRoamingDataLimit", fmt.Sprint(*params.InternationalRoamingDataLimit)) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &WirelessV1RatePlan{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err +} - data := url.Values{} - headers := make(map[string]interface{}) +// +func (c *ApiService) DeleteRatePlan(Sid string, ) (error) { + path := "/v1/RatePlans/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.DataEnabled != nil { - data.Set("DataEnabled", fmt.Sprint(*params.DataEnabled)) - } - if params != nil && params.DataLimit != nil { - data.Set("DataLimit", fmt.Sprint(*params.DataLimit)) - } - if params != nil && params.DataMetering != nil { - data.Set("DataMetering", *params.DataMetering) - } - if params != nil && params.MessagingEnabled != nil { - data.Set("MessagingEnabled", fmt.Sprint(*params.MessagingEnabled)) - } - if params != nil && params.VoiceEnabled != nil { - data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled)) - } - if params != nil && params.NationalRoamingEnabled != nil { - data.Set("NationalRoamingEnabled", fmt.Sprint(*params.NationalRoamingEnabled)) - } - if params != nil && params.InternationalRoaming != nil { - for _, item := range *params.InternationalRoaming { - data.Add("InternationalRoaming", item) - } - } - if params != nil && params.NationalRoamingDataLimit != nil { - data.Set("NationalRoamingDataLimit", fmt.Sprint(*params.NationalRoamingDataLimit)) - } - if params != nil && params.InternationalRoamingDataLimit != nil { - data.Set("InternationalRoamingDataLimit", fmt.Sprint(*params.InternationalRoamingDataLimit)) - } + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &WirelessV1RatePlan{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } - return ps, err -} - -// -func (c *ApiService) DeleteRatePlan(Sid string) error { - path := "/v1/RatePlans/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + defer resp.Body.Close() - data := url.Values{} - headers := make(map[string]interface{}) + return nil +} - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } +// +func (c *ApiService) FetchRatePlan(Sid string, ) (*WirelessV1RatePlan, error) { + path := "/v1/RatePlans/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - defer resp.Body.Close() + data := url.Values{} + headers := make(map[string]interface{}) - return nil -} -// -func (c *ApiService) FetchRatePlan(Sid string) (*WirelessV1RatePlan, error) { - path := "/v1/RatePlans/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + defer resp.Body.Close() - defer resp.Body.Close() + ps := &WirelessV1RatePlan{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - ps := &WirelessV1RatePlan{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + return ps, err } // Optional parameters for the method 'ListRatePlan' type ListRatePlanParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListRatePlanParams) SetPageSize(PageSize int) *ListRatePlanParams { - params.PageSize = &PageSize - return params +func (params *ListRatePlanParams) SetPageSize(PageSize int) (*ListRatePlanParams){ + params.PageSize = &PageSize + return params } -func (params *ListRatePlanParams) SetLimit(Limit int) *ListRatePlanParams { - params.Limit = &Limit - return params +func (params *ListRatePlanParams) SetLimit(Limit int) (*ListRatePlanParams){ + params.Limit = &Limit + return params } // Retrieve a single page of RatePlan records from the API. Request is executed immediately. func (c *ApiService) PageRatePlan(params *ListRatePlanParams, pageToken, pageNumber string) (*ListRatePlanResponse, error) { - path := "/v1/RatePlans" + path := "/v1/RatePlans" - data := url.Values{} - headers := make(map[string]interface{}) + + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListRatePlanResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListRatePlanResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists RatePlan records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -281,6 +287,7 @@ func (c *ApiService) StreamRatePlan(params *ListRatePlanParams) (chan WirelessV1 return recordChannel, errorChannel } + func (c *ApiService) streamRatePlan(response *ListRatePlanResponse, params *ListRatePlanParams, recordChannel chan WirelessV1RatePlan, errorChannel chan error) { curRecord := 1 @@ -312,66 +319,68 @@ func (c *ApiService) streamRatePlan(response *ListRatePlanResponse, params *List } func (c *ApiService) getNextListRatePlanResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListRatePlanResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListRatePlanResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateRatePlan' type UpdateRatePlanParams struct { - // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // A descriptive string that you create to describe the resource. It does not have to be unique. - FriendlyName *string `json:"FriendlyName,omitempty"` + // An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // A descriptive string that you create to describe the resource. It does not have to be unique. + FriendlyName *string `json:"FriendlyName,omitempty"` } -func (params *UpdateRatePlanParams) SetUniqueName(UniqueName string) *UpdateRatePlanParams { - params.UniqueName = &UniqueName - return params +func (params *UpdateRatePlanParams) SetUniqueName(UniqueName string) (*UpdateRatePlanParams){ + params.UniqueName = &UniqueName + return params } -func (params *UpdateRatePlanParams) SetFriendlyName(FriendlyName string) *UpdateRatePlanParams { - params.FriendlyName = &FriendlyName - return params +func (params *UpdateRatePlanParams) SetFriendlyName(FriendlyName string) (*UpdateRatePlanParams){ + params.FriendlyName = &FriendlyName + return params } -// +// func (c *ApiService) UpdateRatePlan(Sid string, params *UpdateRatePlanParams) (*WirelessV1RatePlan, error) { - path := "/v1/RatePlans/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + path := "/v1/RatePlans/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - ps := &WirelessV1RatePlan{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + defer resp.Body.Close() + + ps := &WirelessV1RatePlan{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } diff --git a/rest/wireless/v1/sims.go b/rest/wireless/v1/sims.go index 001f8128a..6ce44752e 100644 --- a/rest/wireless/v1/sims.go +++ b/rest/wireless/v1/sims.go @@ -18,145 +18,150 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Delete a Sim resource on your Account. -func (c *ApiService) DeleteSim(Sid string) error { - path := "/v1/Sims/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) DeleteSim(Sid string, ) (error) { + path := "/v1/Sims/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) - if err != nil { - return err - } - defer resp.Body.Close() - return nil + resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) + if err != nil { + return err + } + + defer resp.Body.Close() + + return nil } // Fetch a Sim resource on your Account. -func (c *ApiService) FetchSim(Sid string) (*WirelessV1Sim, error) { - path := "/v1/Sims/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) +func (c *ApiService) FetchSim(Sid string, ) (*WirelessV1Sim, error) { + path := "/v1/Sims/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - defer resp.Body.Close() - ps := &WirelessV1Sim{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &WirelessV1Sim{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Optional parameters for the method 'ListSim' type ListSimParams struct { - // Only return Sim resources with this status. - Status *string `json:"Status,omitempty"` - // Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. - Iccid *string `json:"Iccid,omitempty"` - // The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. - RatePlan *string `json:"RatePlan,omitempty"` - // Deprecated. - EId *string `json:"EId,omitempty"` - // Only return Sim resources with this registration code. This will return a list with a maximum size of 1. - SimRegistrationCode *string `json:"SimRegistrationCode,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` -} - -func (params *ListSimParams) SetStatus(Status string) *ListSimParams { - params.Status = &Status - return params -} -func (params *ListSimParams) SetIccid(Iccid string) *ListSimParams { - params.Iccid = &Iccid - return params -} -func (params *ListSimParams) SetRatePlan(RatePlan string) *ListSimParams { - params.RatePlan = &RatePlan - return params -} -func (params *ListSimParams) SetEId(EId string) *ListSimParams { - params.EId = &EId - return params -} -func (params *ListSimParams) SetSimRegistrationCode(SimRegistrationCode string) *ListSimParams { - params.SimRegistrationCode = &SimRegistrationCode - return params -} -func (params *ListSimParams) SetPageSize(PageSize int) *ListSimParams { - params.PageSize = &PageSize - return params -} -func (params *ListSimParams) SetLimit(Limit int) *ListSimParams { - params.Limit = &Limit - return params + // Only return Sim resources with this status. + Status *string `json:"Status,omitempty"` + // Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. + Iccid *string `json:"Iccid,omitempty"` + // The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. + RatePlan *string `json:"RatePlan,omitempty"` + // Deprecated. + EId *string `json:"EId,omitempty"` + // Only return Sim resources with this registration code. This will return a list with a maximum size of 1. + SimRegistrationCode *string `json:"SimRegistrationCode,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` +} + +func (params *ListSimParams) SetStatus(Status string) (*ListSimParams){ + params.Status = &Status + return params +} +func (params *ListSimParams) SetIccid(Iccid string) (*ListSimParams){ + params.Iccid = &Iccid + return params +} +func (params *ListSimParams) SetRatePlan(RatePlan string) (*ListSimParams){ + params.RatePlan = &RatePlan + return params +} +func (params *ListSimParams) SetEId(EId string) (*ListSimParams){ + params.EId = &EId + return params +} +func (params *ListSimParams) SetSimRegistrationCode(SimRegistrationCode string) (*ListSimParams){ + params.SimRegistrationCode = &SimRegistrationCode + return params +} +func (params *ListSimParams) SetPageSize(PageSize int) (*ListSimParams){ + params.PageSize = &PageSize + return params +} +func (params *ListSimParams) SetLimit(Limit int) (*ListSimParams){ + params.Limit = &Limit + return params } // Retrieve a single page of Sim records from the API. Request is executed immediately. func (c *ApiService) PageSim(params *ListSimParams, pageToken, pageNumber string) (*ListSimResponse, error) { - path := "/v1/Sims" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.Iccid != nil { - data.Set("Iccid", *params.Iccid) - } - if params != nil && params.RatePlan != nil { - data.Set("RatePlan", *params.RatePlan) - } - if params != nil && params.EId != nil { - data.Set("EId", *params.EId) - } - if params != nil && params.SimRegistrationCode != nil { - data.Set("SimRegistrationCode", *params.SimRegistrationCode) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListSimResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Sims" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.Iccid != nil { + data.Set("Iccid", *params.Iccid) + } + if params != nil && params.RatePlan != nil { + data.Set("RatePlan", *params.RatePlan) + } + if params != nil && params.EId != nil { + data.Set("EId", *params.EId) + } + if params != nil && params.SimRegistrationCode != nil { + data.Set("SimRegistrationCode", *params.SimRegistrationCode) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListSimResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists Sim records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -197,6 +202,7 @@ func (c *ApiService) StreamSim(params *ListSimParams) (chan WirelessV1Sim, chan return recordChannel, errorChannel } + func (c *ApiService) streamSim(response *ListSimResponse, params *ListSimParams, recordChannel chan WirelessV1Sim, errorChannel chan error) { curRecord := 1 @@ -228,210 +234,212 @@ func (c *ApiService) streamSim(response *ListSimResponse, params *ListSimParams, } func (c *ApiService) getNextListSimResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListSimResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + ps := &ListSimResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + // Optional parameters for the method 'UpdateSim' type UpdateSimParams struct { - // An application-defined string that uniquely identifies the resource. It can be used in place of the `sid` in the URL path to address the resource. - UniqueName *string `json:"UniqueName,omitempty"` - // The HTTP method we should use to call `callback_url`. Can be: `POST` or `GET`. The default is `POST`. - CallbackMethod *string `json:"CallbackMethod,omitempty"` - // The URL we should call using the `callback_url` when the SIM has finished updating. When the SIM transitions from `new` to `ready` or from any status to `deactivated`, we call this URL when the status changes to an intermediate status (`ready` or `deactivated`) and again when the status changes to its final status (`active` or `canceled`). - CallbackUrl *string `json:"CallbackUrl,omitempty"` - // A descriptive string that you create to describe the Sim resource. It does not need to be unique. - FriendlyName *string `json:"FriendlyName,omitempty"` - // The SID or unique name of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource should be assigned. - RatePlan *string `json:"RatePlan,omitempty"` - // - Status *string `json:"Status,omitempty"` - // The HTTP method we should use to call `commands_callback_url`. Can be: `POST` or `GET`. The default is `POST`. - CommandsCallbackMethod *string `json:"CommandsCallbackMethod,omitempty"` - // The URL we should call using the `commands_callback_method` when the SIM sends a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body is ignored. - CommandsCallbackUrl *string `json:"CommandsCallbackUrl,omitempty"` - // The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. - SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` - // The URL we should call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `sms_url`. - SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` - // The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. Default is `POST`. - SmsMethod *string `json:"SmsMethod,omitempty"` - // The URL we should call using the `sms_method` when the SIM-connected device sends an SMS message that is not a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). - SmsUrl *string `json:"SmsUrl,omitempty"` - // Deprecated. - VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` - // Deprecated. - VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` - // Deprecated. - VoiceMethod *string `json:"VoiceMethod,omitempty"` - // Deprecated. - VoiceUrl *string `json:"VoiceUrl,omitempty"` - // - ResetStatus *string `json:"ResetStatus,omitempty"` - // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a [Subaccount](https://www.twilio.com/docs/iam/api/subaccounts) of the requesting Account. Only valid when the Sim resource's status is `new`. For more information, see the [Move SIMs between Subaccounts documentation](https://www.twilio.com/docs/iot/wireless/api/sim-resource#move-sims-between-subaccounts). - AccountSid *string `json:"AccountSid,omitempty"` -} - -func (params *UpdateSimParams) SetUniqueName(UniqueName string) *UpdateSimParams { - params.UniqueName = &UniqueName - return params -} -func (params *UpdateSimParams) SetCallbackMethod(CallbackMethod string) *UpdateSimParams { - params.CallbackMethod = &CallbackMethod - return params -} -func (params *UpdateSimParams) SetCallbackUrl(CallbackUrl string) *UpdateSimParams { - params.CallbackUrl = &CallbackUrl - return params -} -func (params *UpdateSimParams) SetFriendlyName(FriendlyName string) *UpdateSimParams { - params.FriendlyName = &FriendlyName - return params -} -func (params *UpdateSimParams) SetRatePlan(RatePlan string) *UpdateSimParams { - params.RatePlan = &RatePlan - return params -} -func (params *UpdateSimParams) SetStatus(Status string) *UpdateSimParams { - params.Status = &Status - return params -} -func (params *UpdateSimParams) SetCommandsCallbackMethod(CommandsCallbackMethod string) *UpdateSimParams { - params.CommandsCallbackMethod = &CommandsCallbackMethod - return params -} -func (params *UpdateSimParams) SetCommandsCallbackUrl(CommandsCallbackUrl string) *UpdateSimParams { - params.CommandsCallbackUrl = &CommandsCallbackUrl - return params -} -func (params *UpdateSimParams) SetSmsFallbackMethod(SmsFallbackMethod string) *UpdateSimParams { - params.SmsFallbackMethod = &SmsFallbackMethod - return params -} -func (params *UpdateSimParams) SetSmsFallbackUrl(SmsFallbackUrl string) *UpdateSimParams { - params.SmsFallbackUrl = &SmsFallbackUrl - return params -} -func (params *UpdateSimParams) SetSmsMethod(SmsMethod string) *UpdateSimParams { - params.SmsMethod = &SmsMethod - return params -} -func (params *UpdateSimParams) SetSmsUrl(SmsUrl string) *UpdateSimParams { - params.SmsUrl = &SmsUrl - return params -} -func (params *UpdateSimParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) *UpdateSimParams { - params.VoiceFallbackMethod = &VoiceFallbackMethod - return params -} -func (params *UpdateSimParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) *UpdateSimParams { - params.VoiceFallbackUrl = &VoiceFallbackUrl - return params -} -func (params *UpdateSimParams) SetVoiceMethod(VoiceMethod string) *UpdateSimParams { - params.VoiceMethod = &VoiceMethod - return params -} -func (params *UpdateSimParams) SetVoiceUrl(VoiceUrl string) *UpdateSimParams { - params.VoiceUrl = &VoiceUrl - return params -} -func (params *UpdateSimParams) SetResetStatus(ResetStatus string) *UpdateSimParams { - params.ResetStatus = &ResetStatus - return params -} -func (params *UpdateSimParams) SetAccountSid(AccountSid string) *UpdateSimParams { - params.AccountSid = &AccountSid - return params + // An application-defined string that uniquely identifies the resource. It can be used in place of the `sid` in the URL path to address the resource. + UniqueName *string `json:"UniqueName,omitempty"` + // The HTTP method we should use to call `callback_url`. Can be: `POST` or `GET`. The default is `POST`. + CallbackMethod *string `json:"CallbackMethod,omitempty"` + // The URL we should call using the `callback_url` when the SIM has finished updating. When the SIM transitions from `new` to `ready` or from any status to `deactivated`, we call this URL when the status changes to an intermediate status (`ready` or `deactivated`) and again when the status changes to its final status (`active` or `canceled`). + CallbackUrl *string `json:"CallbackUrl,omitempty"` + // A descriptive string that you create to describe the Sim resource. It does not need to be unique. + FriendlyName *string `json:"FriendlyName,omitempty"` + // The SID or unique name of the [RatePlan resource](https://www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource should be assigned. + RatePlan *string `json:"RatePlan,omitempty"` + // + Status *string `json:"Status,omitempty"` + // The HTTP method we should use to call `commands_callback_url`. Can be: `POST` or `GET`. The default is `POST`. + CommandsCallbackMethod *string `json:"CommandsCallbackMethod,omitempty"` + // The URL we should call using the `commands_callback_method` when the SIM sends a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body is ignored. + CommandsCallbackUrl *string `json:"CommandsCallbackUrl,omitempty"` + // The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. + SmsFallbackMethod *string `json:"SmsFallbackMethod,omitempty"` + // The URL we should call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `sms_url`. + SmsFallbackUrl *string `json:"SmsFallbackUrl,omitempty"` + // The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. Default is `POST`. + SmsMethod *string `json:"SmsMethod,omitempty"` + // The URL we should call using the `sms_method` when the SIM-connected device sends an SMS message that is not a [Command](https://www.twilio.com/docs/iot/wireless/api/command-resource). + SmsUrl *string `json:"SmsUrl,omitempty"` + // Deprecated. + VoiceFallbackMethod *string `json:"VoiceFallbackMethod,omitempty"` + // Deprecated. + VoiceFallbackUrl *string `json:"VoiceFallbackUrl,omitempty"` + // Deprecated. + VoiceMethod *string `json:"VoiceMethod,omitempty"` + // Deprecated. + VoiceUrl *string `json:"VoiceUrl,omitempty"` + // + ResetStatus *string `json:"ResetStatus,omitempty"` + // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a [Subaccount](https://www.twilio.com/docs/iam/api/subaccounts) of the requesting Account. Only valid when the Sim resource's status is `new`. For more information, see the [Move SIMs between Subaccounts documentation](https://www.twilio.com/docs/iot/wireless/api/sim-resource#move-sims-between-subaccounts). + AccountSid *string `json:"AccountSid,omitempty"` +} + +func (params *UpdateSimParams) SetUniqueName(UniqueName string) (*UpdateSimParams){ + params.UniqueName = &UniqueName + return params +} +func (params *UpdateSimParams) SetCallbackMethod(CallbackMethod string) (*UpdateSimParams){ + params.CallbackMethod = &CallbackMethod + return params +} +func (params *UpdateSimParams) SetCallbackUrl(CallbackUrl string) (*UpdateSimParams){ + params.CallbackUrl = &CallbackUrl + return params +} +func (params *UpdateSimParams) SetFriendlyName(FriendlyName string) (*UpdateSimParams){ + params.FriendlyName = &FriendlyName + return params +} +func (params *UpdateSimParams) SetRatePlan(RatePlan string) (*UpdateSimParams){ + params.RatePlan = &RatePlan + return params +} +func (params *UpdateSimParams) SetStatus(Status string) (*UpdateSimParams){ + params.Status = &Status + return params +} +func (params *UpdateSimParams) SetCommandsCallbackMethod(CommandsCallbackMethod string) (*UpdateSimParams){ + params.CommandsCallbackMethod = &CommandsCallbackMethod + return params +} +func (params *UpdateSimParams) SetCommandsCallbackUrl(CommandsCallbackUrl string) (*UpdateSimParams){ + params.CommandsCallbackUrl = &CommandsCallbackUrl + return params +} +func (params *UpdateSimParams) SetSmsFallbackMethod(SmsFallbackMethod string) (*UpdateSimParams){ + params.SmsFallbackMethod = &SmsFallbackMethod + return params +} +func (params *UpdateSimParams) SetSmsFallbackUrl(SmsFallbackUrl string) (*UpdateSimParams){ + params.SmsFallbackUrl = &SmsFallbackUrl + return params +} +func (params *UpdateSimParams) SetSmsMethod(SmsMethod string) (*UpdateSimParams){ + params.SmsMethod = &SmsMethod + return params +} +func (params *UpdateSimParams) SetSmsUrl(SmsUrl string) (*UpdateSimParams){ + params.SmsUrl = &SmsUrl + return params +} +func (params *UpdateSimParams) SetVoiceFallbackMethod(VoiceFallbackMethod string) (*UpdateSimParams){ + params.VoiceFallbackMethod = &VoiceFallbackMethod + return params +} +func (params *UpdateSimParams) SetVoiceFallbackUrl(VoiceFallbackUrl string) (*UpdateSimParams){ + params.VoiceFallbackUrl = &VoiceFallbackUrl + return params +} +func (params *UpdateSimParams) SetVoiceMethod(VoiceMethod string) (*UpdateSimParams){ + params.VoiceMethod = &VoiceMethod + return params +} +func (params *UpdateSimParams) SetVoiceUrl(VoiceUrl string) (*UpdateSimParams){ + params.VoiceUrl = &VoiceUrl + return params +} +func (params *UpdateSimParams) SetResetStatus(ResetStatus string) (*UpdateSimParams){ + params.ResetStatus = &ResetStatus + return params +} +func (params *UpdateSimParams) SetAccountSid(AccountSid string) (*UpdateSimParams){ + params.AccountSid = &AccountSid + return params } // Updates the given properties of a Sim resource on your Account. func (c *ApiService) UpdateSim(Sid string, params *UpdateSimParams) (*WirelessV1Sim, error) { - path := "/v1/Sims/{Sid}" - path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.UniqueName != nil { - data.Set("UniqueName", *params.UniqueName) - } - if params != nil && params.CallbackMethod != nil { - data.Set("CallbackMethod", *params.CallbackMethod) - } - if params != nil && params.CallbackUrl != nil { - data.Set("CallbackUrl", *params.CallbackUrl) - } - if params != nil && params.FriendlyName != nil { - data.Set("FriendlyName", *params.FriendlyName) - } - if params != nil && params.RatePlan != nil { - data.Set("RatePlan", *params.RatePlan) - } - if params != nil && params.Status != nil { - data.Set("Status", *params.Status) - } - if params != nil && params.CommandsCallbackMethod != nil { - data.Set("CommandsCallbackMethod", *params.CommandsCallbackMethod) - } - if params != nil && params.CommandsCallbackUrl != nil { - data.Set("CommandsCallbackUrl", *params.CommandsCallbackUrl) - } - if params != nil && params.SmsFallbackMethod != nil { - data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) - } - if params != nil && params.SmsFallbackUrl != nil { - data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) - } - if params != nil && params.SmsMethod != nil { - data.Set("SmsMethod", *params.SmsMethod) - } - if params != nil && params.SmsUrl != nil { - data.Set("SmsUrl", *params.SmsUrl) - } - if params != nil && params.VoiceFallbackMethod != nil { - data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) - } - if params != nil && params.VoiceFallbackUrl != nil { - data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) - } - if params != nil && params.VoiceMethod != nil { - data.Set("VoiceMethod", *params.VoiceMethod) - } - if params != nil && params.VoiceUrl != nil { - data.Set("VoiceUrl", *params.VoiceUrl) - } - if params != nil && params.ResetStatus != nil { - data.Set("ResetStatus", *params.ResetStatus) - } - if params != nil && params.AccountSid != nil { - data.Set("AccountSid", *params.AccountSid) - } - - resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &WirelessV1Sim{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Sims/{Sid}" + path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.UniqueName != nil { + data.Set("UniqueName", *params.UniqueName) + } + if params != nil && params.CallbackMethod != nil { + data.Set("CallbackMethod", *params.CallbackMethod) + } + if params != nil && params.CallbackUrl != nil { + data.Set("CallbackUrl", *params.CallbackUrl) + } + if params != nil && params.FriendlyName != nil { + data.Set("FriendlyName", *params.FriendlyName) + } + if params != nil && params.RatePlan != nil { + data.Set("RatePlan", *params.RatePlan) + } + if params != nil && params.Status != nil { + data.Set("Status", *params.Status) + } + if params != nil && params.CommandsCallbackMethod != nil { + data.Set("CommandsCallbackMethod", *params.CommandsCallbackMethod) + } + if params != nil && params.CommandsCallbackUrl != nil { + data.Set("CommandsCallbackUrl", *params.CommandsCallbackUrl) + } + if params != nil && params.SmsFallbackMethod != nil { + data.Set("SmsFallbackMethod", *params.SmsFallbackMethod) + } + if params != nil && params.SmsFallbackUrl != nil { + data.Set("SmsFallbackUrl", *params.SmsFallbackUrl) + } + if params != nil && params.SmsMethod != nil { + data.Set("SmsMethod", *params.SmsMethod) + } + if params != nil && params.SmsUrl != nil { + data.Set("SmsUrl", *params.SmsUrl) + } + if params != nil && params.VoiceFallbackMethod != nil { + data.Set("VoiceFallbackMethod", *params.VoiceFallbackMethod) + } + if params != nil && params.VoiceFallbackUrl != nil { + data.Set("VoiceFallbackUrl", *params.VoiceFallbackUrl) + } + if params != nil && params.VoiceMethod != nil { + data.Set("VoiceMethod", *params.VoiceMethod) + } + if params != nil && params.VoiceUrl != nil { + data.Set("VoiceUrl", *params.VoiceUrl) + } + if params != nil && params.ResetStatus != nil { + data.Set("ResetStatus", *params.ResetStatus) + } + if params != nil && params.AccountSid != nil { + data.Set("AccountSid", *params.AccountSid) + } + + + resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &WirelessV1Sim{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } diff --git a/rest/wireless/v1/sims_data_sessions.go b/rest/wireless/v1/sims_data_sessions.go index e54aa72f1..03f723f44 100644 --- a/rest/wireless/v1/sims_data_sessions.go +++ b/rest/wireless/v1/sims_data_sessions.go @@ -18,61 +18,61 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListDataSession' type ListDataSessionParams struct { - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListDataSessionParams) SetPageSize(PageSize int) *ListDataSessionParams { - params.PageSize = &PageSize - return params +func (params *ListDataSessionParams) SetPageSize(PageSize int) (*ListDataSessionParams){ + params.PageSize = &PageSize + return params } -func (params *ListDataSessionParams) SetLimit(Limit int) *ListDataSessionParams { - params.Limit = &Limit - return params +func (params *ListDataSessionParams) SetLimit(Limit int) (*ListDataSessionParams){ + params.Limit = &Limit + return params } // Retrieve a single page of DataSession records from the API. Request is executed immediately. func (c *ApiService) PageDataSession(SimSid string, params *ListDataSessionParams, pageToken, pageNumber string) (*ListDataSessionResponse, error) { - path := "/v1/Sims/{SimSid}/DataSessions" + path := "/v1/Sims/{SimSid}/DataSessions" - path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) + path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) - data := url.Values{} - headers := make(map[string]interface{}) + data := url.Values{} + headers := make(map[string]interface{}) - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } - defer resp.Body.Close() + defer resp.Body.Close() - ps := &ListDataSessionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } + ps := &ListDataSessionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } - return ps, err + return ps, err } // Lists DataSession records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -113,6 +113,7 @@ func (c *ApiService) StreamDataSession(SimSid string, params *ListDataSessionPar return recordChannel, errorChannel } + func (c *ApiService) streamDataSession(response *ListDataSessionResponse, params *ListDataSessionParams, recordChannel chan WirelessV1DataSession, errorChannel chan error) { curRecord := 1 @@ -144,19 +145,20 @@ func (c *ApiService) streamDataSession(response *ListDataSessionResponse, params } func (c *ApiService) getNextListDataSessionResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListDataSessionResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListDataSessionResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/wireless/v1/sims_usage_records.go b/rest/wireless/v1/sims_usage_records.go index db9896288..afaea6ede 100644 --- a/rest/wireless/v1/sims_usage_records.go +++ b/rest/wireless/v1/sims_usage_records.go @@ -18,89 +18,88 @@ import ( "encoding/json" "fmt" "net/url" - "strings" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListUsageRecord' type ListUsageRecordParams struct { - // Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. - End *time.Time `json:"End,omitempty"` - // Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. - Start *time.Time `json:"Start,omitempty"` - // How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. - Granularity *string `json:"Granularity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. + End *time.Time `json:"End,omitempty"` + // Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. + Start *time.Time `json:"Start,omitempty"` + // How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. + Granularity *string `json:"Granularity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListUsageRecordParams) SetEnd(End time.Time) *ListUsageRecordParams { - params.End = &End - return params +func (params *ListUsageRecordParams) SetEnd(End time.Time) (*ListUsageRecordParams){ + params.End = &End + return params } -func (params *ListUsageRecordParams) SetStart(Start time.Time) *ListUsageRecordParams { - params.Start = &Start - return params +func (params *ListUsageRecordParams) SetStart(Start time.Time) (*ListUsageRecordParams){ + params.Start = &Start + return params } -func (params *ListUsageRecordParams) SetGranularity(Granularity string) *ListUsageRecordParams { - params.Granularity = &Granularity - return params +func (params *ListUsageRecordParams) SetGranularity(Granularity string) (*ListUsageRecordParams){ + params.Granularity = &Granularity + return params } -func (params *ListUsageRecordParams) SetPageSize(PageSize int) *ListUsageRecordParams { - params.PageSize = &PageSize - return params +func (params *ListUsageRecordParams) SetPageSize(PageSize int) (*ListUsageRecordParams){ + params.PageSize = &PageSize + return params } -func (params *ListUsageRecordParams) SetLimit(Limit int) *ListUsageRecordParams { - params.Limit = &Limit - return params +func (params *ListUsageRecordParams) SetLimit(Limit int) (*ListUsageRecordParams){ + params.Limit = &Limit + return params } // Retrieve a single page of UsageRecord records from the API. Request is executed immediately. func (c *ApiService) PageUsageRecord(SimSid string, params *ListUsageRecordParams, pageToken, pageNumber string) (*ListUsageRecordResponse, error) { - path := "/v1/Sims/{SimSid}/UsageRecords" - - path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.End != nil { - data.Set("End", fmt.Sprint((*params.End).Format(time.RFC3339))) - } - if params != nil && params.Start != nil { - data.Set("Start", fmt.Sprint((*params.Start).Format(time.RFC3339))) - } - if params != nil && params.Granularity != nil { - data.Set("Granularity", *params.Granularity) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/Sims/{SimSid}/UsageRecords" + + path = strings.Replace(path, "{"+"SimSid"+"}", SimSid, -1) + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.End != nil { + data.Set("End", fmt.Sprint((*params.End).Format(time.RFC3339))) + } + if params != nil && params.Start != nil { + data.Set("Start", fmt.Sprint((*params.Start).Format(time.RFC3339))) + } + if params != nil && params.Granularity != nil { + data.Set("Granularity", *params.Granularity) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUsageRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists UsageRecord records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -141,6 +140,7 @@ func (c *ApiService) StreamUsageRecord(SimSid string, params *ListUsageRecordPar return recordChannel, errorChannel } + func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params *ListUsageRecordParams, recordChannel chan WirelessV1UsageRecord, errorChannel chan error) { curRecord := 1 @@ -172,19 +172,20 @@ func (c *ApiService) streamUsageRecord(response *ListUsageRecordResponse, params } func (c *ApiService) getNextListUsageRecordResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListUsageRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } + diff --git a/rest/wireless/v1/usage_records.go b/rest/wireless/v1/usage_records.go index 4f22007f3..12757a489 100644 --- a/rest/wireless/v1/usage_records.go +++ b/rest/wireless/v1/usage_records.go @@ -18,86 +18,87 @@ import ( "encoding/json" "fmt" "net/url" - "time" - "github.com/twilio/twilio-go/client" + "github.com/twilio/twilio-go/client" ) + // Optional parameters for the method 'ListAccountUsageRecord' type ListAccountUsageRecordParams struct { - // Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). - End *time.Time `json:"End,omitempty"` - // Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). - Start *time.Time `json:"Start,omitempty"` - // How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. - Granularity *string `json:"Granularity,omitempty"` - // How many resources to return in each list page. The default is 50, and the maximum is 1000. - PageSize *int `json:"PageSize,omitempty"` - // Max number of records to return. - Limit *int `json:"limit,omitempty"` + // Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). + End *time.Time `json:"End,omitempty"` + // Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). + Start *time.Time `json:"Start,omitempty"` + // How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. + Granularity *string `json:"Granularity,omitempty"` + // How many resources to return in each list page. The default is 50, and the maximum is 1000. + PageSize *int `json:"PageSize,omitempty"` + // Max number of records to return. + Limit *int `json:"limit,omitempty"` } -func (params *ListAccountUsageRecordParams) SetEnd(End time.Time) *ListAccountUsageRecordParams { - params.End = &End - return params +func (params *ListAccountUsageRecordParams) SetEnd(End time.Time) (*ListAccountUsageRecordParams){ + params.End = &End + return params } -func (params *ListAccountUsageRecordParams) SetStart(Start time.Time) *ListAccountUsageRecordParams { - params.Start = &Start - return params +func (params *ListAccountUsageRecordParams) SetStart(Start time.Time) (*ListAccountUsageRecordParams){ + params.Start = &Start + return params } -func (params *ListAccountUsageRecordParams) SetGranularity(Granularity string) *ListAccountUsageRecordParams { - params.Granularity = &Granularity - return params +func (params *ListAccountUsageRecordParams) SetGranularity(Granularity string) (*ListAccountUsageRecordParams){ + params.Granularity = &Granularity + return params } -func (params *ListAccountUsageRecordParams) SetPageSize(PageSize int) *ListAccountUsageRecordParams { - params.PageSize = &PageSize - return params +func (params *ListAccountUsageRecordParams) SetPageSize(PageSize int) (*ListAccountUsageRecordParams){ + params.PageSize = &PageSize + return params } -func (params *ListAccountUsageRecordParams) SetLimit(Limit int) *ListAccountUsageRecordParams { - params.Limit = &Limit - return params +func (params *ListAccountUsageRecordParams) SetLimit(Limit int) (*ListAccountUsageRecordParams){ + params.Limit = &Limit + return params } // Retrieve a single page of AccountUsageRecord records from the API. Request is executed immediately. func (c *ApiService) PageAccountUsageRecord(params *ListAccountUsageRecordParams, pageToken, pageNumber string) (*ListAccountUsageRecordResponse, error) { - path := "/v1/UsageRecords" - - data := url.Values{} - headers := make(map[string]interface{}) - - if params != nil && params.End != nil { - data.Set("End", fmt.Sprint((*params.End).Format(time.RFC3339))) - } - if params != nil && params.Start != nil { - data.Set("Start", fmt.Sprint((*params.Start).Format(time.RFC3339))) - } - if params != nil && params.Granularity != nil { - data.Set("Granularity", *params.Granularity) - } - if params != nil && params.PageSize != nil { - data.Set("PageSize", fmt.Sprint(*params.PageSize)) - } - - if pageToken != "" { - data.Set("PageToken", pageToken) - } - if pageNumber != "" { - data.Set("Page", pageNumber) - } - - resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAccountUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - - return ps, err + path := "/v1/UsageRecords" + + + data := url.Values{} + headers := make(map[string]interface{}) + + if params != nil && params.End != nil { + data.Set("End", fmt.Sprint((*params.End).Format(time.RFC3339))) + } + if params != nil && params.Start != nil { + data.Set("Start", fmt.Sprint((*params.Start).Format(time.RFC3339))) + } + if params != nil && params.Granularity != nil { + data.Set("Granularity", *params.Granularity) + } + if params != nil && params.PageSize != nil { + data.Set("PageSize", fmt.Sprint(*params.PageSize)) + } + + if pageToken != "" { + data.Set("PageToken", pageToken) + } + if pageNumber != "" { + data.Set("Page", pageNumber) + } + + resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAccountUsageRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + + return ps, err } // Lists AccountUsageRecord records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning. @@ -138,6 +139,7 @@ func (c *ApiService) StreamAccountUsageRecord(params *ListAccountUsageRecordPara return recordChannel, errorChannel } + func (c *ApiService) streamAccountUsageRecord(response *ListAccountUsageRecordResponse, params *ListAccountUsageRecordParams, recordChannel chan WirelessV1AccountUsageRecord, errorChannel chan error) { curRecord := 1 @@ -169,19 +171,20 @@ func (c *ApiService) streamAccountUsageRecord(response *ListAccountUsageRecordRe } func (c *ApiService) getNextListAccountUsageRecordResponse(nextPageUrl string) (interface{}, error) { - if nextPageUrl == "" { - return nil, nil - } - resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) - if err != nil { - return nil, err - } - - defer resp.Body.Close() - - ps := &ListAccountUsageRecordResponse{} - if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { - return nil, err - } - return ps, nil + if nextPageUrl == "" { + return nil, nil + } + resp, err := c.requestHandler.Get(nextPageUrl, nil, nil) + if err != nil { + return nil, err + } + + defer resp.Body.Close() + + ps := &ListAccountUsageRecordResponse{} + if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { + return nil, err + } + return ps, nil } +